Skip to content

Instantly share code, notes, and snippets.

@GreenMoonArt
Created November 10, 2016 17:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GreenMoonArt/adf7ce47480f11885613c6cbfa7be3a1 to your computer and use it in GitHub Desktop.
Save GreenMoonArt/adf7ce47480f11885613c6cbfa7be3a1 to your computer and use it in GitHub Desktop.
Display a real time temperature graph using the Nokia LCD5110 monochrome display
// to convert thermistor readings to degrees F, see:
// http://playground.arduino.cc/ComponentLib/Thermistor2
// #include <math.h> // for thermistor temp conversion math
// get display library at http://rinkydinkelectronics.com/library.php?id=47
#include <LCD5110_Graph.h>
LCD5110 myScreen(8,9,10,11,12); // create an instance of the display object
extern uint8_t SmallFont[];
int xPos = 0;
int yPos = 24; // approx center of vertical
int thermistorPin = A0; //set up thermistor voltage divider circuit
int ambientTemp = 780; //thermistor reading - adjust to your reading
int highTemp = 815; //warm up thermistor - record highest reading
void setup()
{
myScreen.InitLCD();
myScreen.setFont(SmallFont);
}
void loop()
{
int rawTemp = analogRead(thermistorPin);
myScreen.printNumI(rawTemp, 5, 30);
//convert observed high and ambient temps to y axis values
//note that the y axis starts at zero in upper left and increases going down the display
yPos = map(rawTemp, ambientTemp, highTemp, 45, 2);
if(xPos < 84)
{
myScreen.setPixel(xPos, yPos); //draw a dot representing the temperature value
xPos++; //increment our x position
}
else
{
myScreen.clrScr(); //clear the screen
xPos = 0; //start over on left hand side of screen
}
myScreen.update();
delay(250); //adjust delay to increment x speed to your liking
// if you want to update once each minute, use 60000
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment