I'm trying to run a 2004 I2C LCD on a 3.3V Due, and it finds the address and writes to it fine, and with the contrast turned all the way, I can see the print faintly at the right angle, so I know it's working, sorta. Obviously, the LCD needs 5 volts, and the due can supply it.
My question is: do I need a logic level converter in the SDA and SCL lines if I supply the LCD with 5 volts, to bring them down to 3.3 volts? My research has left me confused; some say yes, some say no. I don't want to fry my Due, but I need this display to work.
The Due has onboard pullup resistors on its main SDA, SCL pins.
In theory, you should remove any other pullups e.g. if mounted on your LCD backpack.
In practice, the backpack pullups (if mounted) are 4k7. The Due pullups are 1k5 (or 1k0).
The Due pullups will win i.e. I2C lines are idle at 3.7V (3.6V with 1k0)
Many Ebay I2C modules have mounted pullups. I2C should only have one pair e.g. on Due.
If you have several Ebay modules with mounted 5V pullups the idle voltages can rise above 3.7V which is bad for the 3.3V Due.
You get away with it on a 5V Uno. The Uno does not have onboard pullups. The Ebay onboard pullup modules are handy for a Uno. Even if you have several external pullups you are still within I2C spec.
The Wire library on a Uno enables internal pullups. So a Uno owner who has removed external pullups from a backpack will still "work" (but it is out of I2C spec)
Note that an I2C library should NOT enable internal pullups (but it does avoid tears before bedtime)
Remove backpack pullups. Connect GND, 5V, SDA, SCL to Due. LCD should be fine.
David, thanks for the reply. There are actually 3, 4.7K resistors on the i2c piggyback board. I removed the 2 closest to the sda & scl lines on the adjacent chip, but still have nothing. I attached a pic, but couldn't get it to display in the post. (I'm a little forum-rusty)
SDA/SCL have builtin pull-ups (1 K) connected to 3.3V, SDA1/SCL1 have no pull-ups.
If you remove pull_pulls on the LCD PCB, and you power your LCD with 5V, you should not need logic level shifters if the LCD consider 3.3V as an high level, although the safest is always to use level shifters
I removed the resistors labelled R8 and R9, as they seemed to be the ones connected to the SDA and SCL pins on the PCF8574 chip, and that didn't help.
Update: I hooked up the LCD to 5 volts instead of 3.3 volts, and now it works fine. The SDA and SCL lines pulse while it's displaying information at between 3.4 to 3.6 volts according to my MM. Hopefully that doesn't fry the Due. Should I put a logic level shifter in, or do you guys think that it is ok as it is?
Yes it is possible to cheat and not use level shifters and get things to work; however, be aware that while this can "work", it doesn't always work since things are not really wired up as they should be which is causing signals to be out of spec on one or both ends. (too far off and 3v pins can be damaged)
It can also create strange issues that can be hard to track down. Things like supply voltage and temperature or even cables can start to affect operation, particularly if using clock rates above the default 100k.
i.e. you can end up in situations where it works when hooked up to a PC USB port but then fails when hooked up a wall adapter because the supply voltage is different. (I have experienced this)
Then there is the issue of having to alter the slave devices that have pullups on them to remove the pullup to 5v.
Yeah it may not cause any damage on the default i2c pins on DUE when using a single slave with pullups to 5v but, IMO, it is an accident waiting to happen.
If you don't want to ever have to deal these types of potential issues, then I'd recommend using a level shifter.
They are very cheap and easy to hook up.
I occasionally do some testing without level shifters, but I always use them for my projects for boards like the esp8266 that are 3v when using 5v i2c devices like PCF8574 based backpacks/LCDs and RTC modules.
There are different types. I prefer the 2 channel ones.
I buy them off ebay.
The 2 channel ones are great for this type of application.
They have 3v side and 5v side. Each with 4 pins.
The 3v is actually an output from the onboard 3v regulator used for the 3v pullups on the 3v side.
You hook up the 3v SDA and SCL to the 3v side.
The 5v SDA and SCL to the 5v side.
Hook up 5v to the 5V pin. (don't hook anything up to the 3v pin)
Then hook up the grounds.
It is even possible to create a little module that connects inline with the existing wiring/cabling.
Thanks for the help, guys. I added an LLC and everything works fine. I should have just done that in the first place. Still haven't gotten the FRAM chip to work, but that's a different problem. LOL