Arnov Sharma
Published © MIT

DIY Thermometer with TTGO T Display and DS18B20 V2

Version 2 of a previously made Thermometer project.

BeginnerFull instructions provided1 hour349
DIY Thermometer with TTGO T Display and DS18B20 V2

Things used in this project

Story

Read more

Custom parts and enclosures

Fusion360File

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

Arnov Sharma

269 projects • 280 followers
Just your average MAKER

Comments