As it is gonna be useful for diagnostic information in my final PC case project, I decided to hook up a 1602A compatible LCD character display to the Arduino
The 1602A features 16 pins of which the first 6 are meant to control the display itself:
The following 8 pins are data pins, meant for transmitting character and custom character pixel bytes, while the last two pins are the anode and cathode for the LED-based backlight.
As spec-wise the 1602A is also operational in 4-bit mode (via nibble split, even though this results in slower display frequencies) I decided to save some pins on the Arduino and wire it up in 4-bit mode. The overall wiring can be seen below:
As the wiring is quite messy, let me try to explain it a little further, so that you’ll hopfully be able to understand it:
I used the breadboard to create a common parallel line of 5V VCC and GND, as the assembly consists of multiple devices (potentiometer and two pairs of power pins for the display and it’s backlight respectively).
As the display’s backlight is seemingly LED-based, it’s power supply pins are labeled as anode and cathode on the last two pins of the device. The backlight also uses a lower voltage, necessitating the use of a resistor for the anode, as otherwise the circuit overloads and risks component damage.
For controlling the contrast, I simply wired up a potentiometer to the breadboard’s main power line and wired the output into Vo (contrast/pin 3 on the 1602A).
As the 1602A LCD display is essentially it’s own microcontroller which needs to be communicated with, the best approach to programming it involves the LiquidCrystal
library, which I simply installed through the library manager.
After setting it up, below you can see the code I wrote to display some basic information and test out some custom characters on the display. Of course, it is once again available for download1:
// include the library code:
#include <LiquidCrystal.h>
8] = {
byte temp[0b00100,
0b01100,
0b01100,
0b01100,
0b01100,
0b10110,
0b11110,
0b01100
};8] = {
byte fan[0b00000,
0b00110,
0b01001,
0b00110,
0b01001,
0b00001,
0b11110,
0b00000
};
8] = {
byte fire[0b00001,
0b10100,
0b01100,
0b01110,
0b11011,
0b10001,
0b11001,
0b01111
};
// Creates an LCD object. Parameters: (rs, enable, d4, d5, d6, d7)
12, 11, 5, 4, 3, 2);
LiquidCrystal lcd(
void setup()
{// display dimensions (16x2)
16, 2);
lcd.begin(
// dejunkification
lcd.clear();
//load custom characters into the LCD's RAM
0, temp);
lcd.createChar(1, fan);
lcd.createChar(2, fire);
lcd.createChar(
}
void loop()
{//basics
0, 0);
lcd.setCursor("Temperature");
lcd.print(0, 1);
lcd.setCursor("Fan speed");
lcd.print(
//custom characters
14, 0);
lcd.setCursor(0));
lcd.write(byte(2));
lcd.write(byte(15, 1);
lcd.setCursor(1));
lcd.write(byte( }
As visible in the photograph below, the character display and custom character setup both work fine: