Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

I2C interface at 3.3 volts

Status
Not open for further replies.

nobody102

New Member
I want to use my Lego NXT to interface to an I2C device (NS73M FM transmitter). However, the max operating voltage for the device is 3.3V and the max input voltage for the serial lines is 3.6V. I can use a voltage regulator to step down the ~5V from the NXT interface (Pin4), but
I then also somehow need to step down the SDA and SCL lines to 3.3 volts max. I was thinking about using a set of diodes in series, but not sure how that would affect the signal. Any suggestions are welcome!

Thanks!
 
You could use a set of diodes on the clock line but the data line is bidirectional and so diodes wont work. You could use a resistive divider with a 3.3V zener on the data line. As the outputs are open collector you have to have pull up resistors anyway (you would probably have to stay at 100kBaud). Microchip have a document that you may find useful.

Mike.
The circuit would be,
Pullup to 5V on 5V end. (10k)
Resistor from 5V to 3.3V I/O. (2k)
Zener from 3.3v input to ground.
 
Do you know how I2C works? The only thing on I2C lines that can make the line go HI is the pull-up resistors. Every I2C device can only pull the line low to ground (to communicate a LO) or let it float (at which point the pull-up resistors pull the line HI). This is how I2C detects if there are collisions on the line, if devices release the line to communicate a HI but the line stays LO, then you know another device is trying to send a LO and therefore know there is a collision. NO I2C device can "send a +V" over it's I2C pins. It can only go high impedance or LO (pull to ground).

ANd since I'm pretty sure 3.3V is still high enough to be a logical HI, all you have to do is make the pull-up resistors go to 3.3V instead. The main thing now is...are there any pull-up resistors in your 5V devices? If there are, you gotta get rid of them and make sure that all the pull-up resistors are to 3.3V. If they are already there in your 3.3V devices then you're done because you only need one pull-up resistor per line. Adding pull-up resistors has the "parallel resistors is the same as a single smaller resistor" effect and is the same as using one pull-up resistor of a lower value which can cause too much current to flow through the device pins when they pull the line LO to ground.

BTW, regulators are used to supply power. You can't use them to reduce a 5V signal to a 3V signal (or anything else like that). They are too slow to follow the digital signal, and don't behave properly when the input voltage drops below Vout + Vdropout. THey tend to output something more like Vin-Vdropout in that situtation which isn't necessarily a logical LO unless your VIn is low enough.

FOLLOW-UP EDIT: I read around and it seems the NXT has no pull-up resistors. Also, most slaves devices also do not have pull-up resistors either because it is expected there may be more than one slave on the I2C bus. If each had it's own pull-up resistors the total pull-up resistance of the lines might be too low causing too much current to flow through device pins when they pull the line LO. It makes more sense to integrate the resistors into the master since there is *usually* one master per bus. But even then, it's not a sure thing. So for the most part, no I2C devices have any pull-up resistors and they must be provided by the user. So, basically, make sure there are no 5V pull-up resistors on the CLK or DATA I2C lines. And make sure there is one 3.3V pull-up resistor for SCL and SDA each. You will have to add them if they aren't present in some other I2C device you have connected to the line.

Hope this helps.
 
Last edited:
Yes, I am using a voltage regulator for the power only, not signals. Now, I see that your answer was right in front of me - connect the I2C lines to the 3V out from the power supply. You use an 82K pull-up resistor as stated in the NXT H/W spec. So I will try that, and life should be good!

Thanks!
 
A smaller resistance might work better. 5V at 82K makes 0.06mA flow when the line is pulled to ground. Less current will flow at 3.3V. you'd need 55K to get the same current. The value isn't too important though as long as it's not too low or too high. More current means more noise immunity and faster edges but more heat dissipation.

I use 4.7K usually or try to get 1mA of current.
 
A smaller resistance might work better. 5V at 82K makes 0.06mA flow when the line is pulled to ground. Less current will flow at 3.3V. you'd need 55K to get the same current. The value isn't too important though as long as it's not too low or too high. More current means more noise immunity and faster edges but more heat dissipation.

I use 4.7K usually or try to get 1mA of current.

Yes, basically the higher the resistor the slower the bus will work at - depending on the capacitance on the lines.
 
ANd since I'm pretty sure 3.3V is still high enough to be a logical HI, all you have to do is make the pull-up resistors go to 3.3V instead. The main thing now is...are there any pull-up resistors in your 5V devices? If there are, you gotta get rid of them and make sure that all the pull-up resistors are to 3.3V. If they are already there in your 3.3V devices then you're done because you only need one pull-up resistor per line. Adding pull-up resistors has the "parallel resistors is the same as a single smaller resistor" effect and is the same as using one pull-up resistor of a lower value which can cause too much current to flow through the device pins when they pull the line LO to ground.
While at 3.3V will most likely work fine as a high for 5V CMOS, it is slightly out of spec with the 5V part wanting 0.7Vcc or 0.7*4.5=3.1V to 0.7*5.5=3.85V on a 3.3V rail that ranges from 3.0-3.6V.

He needs check to see if his CPU will take 2.5V or less as a high. If so he can as has been noted by others simply tie off the pull ups to 3.3V. If not he needs to acquire on of the esoteric bus buffers/translators or run his CPU at 3.3V.

Dan
 
The best solution for this is something like the following:

Voltage Level Translation - Dual Supply Translators - TXB0104 - TI.com

It has four lines, so it can be used for additional I/O to the low voltage side. The second best way to do this is with two small MOSFETs. There's an application note out there on how to do it, I'll go look. It's very simple.

EDIT: I couldn't find the app note. But here's an I2C translator with only two lines available in an 8 pin smt package.

Interface - I2C - PCA9306 - TI.com
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top