3.3v sensors on i2c bus using Pro mini 5v



  • Hi there!

    I will build a weather station using a Arduino Pro mini 5V but I see now that one of the sensors GY-BME280 can be fed at a maximum of 3.6V.

    I thought I was going to use the 5V version instead of the 3.3V version of Arduino Pro Mini because my weather station will handle a handful of sensors and I thought maybe I was going to need the extra processing power that comes with 16Mhz.

    Anyway, my question is if I should rather go with a 3.3V version of Arduino Pro Mini or if it's possible the use the 5V version without too much trouble. (I don't know how it should be done) Any thoughts on that? (Power consumption is not an issue, I will feed it with regulated 5V on RAW input pin)

    Thanks for helping me choose!


  • Mod

    @รอเร-อ you could use an i2c level shifter, such as http://s.aliexpress.com/Mb2aEfiU

    It translates the 5v voltage levels of your arduino to the 3v3 of the sensor and vice versa.



  • @yveaux
    Thanks for your reply. I don't have one of those at home so I think I will go for the 3.3V Arduino to start with. If things are moving to slow I'll consider your solution. Thanks again.



  • There is a guy on a different forum suggesting that

    Put pullup resistors on the SDA and SCL lines to 3.3V; the voltage levels will be valid for both 3.3V and 5V devices. Just make sure you don't set those pins on the Arduino as outputs and drive them high, as this could indeed damage the devices powered by 3.3V."

    https://forum.sparkfun.com/viewtopic.php?t=25433#p116548

    He also says that

    I2C is an open-drain bus, which means the devices don't actually drive the lines high (that is achieved with a pull-up resistor). Devices on the bus actively pull the lines low, but not high. As stated, pulling up the lines to 3.3V with a pull-up resistor will still be read as a valid logic “1” by devices powered with 5V.

    Usually you will use an inbuilt I2C module in the microcontroller, which takes most of the hassle out of bit-bashing it. If you do need to bit-bash, you need to be very careful what you do with the registers controlling the pins. You first need to write a logic “0” to the pins used for I2C, and then DO NOT CHANGE IT. To write a logic “1” to a pin, you change the Data Direction Register for that pin to make it an INPUT – the pull-up resistor will then pull the line high. To write a logic “0” to the pin, you change the Data Direction Register for that pin to make it an OUTPUT.

    Hopefully that’s not too confusing…

    What do you guys say about that? Can I write a logic “0” to the pins used for I2C and pull them high with a physical resistor connected to 3.3V or as we say in sweden "Am I out bicycling now?" 😀



  • @รอเร-อ I looked at this problem also for a similar 5v/3v scenario, but the I2C voltage requirements for 5v are just outside the technical capability for the 3.3v Arduino (from memory 0.6 or 0.7 Vcc). If you intend running the Arduino on reduced voltage this further shifts the capability.

    Google will find what I am referring to....



  • @zboblamont said in 3.3v sensors on i2c bus using Pro mini 5v:

    If you intend running the Arduino on reduced voltage this further shifts the capability.

    Thanks. I'm not planning to run my 5V Arduino on reduced voltage. It will be fed with 5V. I'm just looking to connect 3.3V devices to the i2c bus. (Only 3.3V devices)



  • @รอเร-อ Then I suggest you please re-READ, and as I suggested, Google, as Abraham Lincoln once said, "Never believe absolutely everything you read on the Internet".
    The 5v is irrelevant other than the threshold voltage which registers as a HIGH to it's I2C control.
    The 3v3 as Master dictates the HIGH as a factor of it's VCC on the I2C bus. THAT is the issue.
    As Vcc is never absolutely accurate you may strike lucky on a 3v3, there again you might not, your choice... 😉

    EDIT - To avoid any confusion, what I am referring to here is conventional I2C system. The input HIGH for a 5v is say 0.7 of Vcc, so 3.5v is required on the 5v I2C line to register as a HIGH. Even if a 3.3v Arduino were to put full Vcc on the I2C line it is just below the threshold for the 5v device. That is where the factor I referred to comes in, and I read elsewhere it can be 0.6 but cannot recall which device that referred to. Hopefully that clarifies what I was referring to.


Log in to reply
 

Suggested Topics

  • 4
  • 2
  • 14
  • 3
  • 9
  • 5

0
Online

11.2k
Users

11.1k
Topics

112.5k
Posts