16x2 Lcd with Onion
I was just wondering if anyone has done this yet. Are there any library?
Lazar Demin administrators last edited by
@esunayg what protocol does the LCD use?
@esunayg As @Lazar-Demin says - it depends upon the interface your device has.
I have seen 16x2 LCD with:
- Multi pin digital interface
I have such a device that has I2C which I have successfully used from my Arduino.
While I have not yet tried it with my Omega, I do not envisage there being any major issues, though some coding will be required to use the Omega I2C libraries etc. to use it
I guess it is a Multi pin. It uses 4 data pins. Just checked it has a HD44780 on it.
Kit Bishop last edited by Kit Bishop
Any markings on the data pins? Do you have a photo of it?
Any manufacturer info etc on the board?
Doing a search for HD44780 indicates that it uses several more pins than just 4 data pins - though it may have an SPI or I2C controller mounted on it too.
- For multi-pin digital interface, I would expect at least 8 data pins plus some additional control pins and power and ground
- For I2C I would expect a total of 4 main pins: I2C data and clock plus power and ground though there could potentially be additional special function control pins.
- For SPI I would expect a total of 5 (or 6) main pins: SPI data (one or two pins MOSI and MISO for Master Out-Slave In and Master In-Slave-Out depending upon whether the device does one or two way communication - for an LCD display, it would be conceivable that MISO was not needed) and clock plus an enable pin plus power and ground though again there could potentially be additional special function control pins.
Sorry for late answer, @Kit-Bishop
I will take their photos and upload it here. I have lots of them and I guess there are 4 different types
@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-I2C
To control it, I have adapted some C++ code from the Arduino libraries to use the Omega I2C code
Gwena56 last edited by
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.
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.
Joren Chong last edited by
wow nice example, for n00bs like me, this is perfect to learn from!
thanks for sharing
Gwena56 last edited by Gwena56
@Kit-Bishop ... You're the one formi, formidable !!!
after correcting the makefile (home/ ...) and
root@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!
David Stein last edited by David Stein
Hi there is little PYTHON library :
Matthias Kleine last edited by
I've created a simple PHP-Class to access the 16x2 LCD (without I2C).
Andrew Walker last edited by
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