16x2 Lcd with Onion
-
@esunayg If it is of any help, I am using a 16x2 LCD with I2C interface on it with success on my Omega.
The device I am using is basically the same as http://yourduino.com/sunshop2/index.php?l=product_detail&p=170 and some additional related documentation can be found here https://arduino-info.wikispaces.com/LCD-Blue-I2CTo control it, I have adapted some C++ code from the Arduino libraries to use the Omega I2C code
-
Hello @Kit-Bishop,
wonderfull, can you share your code ... or just explained "To control it, I have adapted some C++ code from the Arduino libraries" !!!
this is what i need !!!tHanks Before all ... You're so Great !!!
-
@Gwena56 I have written some object oriented code for I2C access based on code for onion-i2c.c from https://github.com/OnionIoT/i2c-exp-driver/tree/master/src/lib
Then, I have adapted Arduino code from LiquidCrystal_V1.2.1.zip as described in and accessible from https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home
Adapting the code was not a trivial task and my code is at present pretty messy.
I will try to tidy it up and post it here. This may take me a few days, post a message to remind me about it.
-
@Gwena56 As promised, I have sorted out the code for the 16x2 LCD.
Some photos:
In the photos, the wires are:
- black - ground
- red - 5v
- green - I2C SCL to Omega Pin 20
- yellow - I2C SDA to Omega Pin 21
The software (attached below) should be usable on any 16x2 or 20x4 LCD that has I2C interface provided by LMC1602 or similar.
Depending upon your actual LCD device, you may have to change the configuration in the source code in the file i2clcd16x2.cpp as described in that file and re-build the application.The code is provided in the following files:
- i2clcd16x2-src.tar.bz2 - contains all required source code including a Makefile. To build the code you will need to have set up cross compilation as described in :
You will probably need to edit the Makefile to give the location of the toolchain
-
The important source files are:
- I2cAccessSystem.cpp - provides general access to I2C on the Omega
- I2CDevice.cpp - provides a class to represent a specific I2C device
- LCD_I2C.cpp - provides a class to represent a specific I2C LCD
-
The filei2clcd16x2 is a built program that works for my I2C LCD device, but you may need to modify and re-build it if your device is different.
This program is a very simple program to display two lines of text on the LCD and is run as ./i2clcd16x2 "<line-1-text>" "<line-2-text>"
Hope this is all helpful - let me know if I can help further.
-
@Kit-Bishop
wow nice example, for n00bs like me, this is perfect to learn from!
thanks for sharing
-
@Kit-Bishop ... You're the one formi, formidable !!!
after correcting the makefile (home/ ...) androot@Omega-1B67:~# i2cdetect -y 0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- 27 -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --to change the #define I2C_ADDR with 0x27 in the i2clcd16x2.cpp file.
it's work fine....
Thanks for sharing
Now i can compile C C++ and my LCD works... "c'est la cerise sur le gâteau"
-
@Gwena56 So please it worked for you and is the cherry on the cake!
-
Hi there is little PYTHON library :
http://davidstein.cz/2016/03/13/onion-io-i2c-lcd-16x220x4-backpack-library/
-
I've created a simple PHP-Class to access the 16x2 LCD (without I2C).
https://github.com/klein0r/php-onion-omega
-
Don't suppose anyone has a guide to using a standard HD44780 display rather than using a I2C adaptor?
I have an oled 16x2 display that is supposed to work at 3 to 5v so I'm hoping to use it at 3.3v but it is the 16 pin standard and I don't really want to add an I2C adaptor.
-
Regarding parallel mode 16x2 LCD using HD44780
It's less popular since that LCD will requires minimum of 6 data pins (in 4-bit mode) or 10 pins (in 8-bit mode.) Then you'll have to add power, backlight power, and contrast adjust.
This is why people are adding that I2C daughter card (usually $2 or less) to save the extra effort.See Arduino flavor of using parallel mode: https://www.arduino.cc/en/Tutorial/HelloWorld
ccs_hello