Project tutorial
Room Temperature Widget

Room Temperature Widget © CC BY-NC-SA

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

  • 3,632 views
  • 2 comments
  • 10 respects

Components and supplies

About this project

A small and good looking digital thermometer using the Dallas DS18B20 digital sensor and an Arduino Pro Micro at 3.3v. Everything is designed to fit exactly and to snap in place, no screws or glue needed! Instructions can be found below, including some information on the parts I used and the Arduino code needed for it to work.

Arduino Nano version has also been posted as STL files there are a few connection changes that I will post below. Please note that you will have to make sure you use the 3.3v version of Arduino Nano or Micro. Send me a message or comment on the "thing" if you want to use another battery type.

Connections Arduino Pro Micro (clone):

  • Sensor data pin on Arduino PIN 5
  • Display SDA on Arduino PIN 2
  • Display SCL on Arduino PIN 3

Connections Arduino Nano (clone):

  • Sensor data pin on Arduino PIN 5
  • Display SDA on Arduino PIN A4
  • Display SCL on Arduino PIN A5

Arduino nano pin out

Arduino pro micro pin out

DS18B20 info

Libraries:

STL Files: https://www.thingiverse.com/thing:2824270

Code: https://noobmakers.com/2018/04/01/digital-temperature-widget/

//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"); //Print a message
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);
}

The above links are part of the amazon affiliate program, that means that if you click and buy one of the items from those links I will get a small commission with no additional cost to you. This is a great way to support this and the upcoming projects.

Credits:

Models used to help me design it so everything fits on the links below:

SVG Cloud was used from:

Icon made from Icon Fonts is licensed by CC BY 3.0SVG CLOUD

PS: I am a noob maker, so any advice or suggestions will be much appreciated.

Code

CodeArduino
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);      
}

Comments

Add projectSign up / Login