Giorgos ChrisidisTina Chrisidou
Published © CC BY-NC-SA

Room Temperature Widget

A very simple and easy to make thermometer for your room. Not that much to it but it looks cool.

BeginnerFull instructions provided3 hours3,782
Room Temperature Widget

Things used in this project

Story

Read more

Code

Code

Arduino
Simple code, easy to modify.
//Include libraries
#include <OneWire.h>
#include <DallasTemperature.h>
#include <U8g2lib.h>
U8G2_SSD1306_128X32_UNIVISION_F_HW_I2C u8g2(U8G2_R0); 
static char outstr[15];

// Data wire pin 5
#define ONE_WIRE_BUS 5
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);

void setup(void)
{
  //Serial.begin(9600); //Begin serial communication
  //Serial.println("Arduino Digital Temperature // Serial Monitor Version");
  sensors.begin();
  u8g2.begin();
}

void loop(void)
{ 
  sensors.requestTemperatures();  
  Serial.print("Temperature is: ");
  Serial.println(sensors.getTempCByIndex(0)); 
  dtostrf(sensors.getTempCByIndex(0),7, 1, outstr);
  u8g2.clearBuffer();
  u8g2.setFont(u8g2_font_profont22_tf);  //Fonts here https://github.com/olikraus/u8g2/wiki/fntlistall
  u8g2.drawStr(40,13, "Temp");
  u8g2.drawStr(4,30,outstr);
  u8g2.sendBuffer();
  delay(10000);      
}

Credits

Giorgos Chrisidis

Giorgos Chrisidis

3 projects • 2 followers
Just a noob maker!
Tina Chrisidou

Tina Chrisidou

1 project • 2 followers

Comments