Pages: [1]   Go Down
Author Topic: I2C voltage incompatibility  (Read 2360 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 91
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello all.

I am using the Arduino Duemilanove Atmega328 -5V and I want to communicate with the Barometric sensor  BMP085 that is powered by 3V.

Is there any way to connect the Atmega with the sensor using the I2C without damaging it?

Your help is appreciated.

Thanks and regards,
Manuel Silva
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 1
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Working on the same problem myself right now. Will post a link.

http://www.rocketnumbernine.com/2009/04/10/5v-33v-bidirectional-level-converter/

Hope that helps.
« Last Edit: June 05, 2010, 09:58:32 am by jetonski » Logged

0
Offline Offline
Full Member
***
Karma: 1
Posts: 225
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Assuming the BMP085 is not 5v tolerant, one possibility is to run the I2C bus on 3.3v.

The Atmega hardware I2C pins are (according to the datasheet) open-drain when the TWI serial interface is enabled.  Therefore, you could connect them to a 3.3v device, and use external pullup resistors to 3.3v.

The catch is that the Wire library enables the internal weak pullup resistors when Wire.begin() is called.  I am not sure if this is dangerous for the 3.3v device, but you can edit the twi.c library to remove these lines:
Code:
#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega8__) || defined(__AVR_ATmega328P__)
    // activate internal pull-ups for twi
    // as per note from atmega8 manual pg167
    sbi(PORTC, 4);
    sbi(PORTC, 5);
  #else
    // activate internal pull-ups for twi
    // as per note from atmega128 manual pg204
    sbi(PORTD, 0);
    sbi(PORTD, 1);
  #endif

I have tried this, and verified that the I2C lines no longer go to 5v on Wire.begin(), and that communication is possible with a 3.3v I2C device.  YMMV.

Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 91
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello all.

Thanks for your help and suggestions. I am going to try both of them.

regards,
Manuel Silva
Logged

Rural Arizona
Offline Offline
Edison Member
*
Karma: 7
Posts: 1711
Incorrigible tinkerer
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Also look for Philips/NXP app note 10441:  it has a circuit for doing the level shifting using a couple of inexpensive N-channel FETs.
Logged

Pages: [1]   Go Up
Jump to: