Main Content

This 16x2 LCD is too traditional and still very much popular in the world of electronics and embedded system. I remember I started programming on PIC for displaying text on these LCDs around 8 years ago. Now I just found one of these LCD from my junk box and want to try it out because it is nostalgic. It reminded me the 4 bit data lines plus additional 2 control pins, a total of 6 minimum signal pins and obviously additional 2 mandatory power wires +5v and GND, so a total of 8 wires. If this display is designed in 2019, for sure it will have only Vcc, GND and a single wire data pin or in worst case the 2 wire i2c or TWI.

Then I just thought why even 1 wire for data? Because we can easily multiplex the 1 wire data line with the Vcc line by keeping a diode + capacitor combination towards the LCD power supply pin.
I am using an arduino board to do the serial to parallel conversion + some packet parsing and lcd backlight brightness control. I am not a huge fan of Arduino but for this simple proof of concept, I don’t want to bring out a Makefile folder with muliple files. I picked the Arduino UART RX as the serial receiver. RX pin is connected directly to the input Vcc, but before the schottky diode. After the diode a capacitor is used to hold the DC voltage when the Vcc gets modulated with the UART TX of the other end. Better explained in the below pic.

I haven’t written any LCD related initialization in the arduino, I just used it for serial to parallel converter + backlight LED contrast control. So the entire display initialization could be sent from current-buffered UART port. There are 4 types of single byte commands which is implemented inside the arduino.

(x is lower nibble, command is higher nibble)
0xA[x] where x is the lower nibble which will be placed on LCD pins 4 to 7
0xB[x] where if x is 1, RS will be SET HIGH, if zero, RS will be cleared or SET LOW.
0xC[x] where if x is 1, EN will be SET HIGH, if zero, EN will be cleared or SET LOW.
0xD[x] where if x is PWM value for LED backlight, its range is from 0 to 15 where it gives max brightness at 15.

I am using a USB to UART converter to connect the device to my laptop. A python script is doing the lcd initialization and data streaming. A small modulator circuit is used to convert the UART TX low power signal to a power signal which can load high current. I cannot use the TX pin as it is because it cannot load the current which is required to operate the LCD with backlight. So this buffer circuit is used and I am using 9600 baudrate so that the 2.2K resistor is low enough to maintain the fall time when the output stage MOSFET is OFF.”

Link to article

Related Content