I'm using Arduino Uno with several sensors. Five sensors are connected by I2C.
The connection is illustrated below:
Sensor Arduino Uno
GND -> GND
SCL -> SCL
SDA -> SDA (next to AREF)
VCC -> 5V (POWER on board)
Five sensors are directly connected to arduino.
FIRST, I connected five sensors using dupont wires (each one about 15cm).
And it worked FINE. But it was inconvenient because the dupont wires were too short.
So I bought more dupont wires (each one about 40cm), and connected them in the same way.
This time the output got weird.
The serial monitor output nothing in the first time. And after I unmounted one sensor and its dupont wires, it worked.
I tried many things, and found out this.
Arduino with four sensors -> FINE
Arduino with four sensors +4PIN dupont wires -> ERROR
Error situation is described below:
Serial communication after try to get data from I2C.
And when I write Serial.println("Serial Initialized"); after Serial.begin(9600); in setup(), it outputs "Seri" or "Seria", and it stops.
When I use Serial.flush(); in setup(), it output "Serial Initialized" and it stops.
I have tried to read just single sensor and leave them all on the board. And the situation is same as above. Sensors are usable all the time. I just change the length of dupont wires.
Any idea about this error? Need help. Very appreciate for any advice.
Thanks for information provided by dmjlambert.
While searching for this problem, I find this thread.
And NoWorries said this:
"The only potential issue is that the internal pullup resistors are larger than that you are currently using, so it is possible that if your cable length going to the RTC is too long that the capacitance of the cable will cause the signals to be corrupted."
So I try to get dupont wires split. After wires are separated form others, the problem is solved. It seems cables which stuck together cause some kind of interference.
Hope this thread may help others.