Arduino SPI Use

Another option for connecting is to use SPI, which is a simpler protocol. The good news about SPI is that its very simple and you can use any 3 pins to connect. You can share the data and clock pins with another device as long as they remain outputs, the latch pin should only be used for the backpack. So if you wanted 3 LCDs, for example, they would all have the same data and clock pins, but the latch pin would be different, for 5 pins total

This library does not use the Hardware SPI library, which means you can use any 3 pins! However, if you are using the hardware SPI port (such as for Ethernet, WiFi, an LCD, etc. etc) you cannot share those pins with this LCD!
The first thing you will need to do is to enable SPI. To do this, solder the SPI Enable solder jumper by heating up the pads with a soldering iron and soldering a blob onto both pins:

This will switch the backpack over to SPI mode instead of i2c. If you want to go back to i2c, use wick or a solder sucker to remove the jumper

Next we will connect 5 wires, 5VGNDDATCLK, and LAT.

  • To match the example, CLK goes to to Digital 2
  • DAT to Digital 3,
  • LAT to Digital 4

Once we have the example sketch running you can of course change these to anything you'd like

  • Connect 5V and GND to the 5v and Ground Arduino power pins. If you are using a 3.3V Arduino, you still need to power the LCD with 5V power! You can use 3.3V logic just fine

Install Adafruit_LiquidCrystal

To begin reading sensor data, you will need to download Adafruit_LiquidCrystal from our github repository. You can do that by visiting the github repo and manually downloading or, easier, just click this button to download the zip

Rename the uncompressed folder Adafruit_LiquidCrystal and check that the Adafruit_LiquidCrystal folder contains Adafruit_LiquidCrystal.cpp and Adafruit_LiquidCrystal.h

Place the Adafruit_LiquidCrystal library folder your arduinosketchfolder/libraries/ folder.
You may need to create the libraries subfolder if its your first library. Restart the IDE.

We also have a great tutorial on Arduino library installation at:
http://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use

Load Demo

Restart the IDE and load up the Adafruit_LiquidCrystal->HelloWorld_SPI demo

Upload the sketch. You should see the backlight turn on when the Arduino resets. If you don't see any characters, adjust the Contrast trim potentiometer with a mini-screwdriver until you see the text clearly

The default HelloWorld sketch blinks the backlight as well as updating the text.

If you see the backlight blinking that means your connection to the SPI port is OK but the contrast is too low or too high, or the LCD data pins are not solidly connected.

Check the contrast first by gently twisting the mini trim potentiometer, if that doesn't help, recheck your soldering and resolder all 16 of the LCD pins!

Once you're done, you can remove the blinking LED backlight code:

lcd.setBacklight(HIGH);
delay(500);
lcd.setBacklight(LOW);
delay(500);
This guide was first published on Aug 27, 2012. It was last updated on Aug 27, 2012. This page (Arduino SPI Use) was last updated on Dec 20, 2017.