I have tried using this library and the example on the web IDE (clock example.ino) and I am still getting errors from the start. I am using a 20x4 LCD (would this impact the timing?) and I am wondering whether the quality of I2C board on my LCD display or the wiring from the breadboard to the I2C board could be a cause. This is really blocking me with a project. Any suggestions?
I have just tried the pull-up resistor - have used 4.7Kohm and this seems to work reliably for me. Please ignore post above.
@armor, can you give more details on the errors you are getting? A lot has changed with the firmware since @BulldogLowell published the library and it may need some lovin’. Also, which I2C backpack are you using with the LCD?
YwRobot Arduino LCM1602 IIC VI is what is on the board on the back of the LCD board.
I started getting errors with 4.7kohms so have gone back to 10K ohms for the pull-ups and it seems better but still get errors. Errors can be eliminated if I am very careful with the rate at which I write lcd->print() and I don’t write long strings too often.
@armor, it is really unclear if pull-ups are included on the board. If they are, adding pull-ups off-board would simply drop the effective value of the total resistance. How are you powering the LCD and what voltage are you pulling up to?
@armor, if there are pull-ups on the board, they will go to 5V and compete with the 3.3V pull-ups you set-up. What happens when you remove the pull-ups? If you are powering the display/backpack with 5V, then pull-up to that value as well. The D0/D1 pins are 5V tolerant.
Write rate is always an issue with displays. The library may already had delays built-in for certain operations.
Since pullup resistor(s) should only be at one location (not every slave), I thought that the slaves would not provide a pullup resistor.
If you had 6 slaves on the wire, that would become a problem.
I thought you are responsible to place the pullup resisters yourself. I could be wrong.
@Jack, when you look around you’ll find plenty break-out-boards that do come with pull-ups and you’ll find others without (and very few with jumpers to detach/attach on-board pull-ups).
It’s true, that the user should be responsible for providing the pull-ups, but if you browse some threads, this is one of the things that gets forgotten just too often, so some board suppliers tend to build for out-the-box-only-one-slave users
Maybe they think, if one is seriously building something, they’d rather go for the chip and not a break-out-board.
@Jack, @ScruffR is dead on. Some breakouts even have cut-away tracks for disabling the pull-ups. I usually try to find schematics for the board and go from that. If not, visual inspection is my preferred way.
Sorry I am back on this Liquid Crystal I2C track - I have got the whole thing working reliably using the Clock Example - I figured I had a poor connection on the SDA and SCL wires from the bread board to the display module and changing these seems to have eradicated the issue.
However, I have tried to use createChar() function and have found that just including this creates the same problems with odd characters appearing at random on the screen. I can’t see any examples of using this command to create custom characters and write them to screen. I have looked at the library .cpp and .h and I am using the function in the right way. Could someone share a working example to set where I am going wrong? Thanks
How are you using createChar() and print the custom characters to the screen?
Just stating you do all things right does not leave any room for improvement
Hi, i try to compile this library (example code) to Photon, but there is error when compiling:
[code]LiquidCrystal_I2C_Spark/LiquidCrystal_I2C_Spark.cpp: In member function ‘void LiquidCrystal_I2C::init_priv()’:
This looks like an error in LiquidCrystal_I2C_Spark library.
Would you like to create an issue on GitHub to let the author know?
LiquidCrystal_I2C_Spark/LiquidCrystal_I2C_Spark.cpp:48:23: error: 'CLOCK_SPEED_100KHZ' was not declared in this scope
Wire.setSpeed(CLOCK_SPEED_100KHZ);
^
make[1]: *** [../build/target/user/platform-6LiquidCrystal_I2C_Spark/LiquidCrystal_I2C_Spark.o] Error 1
make: *** [user] Error 2[/code]
It’s photon specific (With Core it compiles OK). Anyone has idea how to fox it?
I have a couple of 16 x 2 displays of this type and trying to use the library (from the IDE) and the associated “clock.ino” example with a photon.
The interface board on the back of the 1602 module is labelled only “MH” and has VCC GND SDA and SCL pins.
The seller (eBay) says that VCC should be +5V
I can’t get it to display anything.
My assumptions:
D0 and D1 are to be used for SCL and SDA respectively? BTW: Would be useful to add the pin numbers in the library or example comments…I had to hunt around forums to find that out and so still not sure if they are right! Yes, in desperation I have tried reversing these in case the display pin labels are transposed.
I need pull-up resistors on the pins to match the 3.3v Photon pins to the display. I’ve run out of 4K7s so have used 5K1s - but also tried 3K9s - all to no avail.
My Activities so Far
I’ve tried powering the display from the VIN pin (+5V coming into the Photon’s USB connector from a 1A USB mains power brick) and also tried giving it its own separate +5V supply with common ground to the Photon pin 2 ground.
No matter what I do, the display does diddly. the backlight comes on with the power and looks normal brightness, but that’s it. no characters display at all. As I said, I bought two of these displays and have tried both - so less likely to be a product fault (though not impossible) and now I am out of ideas.
Plainly, I am missing something fundamental. Can anyone help?