Wednesday, March 3, 2021

Making An SPI 16x4 Character LCD With SN74HC595N For Arduino PIC And AVR

Overview

A character LCD based on HD44780 is popular due to ease of programming. However, its interface is 8-bit parallel mode. Software technique could reduces the 8-bit interface to 4-bit mode, but it still require additional control pins.

 

Making A SPI 16x4 Character LCD With SN74HC595N For Arduino PIC And AVR
A finished Assembling. SN74HC595N is soldered on-board. A 16x4 LCD stays at the top.

Making A SPI 16x4 Character LCD With SN74HC595N For Arduino PIC And AVR
Soldering side

With SN74HC595N, the interface from the MCU to this LCD could reduce in pins requirement. SN74HC595 acts as an interface converter from SPI to parallel output. Using this device, the MCU uses only three pins:

  1. Serial Clock
  2. Serial Data
  3. Enable Pin

And it needs two extra supply pins.

Because of its low cost, I decided to make my own LCD adapter board for this chip. I possess a lot of shift register and character LCD module. I design my own schematic and PCB. The PCB is printed in my personal workshop.

Proteus 8 is very easy to design schematic and PCB due to its simplicity and light weight in components database and design rules.

 

Making A SPI 16x4 Character LCD With SN74HC595N For Arduino PIC And AVR
Schematic Diagram

Making A SPI 16x4 Character LCD With SN74HC595N For Arduino PIC And AVR
A photo of finished PCB design
      

Making A SPI 16x4 Character LCD With SN74HC595N For Arduino PIC And AVR
Copper side
Making A SPI 16x4 Character LCD With SN74HC595N For Arduino PIC And AVR
Components side
Making A SPI 16x4 Character LCD With SN74HC595N For Arduino PIC And AVR
A software rendered 3D view

Full design work could download here.

Arduino Interfacing And Programming

Library for this kind of LCD is widely available online. There are many authors make this libraries. I use a library develops by an author shared on Github.

For connection between Arduino Uno to this LCD module, wire as follow.

Making A SPI 16x4 Character LCD With SN74HC595N For Arduino PIC And AVR
Arduino To SPI LCD connection diagram

I took the example program come with this LCD library.

Making A SPI 16x4 Character LCD With SN74HC595N For Arduino PIC And AVR
The HelloWorld.ino Example Program

Making A SPI 16x4 Character LCD With SN74HC595N For Arduino PIC And AVR
The HelloWorld.ino tested on physical hardware

There are some basic function in this library.

  • LiquidCrystal lcd(x) - Where x is any pin (slave select). This object must declare first prior to LCD function usage.
  • lcd.begin(cols,rows) - Set number of rows and column for character LCD, typically it is 16 columns and 2 rows.
  • lcd.setCursor(x,y)  - Set the cursor before writing to LCD. Both x and y start from 0.
  • lcd.print() - Print any string or number value to LCD
  • lcd.clear() - Clear LCD screen

There are many functions left as referred in library function on Github. 

Now I try to test my own program for this LCD using existing library.

Making A SPI 16x4 Character LCD With SN74HC595N For Arduino PIC And AVR
Another Test Program

Arduino file could download here.

Making A SPI 16x4 Character LCD With SN74HC595N For Arduino PIC And AVR
Physical hardware test

We can also control this SPI LCD module using the ATMega32. Another simple method is using the SN74HC164 serial to parallel shift register IC. It need three pins of microcontroller.

No comments:

Post a Comment

Search This Blog

Labels

25AA010A (1) 8051 (7) 93AA46B (1) ADC (30) Analog Comparator (1) Arduino (15) ARM (6) AT89C52 (7) ATMega32 (56) AVR (57) CCS PICC (28) DAC (1) DHT11 (2) Display (105) Distance Sensor (3) DS18B20 (3) dsPIC (2) dsPIC30F1010 (2) EEPROM (5) Environment Sensor (4) esp8266 (1) I2C (29) Input/Output (67) Interrupt (19) Keil (5) Keypad (10) LCD (47) Master/Slave (1) MAX7221 (1) MCP23017 (5) MCP23S17 (4) Meter (3) MikroC (2) Motor (15) MPLABX (71) Nokia 5110 LCD (3) OLED (2) One-Wire (6) Oscillator (8) PCB (6) PCD8544 (3) PCF8574 (5) PIC (107) PIC12F (2) PIC16F628A (2) PIC16F630 (1) PIC16F716 (3) PIC16F818 (10) PIC16F818/819 (2) PIC16F84A (15) PIC16F876A (1) PIC16F877A (9) PIC16F88 (1) PIC16F887 (60) PIC18 (19) PIC18F1220 (4) PIC18F2550 (3) PIC18F4550 (12) PWM (11) RTC (8) Sensor (10) SH1106 (1) Shift Register (11) Shift Registers (3) SPI (24) STM32 (6) STM32 Blue Pill (6) STM32CubeIDE (6) STM32F103C8T6 (6) SysTick (3) temperature sensor (11) Thermometer (21) Timer/Counter (31) TM1637 (2) UART (7) Ultrasonic (4) Voltmeter (7) WDT (1) XC16 (2) XC8 (94)