An archive of as of Saturday January 26, 2019.

Esquilo Air & 1602A LCD Tutorial


Esquilo Air & 1602A LCD Tutorial

Made by Leeland Heins

About This Project

This is a very simple example setup to show how to hook a 1602A LCD
panel up to an Esquilo Air.

Project Info

Difficulty: Easy
Estimated Time: 1 hour


The 1602A type LCD panel is a very commonly sold output device on the IoT and
maker markets and comes in two basic versions with some options as to the
color of the screen and backlighting. This device sells for anywhere between
just under $2 up to $15 depending on which version and what vendor. The 1602A
has two lines of 16 columns that can display alphanumeric text, there are
similar 2004 LCDs which have 20 columns & 4 lines. The two major versions are
the device plain with 16 pins to hook up (can be run in a few configurations
with an Esquilo, 4 bit modes and 8 bit modes and whether or not to allow
read/write operation so it can use between 6 GPIO pins (4 bit write only) to
10 GPIO pins (8 bit read/write) or you can find the device with a small add-on
board soldered to the 16 pin connection which provides an SPI interface. The
minor variations are generally color, most of these devices are blue
background with white pixels but there are also reverse versions as well as
green & black versions and even some red and black or other colors although
those are harder to find. One other thing the 1602 type device provides is
backlighting. For this example we use a 10k pot to adjust the LCD contrast.

This tutorial is for the version of the 1602A WITHOUT the added SPI interface
and it uses the simplest 4 bit write only mode which uses 6 GPIO pins on the

Step 1: Parts List

1 Esquilo Air
1 1602 LCD
1 10k Potentiometer
1 Breadboard
15 Male-Male hookup wires. It is nice to make them color coordinated.

I used:
4 red
4 black
2 white
2 orange
1 yellow
1 green
1 blue

Step 2: Connect the components

Connect the components and wires as shown in the pictures

Step 3: Load the code into the IDE

LiquidCrystal Library - Hello World

Demonstrates the use a 16x2 LCD display. The LiquidCrystal
library works with all LCD displays that are compatible with the
Hitachi HD44780 driver. There are many of them out there, and you
can usually tell them by the 16-pin interface.

This sketch prints "Hello World!" to the LCD
and shows the time.

The circuit:
* LCD RS pin to digital pin 12
* LCD Enable pin to digital pin 11
* LCD D4 pin to digital pin 5
* LCD D5 pin to digital pin 4
* LCD D6 pin to digital pin 3
* LCD D7 pin to digital pin 2
* LCD R/W pin to ground
* LCD VSS pin to ground
* LCD VCC pin to 5V
* 10K resistor:
* ends to +5V and ground
* wiper to LCD VO pin (pin 3)

Library originally added 18 Apr 2008
by David A. Mellis
library modified 5 Jul 2009
by Limor Fried (
example added 9 Jul 2009
by Tom Igoe
modified 22 Nov 2010
by Tom Igoe
2016.11.29 -- Ported to Esquilo by Leeland Heins

This example code is in the public domain.




local lcd = LiquidCrystal(0x00, 12, 0, 11, 5, 4, 3, 2, 0, 0, 0, 0);

// set up the LCD's number of columns and rows:
lcd.begin(16, 2, 0);
// Print a message to the LCD.
lcd.print("hello, world!");
while (true) {
lcd.setCursor(0, 1);
local mils = millis() / 1000;


You will also need the LiquidCrystal library you can get here:

Step 4: Run the nut


This is also available on Hackster here:


I ran into some coding issues with the LiquidCrystal.nut that is in your Github repository. I may be doing something wrong but I could not get the file to load and run in the HelloWorld demo. It gave a runtime error message. I found that the "const" keyword does not work with Squirrel code. Did you do something different to get it to execute? Once I removed the "const" from all variable declarations, the LCD drive worked just fine for my 16x2 LCD.

I then tried a 20x4 LCD display and ran into another coding error. It would not display the 3rd and 4th lines correctly. In the begin() function, you have a local variable definition that should be changed to a global variable;
     line 189: local _numlines = lines;
This should have the "local" removed since it is declared a global variable on line 35.

I have not tried the SPI option. My LCD backpack interface board died. I will have to order another one.


Thanks for the input. I will have to check that code and see if it is up to date with the version I have working on my Esquilos. I have not actually tried the SPI code myself because I don't have an SPI backback. I do have an I2C backback but I haven't gotten it to work yet.

I really do appreciate hearing that people are using the code, and providing input and fixes is even better!