Thursday, December 12, 2013

ATmega-8 based serialLCD module

ATmega-8 based serialLCD module
(Also provided my ready-to-use Arduino library & firmware sources)

In every electronic system, it is necessary to provide information in visual form for convenient user interface. So the display technology is one of the important subsystem in every electronic system like computer, cell phones etc..
If any kind of display is used in embedded control system then it will be very helpful to provide a human readable output. It can be also used for debugging for system designers. The most commonly used displays in embedded systems are as follow:
  1. LED
  2. LCD
  3. TFT
Out of this displays, the LED displays are easy to handle, but it requires large amount of input current & multiplexing to control each LED in the panel. TFT display provides good resolution & colorful graphics, but the main disadvantage is its cost & it requires a special kind of display controller / graphical processing unit to handle complex mathematical calculations to provide rendering to display.
The LCD displays are cost-effective solution for embedded system as it can display alphanumeric characters along with special user-defined symbols. The LCD display also contains a refreshing controller integrated in LCD unit which free up main microprocessor from task of refreshing the display & improves overall system throughput. But the disadvantage LCD display is it requires large no of pins for interfacing with system. So it is quite difficult to build a PCB of such LCD based systems practically.
Lets consider, we have a 16x2 alphanumeric LCD display which is to be interfaced with Arduino board. So for this design, we require 8/4 data lines to carry data signal to LCD along with 3 control signals i.e. RS,R/W,E. This large number of interfacing pins produces bulky system & increase the system & coding complexity which may cause sever errors like displaying unwanted characters on LCD or even up to display failure.
Basic idea of serialLCD:
The main objective of serialLCD is to control any kind of alphanumeric LCD display using a single signal line which communicates with LCD controller using serial communication technique. My serialLCD prototype consist of 2 major blocks:
  1. LCD controller:
It is ATmega8 microcontroller @ 8MHz internal osc. Programmed in Arduino IDE. It uses no-xtal bootloader which provide arduino compatibility without 16Mhz external crystal & also it is open-source. Using 8Mhz internal osc. Reduces hardware & improves power efficiency. ATmega8 uses its native serial port (USART) to communicate with master microcontroller. It acts as bridge between master controller & LCD. ATmega8 can be replaced by mega168/328 without changing code. (You must change bootloader.). The source file is provided as Firmware file in attachments.
  1. LCD display:
It’s a regular 16x2 alphanumeric display. There are no more customizations in LCD.
Features of serialLCD module:
  • 1 wire UART based Serial LCD
  • Arduino library is ready-to-use which provides easy commands & compatible with LiquidCrystal library. The serialLCD library uses SoftwareSerial library internally (on pin 6, 7) which free up native serial port for communications with other devices or PC.
  • LCD backlight brightness control through PWM.
  • Automatic line changing if text size is larger than 16 characters.
  • 9600 slandered baud rate which is compatible with all mcu’s.


    All source files are hosted on following page:

                                          Fig. : Schematic is designed in fritizing. It is open-source designing tool.

ATmega-8/168/328 Arduino pin mapping:
Carefully check the schematic. Compare arduino pinouts with ATmega8/168/328 pinouts. The table given following describes pin mapping. (NOTE: ATmega pin numbers are pin number of IC, NOT arduino)
Pin mapping:

ATmega-8/168/328 pins                   LCD pins
15 (PWM)                                             15
16                                                         D7
17                                                         D6
18                                                         D5
19                                                         D4
24                                                          E
25                                                        R/W
26                                                         RS

Firmware File: (Firmware-8/168/328.ino sketch file)

Prototype Images:
ATmega8 is placed under LCD to save space, wires & easy soldering..

Solder side of general purpose PCB (only required pins of ATmega are soldered. Other remaining pins are not soldered.)

Arduino Library:
serialLCD using ATmega8 (arduino compatible)
Type: Source File / library
Author: Pranjal Joshi
Date: 7-12-2013
License: GNU GPL v2 (Relased in public domain as open-source).


  • The serialLCD library uses SoftwareSerial library internally
  • So please DON'T INCLUDE SoftwareSerial.h in your sketch.
  • But you CAN use all the functions & features of SoftwareSerial to create other virtual serial ports in sketch.
  • So use it as you wish without including header file.

Extract the downloaded file & copy the serialLCD folder to arduino/library & restart arduino IDE to use this library.

There are 3 examples which are included in library. Once, you installed library as per above instructions you can find examples in arduino IDE File->Examples->serialLCD->

All source files are hosted on following page:

Video Demonstration:


New python library is available for Raspberry Pi. Download from

#Featured in EFY may 2014

Thank you,
Pranjal Joshi.


  1. Nice blog relevant to lcd and home decoration and i want to suggest that aaica provide more beneficial lcd unit to produce to more relevant things like home decore.

  2. Good work mate.. I might use your library for RPI