0

I have connected an Arduino Nano, Mega and a LCD via I2C/TWI (SDA/SCL).

The Nano is playing the master while Arduino Mega and LCD are slaves. This works well till I power off the Arduino Mega. Of cause I don't expect the Mega to answer.

In particular the SCL line seems to pull-down the connection. Disconnecting SCL from the Mega will reestablish the connection to the LCD. I added two pull-up resistors 4.7k to both SDA SCL but no improvement from that.

Is there no way than physically disconnecting the lines?

migrated from superuser.com May 22 '17 at 22:17

This question came from our site for computer enthusiasts and power users.

1

See How to setup an I2C bus which stays valid if a slave is powered down or fails?

Basically I2C uses pull-ups to have all lines HIGH until any device bring it LOW. Arduino uses INPUT_PULLUP / OUTPUT+LOW states for this. But if you switch Arduino off (turn off Vcc), internal diodes cut the power on pins to Vcc (which is zero) +diode voltage (which is small), effectively to logical LOW. And I2C see that as the device is activelly sending LOW all the time - so communication is blocked.

If you just add pullup resistors, you either have them high enought so it not prevent this state or you have them low enought to draw the lines HIGH even when there is LOW on device, which prevents other devices to draw them LOW for communication. You need "cut off" such incactive lines - either physically disconnect (pull wires from connector - such as if you just get the Mega out of socket, or use some relays powered from Mega Vcc, which disconnet them when the power goes out) or electrically disconnect - using some circuits designed for it. There are some already sold or you can create your own to the same efect (if you are skilled in this area - otherwise it is much easier and faster to pay for some already made solution)

  • Or... don't power off the Arduino Mega. Use the same power supply for everything that is connected to the same I2C bus. – Jot May 23 '17 at 7:38
  • Well it would work too :) But I think, there is a reason, why the user wants to power off one of its arduinos, otherwise he would not get in the problem at all. – gilhad May 23 '17 at 7:41
  • BTW: I use setup, where I2C network uses 4 wires -SDA,SCK, GND and PWR - so I just power up the I2C bus with pullups and anything connected via I2C is powered from the same source (the I2C bus serves also as Power grid - and can be powered from real power source, not just Arduino). So either it is connected to I2C and powered, or it is not powerd, but also not connected to I2C at all. – gilhad May 23 '17 at 7:45
  • that is what we are here for: recognizing what could be a xy-problem: xyproblem.info My main Arduino Mega project has two of 5 wires. A 5V I2C bus with 5V power plus a interrupt signal and a 3.3V I2C bus with 3.3V power and interrupt signal. The interrupt signal is to detect when a Slave needs attention, for example alarm signals from motion sensors. – Jot May 23 '17 at 7:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy