Questions tagged [i2c]

Inter-Integrated Circuit (I²C) is a bus for low speed peripherals. Use this tag for questions regarding how to use I²C with an Arduino, or for problems with I²C and your Arduino.

Filter by
Sorted by
Tagged with
1 vote
0 answers
851 views

DS3231 RTC not working with ESP32

I am using ESP-32-WROOM-32 with a RTC DS3231 module. I have connected SDA & SCL pins of RTC DS3231 with ESP32 D22 and D23 pins. Also, the VCC of RTC is connected to 3V3 of ESP32 and the GND of RTC ...
2 votes
1 answer
283 views

How to control multiple servo motors at the same time with protothreading using an I2C PCA9685 PWM board?

I'm trying to use protothreading to control two (and eventually four) servo motors over I2C using a PCA9685 PWM board. To start, I am simply trying to sweep the two motors back and fourth at the same ...
  • 31
1 vote
0 answers
59 views

I2C 16x2 LCD - Will Initialize (sometimes) - Holds Up The Code

Basically I have a keypad, that when a certain code is entered, it will write either "Wrong code" or "Good code" on the LCD. At the same time a timer will count down until 0 is ...
0 votes
1 answer
118 views

Two-Wire Interface (TWI) Frequency and SMBus Compatibility

Have I understood the ATmega328P datasheet correctly regarding the TWI clock frequency? From §21.5.2 Bit Rate Generator Unit, the TWI clock frequency is calculated as follows: Then solving for TWBR: ...
  • 689
1 vote
2 answers
281 views

Writing to a specific I2C register

I am trying to write to a specific register, but value doesn't change. Working with SenseAir Sunrise CO2: Info from i2c guideline from sensor manufacter https://rmtplusstoragesenseair.blob.core....
1 vote
1 answer
165 views

AW9523B I2C on Arduino Nano

I'm testing the AW9523B IO expander with an Arduino Nano. I can't get the device to be recognized. Using I2C scanner to find all attached I2C devices. I've connected AW9523B to the correct pins to the ...
  • 150
-1 votes
1 answer
172 views

SMBus on ATTiny204 [closed]

So I want to connect multiple LED Panels with dynamic addressing to a Master Controller. Seems like SMBus should be able to do that, however I don't find any Library for the Arduino framework. Does ...
3 votes
3 answers
1k views

MPU6050 does not give output

I need help getting my MPU 6050 to actually give me data. As of right now, my program is only reading 0s from the gyroscope and when I move it, the values all go to -1 and the program just stops until ...
2 votes
1 answer
68 views

I am in need of a usable communication library on 1-4 pins of ATTiny84 instead of I2C

I messed up when designing my PCB and just assumed that I could use software slave I2C with ATTiny84. The reason I did so is - I needed to use all of the analog inputs. The pins I have on my ...
0 votes
1 answer
228 views

Multiple I2C devices connected to one Arduino Uno?

Is it possible to connect more than one I2C device to an Arduino Uno? I know that the SCL and SDA pins are on analog pins A4 and A5 respectively, but there are also two pins labeled SCL and SDA ...
1 vote
1 answer
97 views

How to stop Single Analog Pin Keypad Matrix (Using Resistors) from receiving Interference from Livewire/other Sensors?

I saw a tutorial on linking a keypad using one pin, utilising several resistors: http://razibshahdat.blogspot.com/2018/05/one-single-analog-pin-keypad-control.html I have this keypad, a 16x2 LCD, a ...
2 votes
1 answer
159 views

Can you use multiple arduinos to run two programs simultaneously?

If I want to run 2 different programs simultaneously, can I do this with 2 arduinos wired together? Context: I’m building a robot that will balance with reaction wheels while doing other tasks. I ...
  • 21
1 vote
0 answers
374 views

ESP32 + Attiny85 AC Dimmer

I am working on an AC Dimmer project using ESP32 and Attiny85. Note : I know ATtiny85 is overkill for this project, And it can be done without Attiny85, I have already done this using ESP32 alone. ...
0 votes
1 answer
45 views

DS1337 with shared I2C pull-up

I have a project using an ATMEGA328P and a DS1337 RTC chip. The DS1337 is an 8 pin IC with VCC at pin 8 and GND at pin 4. According to the datasheet both pin 5 (SDA) and pin 6 (SCL) need an external ...
  • 43
1 vote
1 answer
95 views

Trying to use I2C accelerometer and SPI OLED

I'm trying to stream the data coming from my I2C MMA8452Q accelerometer to an Adafruit-based SSD1351 OLED RGB display that uses SPI via an Arduino UNO. When I run example code for the accelerometer I ...
  • 11
1 vote
1 answer
53 views

How to properly send bytes between RPI and Arduino over I2C while using ISR without IOerrors?

I have a I2C connection between an RPI 3B+ and Arduino Nano. I want to send a key and a corresponding value byte, and the arduino does something with that inside a timed ISR. Which works. But I get ...
1 vote
1 answer
125 views

How do I read from a correct data address of LIDAR using Arduino in I2C?

I need to read the distance data from a lidar in I2C using an Arduino Nano. Currently, this is the code I've written. unsigned int readDistance() { unsigned int dist = 0 ; // LiDAR actually measured ...
1 vote
1 answer
477 views

How to set 16x2 LCD I2C display backlight?

I have 16x2 LCD display with a I2C backpack. This is the library I am using https://drive.google.com/drive/folders/16_UqfwFm4VKWcdeJfDmHRV2Hj_IoaTai?usp=sharing So as given in the code below, by ...
  • 472
1 vote
2 answers
331 views

Digispark Rev.3 Kickstarter ATTiny85 using all 6 pins

i have some trouble to use i2c and the other pins at the same time. im tring to control the attiny over i2c with a arduino and the attiny should control a 28byj-48 stepmotor. i started to setup the ...
  • 11
2 votes
1 answer
701 views

Arduino with LCD Display does not reset/restart/start on connection to power

A friend and I have been working on an Arduino Sketch that does a request to a local API, parses that data and prints it out on an LCD Display. When we upload the sketch to the Arduino it does exaclty ...
  • 23
2 votes
1 answer
600 views

Convert float to byte, from Arduino to Raspberry Pi i2c

I'm trying to send the temperature value from the DHT sensor to a raspberry pi through I2C. Which is the best way to do it?. The temp value is a float, and I think I have to convert it to byte and ...
  • 123
1 vote
0 answers
24 views

avrdude: stk500_recv(): programmer is not responding Arduino LCD_I2C Upload problem ( port not found and ...) [duplicate]

i have problem to upload the LCD I2c Example program to Arduino UNo. the code are shown below: //YWROBOT //Compatible with the Arduino IDE 1.0 //Library version:1.1 #include <Wire.h> #include &...
0 votes
1 answer
61 views

Read from lux hangs in bright light

I am using VMEL6040 sensors and occasionally under bright light the read can hang, rather than using a wdt to recover I would like to ask some questions about the library. as for debugging the sensors ...
0 votes
1 answer
162 views

I2C pull up resistors and an I2C MUX

I have a rig with 5 light sensors on an I2C mux and I am wondering if I need only 1 pull-up resister set for the whole bus or one on each branch from the mux? Or should I remove all the pull-ups from ...
1 vote
0 answers
129 views

How to name the temperature sensors instead of printing address using ds2482-100 and ds18b20 sensor- Help

I am using 10 ds18b20 Temperature sensors using with "DS2482-100" I2C board and Arduino so when I am getting the output like this:- "ROM = 28 46 04 1F 0D 00 00 74 96014B467FFF0A100A 25....
1 vote
1 answer
131 views

Error in I2C Communication Between Arduino and Raspberry Pi

The code below sends data to Raspberry Pi every 20 millisecond. The code works fine but sometimes python throws an error. Why this is happening? Should I give more time between writeData? Error: > ...
  • 113
1 vote
0 answers
78 views

Unable to write, or read a sensor's registers. Do I have an error in my code?

I'm trying to write to register the change some settings for a sensor I'm using (BNO055) and then read the same register to verify if the changes are successful. However, the only value I'm able to ...
1 vote
1 answer
713 views

Sending a struct over i2c

How would you send a struct from an i2c slave when requested by an i2c master? Slave Struct Respdonder Sketch (Seeeduino Xiao) #include <Wire.h> struct TransmitData { int a; int b; int c; ...
1 vote
0 answers
30 views

How to connect multiple MPU-9250 IMU sensors to a single Arduino Uno? [duplicate]

The datasheet says the I2C bus limits itself to only two MPU-9250 sensors. How can I control multiple (>2) MPU-9250 through a single Arduino Uno? Is it possible to add another bus? Please, help.
  • 11
-1 votes
1 answer
80 views

Is my BMA421 locked up?

I have been trying to set up the BMA421 motion sensor in a nrf52 based smart watch, using the datasheet for the BMA423, which has the same interface. I had got the sensor working well with the ...
1 vote
0 answers
185 views

Prevent flicker - Lcd with I2C module?

I have a 16x2 LCD with a I2C interface, and a Esp8266 based NodeMCU. I Have an issue where the second line of the LCD is flickering, but somehow the first line does not flicker. Why does this happen ...
  • 472
1 vote
1 answer
910 views

Multiple Wire.write() not working for Arduino Nano I2C

Code for Master #include <Wire.h> void setup() { Wire.begin(); Serial.begin(9600); } void loop() { Wire.beginTransmission(9); Wire.write('c'); Serial....
  • 11
2 votes
1 answer
141 views

Can't read data from registers using I2C

I am trying to read data from the registers 6, 7, 8 and 9 of the STC3100 (Data Sheet) using an arduino uno. I followed this tutorial: https://howtomechatronics.com/tutorials/arduino/how-i2c-...
  • 21
0 votes
2 answers
180 views

Serial and I2C not working together

I have very peculier problem. When I run this code SSD1306 fails to initialize. Output at serial console is: 20:26:33.194 -> MPU6050 OLED demo 20:26:33.532 -> SSD1306 allocation failed #include &...
  • 21
2 votes
1 answer
1k views

How detect I2C errors with requestFrom()

I am going to use MCP23017 chips, and some of them will be cabled with a 1 meter max unshielded cable. I am expecting that certain transmissions may toss errors. So I want to tackle this problems by ...
  • 133
1 vote
0 answers
108 views

How to use pins for I2C that is used from other hardware?

I am using ESP32 CAM for one project and I have a sensor that is I2C connected to pins 21 and 22 (default I2C). The sensor is working fine until I turn on the camera. The camera uses this pins (21,22) ...
  • 11
2 votes
2 answers
97 views

TTGO TS I²C adress

I'm working on a project using TTGO TS wich communicate wih arduino via I²C protocole How can I find the adress of TTGO TS board used in I²C communication ?
  • 21
2 votes
1 answer
94 views

What's the time out of Wire.begin()?

Here's a schematic of my project: The purpose is to make laptop work as keyboard for desktop PC. Nano uses Serial.read() to get keystrokes from laptop and forwards key press and release data to ...
1 vote
1 answer
157 views

Is it advisable to use Serial.write in an ISR when loop() routinely uses Serial.read?

I do not know much electronics. I have Nano v3 as I2C master, it reads 5-byte packets (of delimtted data) from PC's USB port, processes it and forwards it. I now need to implement a way to signal PC ...
2 votes
2 answers
687 views

What is the difference between serial begin() and wire.setClock() for I2C communication?

I am a new Arduino IDE user and have a simple question below For I2C transmission speed setting, there are serial begin() and wire.setClock(). Some sample codes just use Serial.begin() without Wire....
  • 21
2 votes
3 answers
916 views

Send values from Arduino Uno to Wemos D1 R1

I have a weather project in which I have to measure the temperature and humidity (DHT22 sensor), the pressure, and other things, and then show them on a local web page (using a Wemos D1 R1) in either ...
  • 21
2 votes
0 answers
92 views

SPI Arduino slave not recieving data correctly

Using an STM32L476RG Nucleo microcontroller board as the SPI master and an Arduino mega as a slave with pin 52 for SCLK, pin 53 for SS and pin 51 for MOSI on the Arduino. There is no issue with the ...
  • 21
1 vote
0 answers
86 views

Arduino Uno I2C two sensor connection Issues

I have been working on trying to get the MAXREFDES#117 PPG and the LIS3DH Accelerometer to run together. I am modifying the sample code found here to do so: https://github.com/...
  • 11
1 vote
1 answer
403 views

Arduino Nano Every I2C PORTMUX

Arduino Nano Every schematic informs us that we can use ATMega4809's pins PF03 and PF02 to communicate via I2C. ATMega4809 manual says in page 19 that in order to use those pins as I2C we need to use ...
  • 209
1 vote
0 answers
68 views

How to get a stable LED lighting without scintillation over I2C bus

I built an 8x8 led matrix using white 5mm LEDs. I drive the LEDs using the MCP23017 connected to an Arduino over the I2C bus. The wiring of the LEDs in the matrix is such that a row is made up of 8 ...
  • 53
1 vote
1 answer
336 views

Is it possible to change and save I2C address programatically?

I want to drive 3 i2c devices on a single i2c line. Is it possible to achieve this without using A0,A1,A2 pins? I thought the address of i2c devices should be programmatically changeable. 2 mcp23017 ...
1 vote
0 answers
425 views

Using MPU6050 with ESP32 Cam- MPU Not Detected

Hi I'm trying to build a self balancing robot using my esp32 cam, but so far I haven't been able to setup my mpu6050 with it.I'm using the adafruit libraries with the given example sketches. The only ...
  • 209
2 votes
1 answer
2k views

Can't Turn Off Internal I2C Pull-Ups on ESP32

I've designed a custom ESP32 board around the WROVER-IE module. To keep power low, I'm using a GPIO-controlled high-side FET to turn off unused peripherals when in deep sleep mode. The issue: I've ...
1 vote
0 answers
201 views

send command to Slave and receive response over I2c

so I have an Arduino mega as the master and an attiny84 as the slave the master can send a command S to the slave and the slave should respond with TRUE so here is my code: master: bool GetOnline(){ ...
1 vote
0 answers
512 views

Reusing Digispark ATtiny85 micro-USB as 1-wire bus

I'm working on a project of my home plants irrigation/hydroponic system(not cannabis!)) just chilies and other eatables). Also I'm trying to recycle modules, wires and other projects' leftovers such ...
  • 11

1
2
3 4 5
15