I want to do I2C communication between esp8266 and arduino nano
but it not work
the connections i made
GND to GND
D1 or (GPIO 5) (esp8266) to A5 (Arduino nano)
D2 or (GPIO 4) (esp8266) to A4 (Arduino nano)
I connect both of them separately with my computer
i2c is primarily intended to access multiple hardware devices using a shared set of connections, where a request is made for the data at a specific address in the device. there are other approaches to communicate between devices where information is no address (within a device) based
Is that a classic Arduino Nano with a ATmega328P microcontroller ?
Have you found the button <CODE/> ?
The sketch should be between three backslash single quotes.
```
your sketch
```
The SDA should be connected to SDA.
The SCL should be connected to SCL.
The GND should be connected to GND, and the GND is the most important.
The ESP8266 is a 3.3V processor with a 3.3V I2C bus.
The Arduino Nano is a 5V Arduino board with a 5V I2C bus.
That means you need a I2C level shifter.
There is something you can do to test the I2C bus.
Do you have other I2C devices such a sensor ? Can you find a I2C Scanner sketch ?
Run a I2C Scanner sketch on the ESP8266 and connect a sensor. The sketch should find it. Then make an empty sketch for the Nano with only Wire.begin(0x20); in setup(). Try if it can be found.
the connections are same as you mention
however i connect both of them seprately with my computer with their cables
also i didn't understand the sketch working which you ask me
Because my task is to perform I2C communication between them or use arduino nano and esp32-cam but with esp32-cam i am confused with it's connections so i choose esp8266 and arduino nano
Dear it is work assignment
I think there may be a problem with arduino nano
I'll try this with another arduino
but I checked simple blinking examples and simple write commands are working on this arduino
The Wire.begin() does not look correct. Nowhere do you tell the ESP8266 what its I2C address is, and normally you would not specify an address for the master device.
Wire.requestFrom(8, 5); // takes 5 byte data from device address 8
while (Wire.available()) {
char a = Wire.read();
Serial.println(a);
}
char d = Wire.read();
Serial.println(d);
delay(1000);
}
'''
in these codes i use 8 slave device address
but with these codes it shows me nothing in their serial monitors
here i use Wire.begin with slave address and in esp8266 with it's SDA and SCL pins configuration
Please do not duplicate your questions as doing so wastes the time and effort of the volunteers trying to help you as they are then answering the same thing in different places.
Please create one topic only for your question and choose the forum category carefully. If you have multiple questions about the same project then please ask your questions in the one topic as the answers to one question provide useful context for the others, and also you won’t have to keep explaining your project repeatedly.
Repeated duplicate posting could result in a temporary or permanent ban from the forum.
Could you take a few moments to Learn How To Use The Forum
It will help you get the best out of the forum in the future.