HOME Digital temperature widget


 

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 is needed!
Instructions can be found bellow, including some information on the parts i used and the arduino code needed for it to work.

PS: I will also redisign it with the arduino nano at a later date.

STL Files

Connections:

Sensor data pin on Arduino PIN 5

Display SDA on Arduino PIN 2

Display SCL on Arduino PIN 3

Arduino pro micro pin out

DS18B20 info

Libraries:

OneWire.h

U8g2lib.h

DallasTemperature.h

 

Code:

</pre>
//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);
}
<pre>

Parts Used:

Sensor DS18B20: Amazon.co.ukAmazon.comAmazon.de

Display 0.91″ Oled: Amazon.co.ukAmazon.comAmazon.de

Arduino Pro Micro: Amazon.co.ukAmazon.comAmazon.de

Battery CR123: Amazon.co.ukAmazon.comAmazon.de

Some of the above links may be affiliate links ,meaning ,at no additional cost to you ,if you click through and make a purchase a small commission is earned to help support the site and the authors.Read more here.

 

Posted on:

 

Comments are closed here.