Hi,
I found a simple solution for level shifting. It is written by Jim Hagerman, with the subject "Two transistor circuit replaces IC".
Regards, Marcel
Hi,
I found a simple solution for level shifting. It is written by Jim Hagerman, with the subject "Two transistor circuit replaces IC".
Regards, Marcel
It's even simpler that that. As I2C is open collector all you need to do is to put your pull up resistors to 3V3. You then need to edit the library file so that you don't enable the internal pull ups. It's just two lines and easily found.
Thanks Grumpy_Mike,
That is indeed simpler. That means that the Atmel I/O pins are voltage level tolerant.
That means that the Atmel I/O pins are voltage level tolerant.
No sorry that doesn't follow. If the pull up is to the lower voltage level it means that the one / zero threshold is below 3V3, not that it can stand more voltage.
The pull up is only to 3V3 so the 5V device has to cope with a lower voltage level making a logic 1.
The pull up is only to 3V3 so the 5V device has to cope with a lower voltage level making a logic 1.
Which can cause some problems. The ATmega168 is CMOS, the minimum high voltage is 0.6Vcc, so when powered by 5V it needs at least 3V to register high. For shorter distances this won't be too bad, but it can cause problems if there's any cable resistance or voltage ripple.
The two transistor circuit is cool, and pretty cheap. You can actually remove one transistor to get a unidirectional translator. However it may introduce more problems at higher speeds.
Here's a neat chip that does bidirectional level translation and works at higher I2C speeds: Electronic Components and Parts Search | DigiKey Electronics
Costs 84 to to 27 cents, so a bit more expensive than four BC847's and six resistors. But a lot easier to use, and smaller.
Yes, NXP has put 4 MOSFETS in a package and does the same. Thanks for your input macegr. I like those chips from NXP.