I2C 2004 Serial 20 x 4 LCD Module via USB UART

Forum for posting topics and questions about anything.
Post Reply
colbsure
Posts: 2
Joined: Wed Feb 25, 2015 9:32 am

I2C 2004 Serial 20 x 4 LCD Module via USB UART

Post by colbsure » Wed Feb 25, 2015 10:11 am

Hello,

I purchased a I2C 2004 Serial 20 x 4 LCD Module from yourselves with the intention of using a USB=>serial connection to talk to it via my Pi or PC.

I connect it as follows with my USB UART in 5v mode (I have used this USB UART successfully in the past):

UART->LCD
========
GND->GND
5v->VCC
SCL->TX
SDA->RX

When I plug it in on my windows machine the drivers successfully install and it shows up as COM3. The unit comes on and the 1st and 3rd lines of text show as solid blocks (I understand this means it is uninitialised).

I then run the following Python to send some text through (this was gleaned from t'internet)...

import serial
lcd = serial.Serial("//./COM3", 9600)
lcd.write("\xFE")
lcd.write("\x47")
lcd.write("\x01")
lcd.write("\x01")
lcd.write("Test)

...and nothing happens. At this point I realise I don't have a clue what control codes to send through to this thing so I quickly knock up another Python script to send through all 64K combinations of 2 bytes just to see if I can get a reaction out of this thing... nothing. Tried the same thing via my PI (with the appropriate serial port) and the result was the same.

Can anybody help me with this - I'd very much like to understand the appropriate control codes and get some text displayed on it through a USB UART.

Regards,
Col

andrew
Site Admin
Posts: 1374
Joined: Sun Aug 05, 2012 4:15 pm

Re: I2C 2004 Serial 20 x 4 LCD Module via USB UART

Post by andrew » Wed Feb 25, 2015 5:31 pm

Although the LCD does use a serial interface it is actually an I2C (sometimes called IIC) interface. I'm afraid this isn't compatible with a standard serial UART interface that you are probably using with your PC. You'll need to either use the I2C interface on the Raspberry Pi or purchase a suitable I2C interface for your PC. Probably the cheaper option would be to simply purchase a cheap Arduno board such as a pro mini to act as the serial to I2C interface.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

colbsure
Posts: 2
Joined: Wed Feb 25, 2015 9:32 am

Re: I2C 2004 Serial 20 x 4 LCD Module via USB UART

Post by colbsure » Thu Feb 26, 2015 10:53 am

Hello Andrew,

Thanks for your advice.

Do you have any documentation on how would I effect a USB => IIC interface using this pro mini?

Regards,
Colin

andrew
Site Admin
Posts: 1374
Joined: Sun Aug 05, 2012 4:15 pm

Re: I2C 2004 Serial 20 x 4 LCD Module via USB UART

Post by andrew » Thu Feb 26, 2015 12:47 pm

For controlling the LED via a Pro Mini, this is quite straight forward (assuming you have some experience with Arduino). You simply need to download and install the Arduino development environment from the Arduino website (arduino.cc). If you take a look at our thread for this LCD here...

http://forum.hobbycomponents.com/viewto ... =75&t=1368

...you'll will find a library and example sketch in the first post. You need to download the library and unzip it in the libraries area of your Arduino development environment. Assuming you are using windows this is usually found here:

My Documents\Arduino\libraries\

If there is no libraries folder at that location then just create it. Then simply cut and past the sketch into your Arduino IDE and download it to your Pro Micro. Connections are shown in the sketch. These are for an Uno but should be exactly the same for a Pro Mini.

Unfortunately we don't have a sketch that bridges from the Pro Mini's serial port but the example sketch will help point you in the right direction.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

Post Reply

Return to “General Discussion”