Hackster is hosting Hackster Holidays, Ep. 7: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 7 on Friday!
Arnov Sharma
Published © LGPL

DIY Thermometer with TTGO T Display and DS18B20

Made a custom 3D Printed Thrmeometer from Scratch using TTGO T Display and DS18B20 Sensor.

BeginnerFull instructions provided1 hour1,661

Things used in this project

Hardware components

PCBWay Custom PCB
PCBWay Custom PCB
×1
DS18B20 Programmable Resolution 1-Wire Digital Thermometer
Maxim Integrated DS18B20 Programmable Resolution 1-Wire Digital Thermometer
×1
LILYGO TTGO T DISPLAY
×1

Software apps and online services

Arduino IDE
Arduino IDE
Fusion
Autodesk Fusion

Hand tools and fabrication machines

3D Printer (generic)
3D Printer (generic)

Story

Read more

Custom parts and enclosures

Fusion360File

body

Schematics

sch

Code

code

C/C++
#include <OneWire.h> 
#include <DallasTemperature.h>
#include <TFT_eSPI.h> // Graphics and font library for ST7735 driver chip
#include <SPI.h>
#include <WiFi.h>

#define TFT_BLACK 0x0000 // black
#define ONE_WIRE_BUS 2 

OneWire oneWire(ONE_WIRE_BUS); 
DallasTemperature sensors(&oneWire);

TFT_eSPI tft = TFT_eSPI();  // Invoke library, pins defined in User_Setup.h



void setup(void) 
{ 
  tft.init();
  tft.setRotation(1);
  Serial.begin(9600); 
  sensors.begin(); 
 
} 
void loop(void) 
{ 
  Serial.print(" Requesting temperatures..."); 
  sensors.requestTemperatures(); // Send the command to get temperature readings 
  Serial.println("DONE"); 
  
  tft.fillScreen(TFT_BLACK);
  tft.setCursor(0, 0, 2);
  tft.setTextColor(TFT_WHITE,TFT_BLACK);  
  tft.setTextSize(2);
  tft.println("Temperature is: "); 
  
  tft.setCursor(0, 40, 2);
  tft.setTextColor(TFT_WHITE,TFT_BLACK);  
  tft.setTextSize(3);
  tft.println(sensors.getTempCByIndex(0)); 
 
  delay(2000); 
}

Credits

Arnov Sharma
310 projects • 311 followers
Just your average MAKER

Comments