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 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, 5V, GND, DAT, CLK, 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
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:
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: