Directly interfacing 5V I2C devices with 3.3V Prop
Rayman
Posts: 14,876
I was able to connect a +5V DS1307 I2C RTC directly to the Prop's SDA and SCL lines and have it work properly.
This works because devices on the I2C bus just pull down these signals (they don't output anything).· It's as if they all have open collector I/O.
The problem is whether or not 3.3 V is enough for the device to register as a logic high or not...
The datasheet for the DS1307 says it just needs·2.2V for "logic 1 input".· But, other things, like I/O expanders·PCF8574 and PCA9554 are rated for 0.7*Vcc, which is 3.5 V.· Still, this might be close enough to work...
Anybody have luck directly connecting 5V I2C devices to the Prop?
This works because devices on the I2C bus just pull down these signals (they don't output anything).· It's as if they all have open collector I/O.
The problem is whether or not 3.3 V is enough for the device to register as a logic high or not...
The datasheet for the DS1307 says it just needs·2.2V for "logic 1 input".· But, other things, like I/O expanders·PCF8574 and PCA9554 are rated for 0.7*Vcc, which is 3.5 V.· Still, this might be close enough to work...
Anybody have luck directly connecting 5V I2C devices to the Prop?
Comments
-Phil
I've used the PCA9512A (gives hot-swap ability) and the PCA9509 (easy pin arrangement)
·
Regards,
Craig
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
My system: 1.6 GHz AMD Turion64 X2, 4GB DDR2, 256MB ATI Radeon Graphics card, 15.4" Widescreen HD Screen
I have a duel boot of Ubuntu Linux and Windows Vista. Vista, because it came with the PC, Ubuntu because I like software that works.
"Failure is not an option -- it comes bundled with Windows."
Use The Best...
Linux for Servers
Mac for Graphics
Palm for Mobility
Windows for Solitaire
It can be slightly improved by a diode at the prop rather than the 1k..
Post Edited (deSilva) : 2/28/2008 8:21:14 PM GMT
-Phil
Sorry, bad thinking from me...
This is a simplified version of the two-transistor circuits posted here and here and is more or less the bipolar equivalent of the Philips' circuit mentioned above.. (Actually, either one of those would be better than my transistor/diode version.)
-Phil
Post Edited (Phil Pilgrim (PhiPi)) : 2/28/2008 9:01:15 PM GMT
However, I think the voltage at the Prop, the way I drew it actually gets a bit bigger than 3.3V due to the drop across the internal protection transistor. So, I don't think a diode is necessary...
-Phil
Addendum: BTW, this whole discussion is a subtopic of this thread and maybe should have gone there. Just so it doesn't get lost, I'll post a link there back to this thread.
Post Edited (Phil Pilgrim (PhiPi)) : 2/28/2008 11:18:06 PM GMT
The FET cct. for 3.3v to 5.0v signal conversion shown above is available from http://www.hvwtech.com, stock code SKU# 50550 and is called a Logic Level Converter for a couple of bucks each. I have not tried it. If anyone has let me know how it worked out.
As for the I2C discussions I think if they are true I2C devices then they do not supply voltage (passive device) and the associated current. They only drain to ground or pull down the voltage on the line when chatting. If 3.3 volts is the pull up voltage and that happens to be high enough to be recognizes as a 1 then it really what else it needed? The propeller should be used carefully because communicating with the output as an active supplier of voltage to a device, which is sinking current, may cause some troubles with the Prop output cct. and the receiver of the Prop current. It should really alternate between open (input which is 1) and sinking pull up voltage (zero) as an output only. I am working with some of these devices now and I will let you know if I run into problems. It does seem prudent to put a series resistor in the I2C lines just in case something wants to supply power to your Prop output or if you programmed and decided to make a "1" active from your end. There is a good little write up about I2C at: http://www.best-microcontroller-projects.com/i2c-tutorial.html
So when coding I would think that something like:
repeat 8 ' Output data to SDA
·· outa[noparse][[/noparse]SDA] := (data <-= 1) & 1
·· outa[noparse][[/noparse]SCL]~~ ' Toggle SCL from LOW to HIGH to LOW
·· outa[noparse][[/noparse]SCL]~
May not be the best without series resistors. Instead, keep the output low and toggle between input and output to allow the pull up resisters to do their job. Like I said earlier I will give it a try and let you know if I run into trouble.
Post Edited (Octahedron) : 11/29/2009 6:22:32 PM GMT
-Phil
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Post Edited (Octahedron) : 12/6/2009 12:59:52 AM GMT
-Phil