Display Live Arduino Sensor Readings on a Nokia 5110 LCD

57K25121

Intro: 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:

https://www.instructables.com/id/Easy-OLED-Display/

STEP 1: What You'll Need

For this

project you will need:

-Nokia 5110 LCD

-Dupont wire

-Arduino IDE

-Arduino (tested on UNO)

-Adafruit_GFX library

-Adafruit_PCD8544 library

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.

https://github.com/adafruit/Adafruit-GFX-Library

https://github.com/adafruit/Adafruit-PCD8544-Nokia...

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

void setup()

{

Serial.begin(9600);

display.begin();

}

void loop()

{

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.setCursor(0,0);

display.print("The value of sensor A is: "); //this will be written on the LCD

display.println(sensorValue);

display.display();

delay(1000);

}

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.

16 Comments

hi, can you launched sensor fluxgate flc100 magnetometr with ardunio and conected to pc wiht bleuthos? thack you very much

please help me

the PLX DAQ ON MS EXCEL 2010

ON PC im not able to get the data

Good day sir
I Hope your fine
This Webside is very useful for Lerner as me
I am not related to this field but hope you understand my requirements

Sir please give a ieda for encobeter control setting by timer switch using Arduino with display
My requirements is like this
I need use R1 for encobetr temperature elements any he source for hetting
R1 function is like this for example I st temperature 35° the R1 should be cut off at 35° and below it shudder be on
R2 I will use for heater that boil the water I can get better humidity for example I set humidity at 60%65 The heater shudder be of
R3 I will use for circulation fan
R4 for egg turning motor 3 time in 24 houre on for few seconds
R5 for one more fan that is needed to on in high temperature conditions for east
Need to adjust with as you show abow cicuit s1 s2 s3 etc
I think this easy to adjust te timing
Sir need progarming and ieda for circuits using Arduino
Which is better you know that
Arduino nano?
Or any other please advise me
I hope you respond me better

Hi i'm getting few errors

1. class Adafruit_PCD8544' has no member named 'setCursor'

2. class Adafruit_PCD8544' has no member named 'print'

3. class Adafruit_PCD8544' has no member named 'println'

For anybody having compiling errors with Arduino IDE 1.6.13, the following code fixes the problems:

#include <SPI.h>

#include <gfxfont.h>

#include <Adafruit_GFX.h>

#include <Adafruit_PCD8544.h>

#include <math.h>

replace old code with this one!

Libraries can be downloaded via the Arduino IDE

Thanks for content, it really helps me. I will do it as soon as possible.

Hi Crtek
There is a type in the following line:
float sensorValue = analogRead(SensorPin);

SensorPin should be written with lowercase 'S' >> sensorPin

Brilliant. You can also scavenge a Nokia 5110 LCD or similar rather than buy one! There's a nice set of instructions here for the various models and the slightly different pin outs on each: http://mcuoneclipse.com/2012/12/16/zero-cost-84x48-graphical-lcd-for-the-freedom-board/

Other than for playing "snake", this is the best use of a 5110 screen I've ever seen!

what about the 2.4 lcd touch screen mcufriend makes can u show me how to use that