Introduction: Display Live Arduino Sensor Readings on a Nokia 5110 LCD
If you've ever worked with arduino, you've probably wanted it to display sensor readings.
Using the serial monitor is perfectly fine, but being the arduino badass you are quickly becoming, you probably want it to display the readings on something more sciency looking.
Also, having your arduino connected to a PC or laptop doesn't exactly make it super portable and having an LCD attached to display your data gets really handy if you want to carry your Arduino around.
Here are some EASY to follow instructions on how to wire and program your arduino so it will work with the display.
On a side note, I've also made an instructable about using an OLED display, which only uses 4 wires. If you'd like to check that one out, here's the link:
Step 1: What You'll Need
project you will need:
-Nokia 5110 LCD
-Arduino (tested on UNO)
You can buy the Nokia 5110 LCD on ebay for around 2 dollars. The same goes for the dupont wire. Search ebay for "40PCS dupont wire male to female", it costs about a dollar.
Step 2: Libraries??? No Problem!
Now, if you’ve worked with Arduino before, you probably have the IDE and an actual Arduino. However, if you are not yet familiar with libraries, there’s no need to worry, they are very simple to use.
Download them by following the links below, and clicking on download ZIP on the right side of the webpage.
After you have downloaded the zip files, extract them into the libraries file in your your main Arduino file (usually C:/Program files/Arduino/libraries)
Extract the files into the libraries folder and rename them to Adafruit_GFX and Adafruit_PCD8544
That’s basically all you need to do for this part. Now on to the code part.
Step 3: Arduino Code
I’ve written an empty template, you only need to add the code that reads from your sensor and it should work. My code writes to the serial monitor in the IDE as well as to the 5110 LCD.
The parts you need to change in order for it to display the readings (and text) that you want are marked in the code.
#include < math.h >//math and SPI should be already in your libraries folder by default, don’t worry about these
#include < SPI.h>
#include < Adafruit_GFX.h >
//we downloaded this just now
#include < Adafruit_PCD8544.h >
Adafruit_PCD8544 display = Adafruit_PCD8544(7, 6, 5, 4, 3); //digital pins used to connect to LCD
#define XPOS 0
#define YPOS 1
float sensorPin = A0; //your sensor pin, you can change this if you want
float sensorValue = analogRead(sensorPin); //you can change “sensorValue” in all of the code to anything you want
Serial.print("The value of sensor A is: "); //will display this text on the serial monitor
Serial.println(sensorValue); //don’t forget the ln so the next run writes into the next row
display.clearDisplay(); //clears display each time the loop starts over
display.print("The value of sensor A is: "); //this will be written on the LCD
If you did everything correctly, the code should work, but don't run it just yet, we have to connect the screen first.
Step 4: Connecting the LCD to Arduino
We're almost done! the only thing left is actually connecting the pins of the LCD to the Arduino.
Luckily the pins (from 1 to 5) are connected in a row, so your chance of wiering them wrong is very slim.
Connect pins 1-5 of the Nokia 5110 LCD to pins 3-7 on your Arduino. (So RST would go to Arduino pin 3, CE would go to pin 4 and so on)
After you’ve connected all the pins, you will notice that 3 are left over. Those pins are to be connected to the 3.3V, 5V and GND pin on your Arduino. Obviously the GND LCD pin goes to GND on the Arduino. Depending on what kind of Arduino you have and what kind of screen you have, play with connecting the last two LCD pins to the 5V or 3.3V pin on your Arduino. Both should work, but try it for yourself and see what the best combination is.
Also putting small value resistors (around 100-200Ohm should be fine) between the 3-7 Arduino pins and the LCD pins won’t hurt. This is just for safety and is not needed if you don't want to use the screen for long periods of time.
I recommend reading this part again, just to make extra sure you’ve connected everything properly. After everything's connected, you can upload the code and start having fun with your new Arduino data display LCD.
I hope the instructable was easy to understand and helped at least a few of you.
If you enjoyed this Instructable, consider visiting my Fundrazr page here. And of course, share.
1 Person Made This Project!
- vnguyen46 made it!