Hello,
Is there any possibility to mix the devices with different source of power (3.3V and 5V) on the same I2C bus ? Lets say I have two power sources and several types of devices. One set of devices is suitable to run from 5V source and another set of devices required 3.3V.
Regards,
V.P.
Solved! Go to Solution.
There's a way to adapt levels bi-directionally. It only uses a mosfet and 2 resistors. I'm currently using it, without any problem. Not for IIC exactly, but it should work.
An image is attached.
PS: Also, if you google "bidirectional level converter" yo can find a lot of info and App Notes.
Take a NXP PC9516A I2C-Hub - it allows 3.3 or 5V input and you have 4 outputs - you can set them to 3.3 or 5 V just as you like.The outputs are buffered and you can enable/disable them separately.
Greetings pittie
You mean PCA9516A, right?
Rgds,
Celso
Hi VP,
Yes you can do it, but it will not be pretty. How pretty it isn't will depend on the devices involved.
There are a number of classes your devices might fall into:
If you can avoid the following, you should try. By using parts that fit into the first three classes, you could avoid the following ugliness.
I will discuss combining the last two, as that is the ugliest situation. First, the bus needs to be separated into a 3.3v segment and a 5v segment. The two segments are connected with resistors (I used 470 ohm), and each segment has its own pull-up resistors (2k typically) to their respected voltages. Then add clamping diodes to the 3.3v segment to prevent it from being driven over 3.3v by the 5v segment. If speed is not an issue, the pull-ups on the 3.3v segment can be eliminated and the 3.3v segment is then pulled-up by the 5v segment. But you then may want to lower the resistance of the segment-connection resistors, as they will limit the rise-time of the 3.3v segment. This will, of course, increase the current that is wasted through the connection resistors and the clamping diodes.
So, in effect, instead of two resistors for pull-ups, you have either four or six resistors and two diodes. Remember that the connection resistors and the clamping diodes will be dissipating 1.67 volts continuously, so size them accordingly.
rocco wrote:. . . I used 470 ohm . . .
Oops - I slipped a digit.
That should have been 4.7k ohm. 470 ohm would cause the 5v segment to be pulled down to about 3.6 volts by the 3.3v segment (assuming 2k pull-ups). The 4.7k value will still pul down the 5v segment, but only to about 4.5 volts.
Thinking about, I would considering Zenner. May be something like this
MCU [5V] GPS [3.3V]
1.5k
TX -------------^^^^--x-----x----------------RX
| |
--- = 0.1 uF
[Zen 3.3V] /\ |
~ |
| |
GND------------------x----x-----------------GND
RX ---------------------------------------------TX
Since MCU could handle TTL 0-5V TX from GPS, the only concern should be 5V TX from MCU to 3.3V RX on GPS module
I hope that could do the trick.
WBW,
V.P.
d0ct0r wrote:
Thinking about, I would considering Zenner. . .
If the GPS module has an internal clamping diode (most inputs do, just for static immunity), then the Zener and the cap would be unnecessary. The clamping-diode would dissipate less than 1.2 milliamps with a 1.5k series resistor, which should be fine (check the GPS modules data sheet). Most inputs can clamp at least 5 milliamps continuously.
If the GPS module does not contain an internal clamp, then a Schottky diode to the 3.3v rail would be better than a Zener to ground.
There's a way to adapt levels bi-directionally. It only uses a mosfet and 2 resistors. I'm currently using it, without any problem. Not for IIC exactly, but it should work.
An image is attached.
PS: Also, if you google "bidirectional level converter" yo can find a lot of info and App Notes.
Affirmative. This solution works like a charm.
Great Sebastian!
Creative solution! Thanks!
Saludos,
Celso
Hi Sebastian,
Thanks. That is indeed a nice solution.
I don't interface 5v to 3.3 volts much anymore, as I no longer use many 5v parts. But I will keep it for future reference.
Thanks for quick reply !
With my luck I have this situation:
However, it seems it has pretty strightforward solution - using some of the Logic Level Converters.
Now I have another challenge. There is 5V MCU with 5V I2C devices connected to it. And there is second MCU which could be powered ether 3.3 or 5V. However, this second MCU suppose to have 3.3V UART device connected to it (GPS module to be more detailed). I just wandering if its OK to connect 3.3V GPS module to UART on 5V powered MCU using something like this:
5v MCU 3.3v serial
GND ---------------- GND
RX ------------------ Tx
Tx ---1K8----3K3-- GND
|
--------- Rx
And then I could connect MCU to MCU using 5V I2C bus.
WBW,
V.P.
Hi VP,
That looks fine for transmitting from the MCU to the GPS module, but transmitting from the GPS module to the MCU may or may not work, depending on the input thresholds that the MCU accepts. As an example, the GTxx and GBxx MCUs require a high input to be at least .7 times Vdd, which will marginally NOT work, whereas the AWxx MCU requires a high input to be at least .65 times Vdd, which will marginally work. A TTL compatible input would absolutely work. I would use a pull-up plus series resistor arrangement, assuming the GPS module has a built-in clamping diode.
d0ct0r wrote:. . . I just wandering if its OK to connect 3.3V GPS module to UART on 5V powered MCU using something like this:
5v MCU 3.3v serial
GND ---------------- GND
RX ------------------ Tx
Tx ---1K8----3K3-- GND
|
--------- Rx