Danny van den Brande
Published © CC BY-SA

Arduino - Nokia 5110 LCD Temperature Meter With The DS18B20

Hello World! I made a Temperature meter with a Nokia 5110 LCD. I added the libraries and I made an image for the LCD background.

BeginnerFull instructions provided1 hour6,348
Arduino - Nokia 5110 LCD Temperature Meter With The DS18B20

Story

Read more

Schematics

Schematic

Code

DS18B20_Temperature_sensor_with_NOKIA5110_Lcd.ino

Arduino
Hello world! this is a example project for the DS18b20 on a old Nokia 5110 LCD Display.
/*
Author: Danny van den Brande, ArduinoSensors.nl. BlueCore Tech.
Hello world! this is a example project for the DS18b20 on a old Nokia 5110 LCD Display.
 */

#include <OneWire.h>
#include <DallasTemperature.h>
#include <LCD5110_Graph.h>
#define ONE_WIRE_BUS 2

LCD5110 lcd(8,9,10,12,11);

extern unsigned char SmallFont[];
extern unsigned char BigNumbers[];
extern uint8_t borderRoundedIcon[];

char TempCelciusFahrenheit[6];

OneWire oneWire(ONE_WIRE_BUS);

DallasTemperature sensors(&oneWire);

float tempC = 0;
float tempF = 0;

void setup(void)
{
  lcd.InitLCD();
  sensors.begin();
}

void loop(void)
{ 
  lcd.clrScr();
  lcd.drawBitmap(0, 0, borderRoundedIcon, 84, 48);
  sensors.requestTemperatures();
  tempC = sensors.getTempCByIndex(0);
  tempF = sensors.toFahrenheit(tempC); 
//  convertToString(tempF); //these are Fahrenheit, uncomment when using degrees.
  convertToString(tempC);  //These are degrees, comment when using Fahrenheit.
  lcd.setFont(BigNumbers);
  lcd.print(TempCelciusFahrenheit,22,14); // You can set position of the text here.
  lcd.setFont(SmallFont);
  lcd.print("Temp.Celc.",17,5); //Comment when using Fahrenheit
//  lcd.print("Temp.Fahr.",17,5); //Uncomment when using Celcius
  lcd.update();  
  delay(1000);
}
void convertToString(float number)
{
   dtostrf(number, 3, 1, TempCelciusFahrenheit);
}

Credits

Danny van den Brande

Danny van den Brande

36 projects • 108 followers
"Hello world."

Comments