1

The theory is that you can use 3.3v I2C devices from a 5v device as long as the pull ups are only to the 3.3v. I have a 5v pro mini connected to a bmp180 board which has a 3.3v regulator but no level shifters. It is working and giving me data but I am hoping I can get better quality measurements. One observation is the power rail on the BMP board after the 3.3v regulator is being pulled towards 5v. On the scope this looks to happen between i2c messages. I am using the "Adafruit-BMP085-Library" which is in turn using "Wire". In the wire library there is a comment that says that the writedigital() of 1 to the port is setting the pull ups.

Does anyone have any general advice on this issue?

What does the comment about setting the pull-ups mean? How is that function setting the pull ups?

When does the I2C switch back to being an GPIO? Are the lines being pulled high between messages because it is reverting to an GPIO?

  • This page explains the problem and offers some solutions. varesano.net/blog/fabio/… – BillyBag2 Jan 14 '17 at 2:21
  • Your question is unclear. What is a bmp180 (I could google, but you should include a link). I²C is open drain and requires pullups. The Arduino does not have these, and they are often on the I²C board. If these are to 3.3V OK, otherwise you have to remove, and install pullup to 3.3V. You could disable any internal pullups, which are useless, but if you use 1.8kΩ they would swamp any internal pullups. – Milliways Jan 14 '17 at 3:26
2

Whoever decided it would be a good idea to default to using the Arduino internal pull-up resistors on I2C needs taking out back and giving a good kicking. It is so wrong on so many levels.

Yes, if you disable the internal pull-up resistors you can safely use 3.3v devices. The simplest way to do this is to turn them off again as soon as you have done Wire.begin(); by writing 0 to the pins with digitalWrite().

  • I think it has been done this way so you can just connect chips to it without having to bother with any pull-ups. But it is kind of lazy and if you want it to work in the real world then it does need to be done properly. The AdaFruit module has level shifters on it. Overkill if everything is set up OK. There is still a 5v spike. Not sure if this will cause a reliability problem later. But looks a lot better on the scope now. – BillyBag2 Jan 18 '17 at 22:48
  • 1
    @BillyBag2 Not only is it kind of lazy, but it teaches new users that you don't need pullups on an I2C bus, so they get into all sorts of trouble when they transition to a better system. – Majenko Jan 18 '17 at 22:58

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.