├── .github └── FUNDING.yml ├── README.md ├── ST7789_Temperature.ino ├── ST7789_Temperature_F.ino ├── demo.jpg └── schematic.jpg /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: educ8s 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Arduino-ST7789-Temperature 2 | 3 | This is a simple Thermometer using the DS18B20 temperature sensor and an ST7789 display on Arduino. 4 | 5 |

6 | ST7789 Thermometer 7 |

8 | 9 |

10 | 🎥 Video Tutorial on YouTube 11 |

12 | 13 |
14 |
15 |

16 | | 📺 YouTube 17 | | 🌍 Website |
18 |

19 | 20 | 21 | # Parts Needed 22 | 🛒 Arduino Uno ▶ http://educ8s.tv/part/ArduinoUno 23 | 24 | 🛒 ST7789 Display ▶ http://educ8s.tv/part/st7789 25 | 26 | 🛒 DS18B20 Temperature Sensor ▶ http://educ8s.tv/part/DS18B20 27 | 28 | 🛒 Breadboard ▶ http://educ8s.tv/part/SmallBreadboard 29 | 30 | 🛒 Wires ▶ http://educ8s.tv/part/Wires 31 | 32 | 💖 Full disclosure: All of the links above are affiliate links. I get a small percentage of each sale they generate. Thank you for your support! 33 | 34 | # Schematic Diagram 35 | 36 |

37 | Scematic Diagram 38 |

39 | 40 | 41 | # Credits & Thanks 42 | 43 | - Kudos to [cbm80amiga](https://github.com/cbm80amiga) for being the creator of the original ST7789 fast library without which this project would not exist. 44 | 45 | -------------------------------------------------------------------------------- /ST7789_Temperature.ino: -------------------------------------------------------------------------------- 1 | // In this sketch the temperature is displayed in degrees Celcius 2 | // 3 | // 4 | 5 | 6 | #define TFT_DC 7 7 | #define TFT_RST 8 8 | #define SCR_WD 240 9 | #define SCR_HT 240 10 | 11 | #include 12 | #include //https://github.com/adafruit/Adafruit-GFX-Library 13 | #include 14 | #include //https://github.com/cbm80amiga/Arduino_ST7789_Fast 15 | #include //https://github.com/milesburton/Arduino-Temperature-Control-Library 16 | #define ONE_WIRE_BUS 2 17 | #define TEMP_X 20 18 | #define TEMP_Y 85 19 | 20 | OneWire oneWire(ONE_WIRE_BUS); 21 | DallasTemperature sensors(&oneWire); 22 | 23 | float previousTemp = -100.0; 24 | float tempC = 0; 25 | float minTemp = 200; 26 | float maxTemp = 0; 27 | 28 | Arduino_ST7789 tft = Arduino_ST7789(TFT_DC, TFT_RST); 29 | 30 | void setup() { 31 | Serial.begin(9600); 32 | Serial.println("Starting up ..."); 33 | sensors.begin(); 34 | 35 | tft.init(SCR_WD, SCR_HT); 36 | tft.fillScreen(BLACK); 37 | tft.setCursor(0, 0); 38 | tft.setTextColor(RED); 39 | tft.setTextSize(3); 40 | tft.println(" Temperature"); 41 | tft.setCursor(160, TEMP_Y); 42 | tft.setTextSize(5); 43 | tft.setTextColor(WHITE); 44 | tft.println((char)247 ); 45 | tft.setCursor(200, TEMP_Y); 46 | tft.println("C"); 47 | 48 | tft.setCursor(40, 180); 49 | tft.setTextSize(2); 50 | tft.setTextColor(CYAN); 51 | tft.println("MIN"); 52 | printMinTempDegreesSymbol(); 53 | printMaxTempDegreesSymbol(); 54 | 55 | 56 | tft.setCursor(170, 180); 57 | tft.setTextSize(2); 58 | tft.setTextColor(RED); 59 | tft.println("MAX"); 60 | 61 | } 62 | 63 | void loop() { 64 | delay(1000); 65 | sensors.requestTemperatures(); 66 | Serial.print("Temperature for the device 1 (index 0) is: "); 67 | previousTemp = tempC; 68 | tempC = sensors.getTempCByIndex(0); 69 | if(tempCmaxTemp) 75 | { 76 | deleteMaxTemp(); 77 | maxTemp = tempC; 78 | } 79 | if(previousTemp!=tempC) 80 | { 81 | deletePreviousTemp(); 82 | printTemp(); 83 | printMinTemp(); 84 | printMaxTemp(); 85 | } 86 | } 87 | 88 | void deletePreviousTemp() 89 | { 90 | tft.setCursor(TEMP_X, TEMP_Y); 91 | tft.setTextSize(5); 92 | tft.setTextColor(BLACK); 93 | tft.println(previousTemp,1); 94 | } 95 | 96 | void printTemp() 97 | { 98 | tft.setCursor(TEMP_X, TEMP_Y); 99 | tft.setTextSize(5); 100 | tft.setTextColor(WHITE); 101 | tft.println(tempC,1); 102 | } 103 | 104 | void printMinTemp() 105 | { 106 | tft.setCursor(10, 210); 107 | tft.setTextSize(2); 108 | tft.setTextColor(CYAN); 109 | tft.println(minTemp,1); 110 | } 111 | 112 | void printMaxTemp() 113 | { 114 | tft.setCursor(150, 210); 115 | tft.setTextSize(2); 116 | tft.setTextColor(RED); 117 | tft.println(maxTemp,1); 118 | } 119 | 120 | void deleteMaxTemp() 121 | { 122 | tft.setCursor(150, 210); 123 | tft.setTextSize(2); 124 | tft.setTextColor(BLACK); 125 | tft.println(maxTemp,1); 126 | } 127 | 128 | void deleteMinTemp() 129 | { 130 | tft.setCursor(10, 210); 131 | tft.setTextSize(2); 132 | tft.setTextColor(BLACK); 133 | tft.println(minTemp,1); 134 | } 135 | 136 | void printMinTempDegreesSymbol() 137 | { 138 | tft.setCursor(70, 210); 139 | tft.setTextSize(2); 140 | tft.setTextColor(CYAN); 141 | tft.println((char)247 ); 142 | tft.setCursor(85, 210); 143 | tft.println("C"); 144 | } 145 | 146 | void printMaxTempDegreesSymbol() 147 | { 148 | tft.setCursor(210, 210); 149 | tft.setTextSize(2); 150 | tft.setTextColor(RED); 151 | tft.println((char)247 ); 152 | tft.setCursor(225, 210); 153 | tft.println("C"); 154 | } 155 | -------------------------------------------------------------------------------- /ST7789_Temperature_F.ino: -------------------------------------------------------------------------------- 1 | // In this sketch the temperature is displayed in degrees Fahrenheit 2 | // 3 | // 4 | 5 | 6 | #define TFT_DC 7 7 | #define TFT_RST 8 8 | #define SCR_WD 240 9 | #define SCR_HT 240 10 | 11 | #include 12 | #include //https://github.com/adafruit/Adafruit-GFX-Library 13 | #include 14 | #include //https://github.com/cbm80amiga/Arduino_ST7789_Fast 15 | #include //https://github.com/milesburton/Arduino-Temperature-Control-Library 16 | 17 | Arduino_ST7789 tft = Arduino_ST7789(TFT_DC, TFT_RST); 18 | 19 | #define ONE_WIRE_BUS 2 20 | #define TEMP_X 20 21 | #define TEMP_Y 85 22 | 23 | OneWire oneWire(ONE_WIRE_BUS); 24 | DallasTemperature sensors(&oneWire); 25 | 26 | float previousTemp = -100.0; 27 | float tempF = 0; 28 | float minTemp = 200; 29 | float maxTemp = 0; 30 | void setup() { 31 | Serial.begin(9600); 32 | Serial.println("Starting up ..."); 33 | sensors.begin(); 34 | 35 | tft.init(SCR_WD, SCR_HT); 36 | tft.fillScreen(BLACK); 37 | tft.setCursor(0, 0); 38 | tft.setTextColor(RED); 39 | tft.setTextSize(3); 40 | tft.println(" Temperature"); 41 | tft.setCursor(160, TEMP_Y); 42 | tft.setTextSize(5); 43 | tft.setTextColor(WHITE); 44 | tft.println((char)247 ); 45 | tft.setCursor(200, TEMP_Y); 46 | tft.println("F"); 47 | 48 | tft.setCursor(40, 180); 49 | tft.setTextSize(2); 50 | tft.setTextColor(CYAN); 51 | tft.println("MIN"); 52 | printMinTempDegreesSymbol(); 53 | printMaxTempDegreesSymbol(); 54 | 55 | tft.setCursor(170, 180); 56 | tft.setTextSize(2); 57 | tft.setTextColor(RED); 58 | tft.println("MAX"); 59 | } 60 | 61 | void loop() { 62 | delay(1000); 63 | sensors.requestTemperatures(); 64 | Serial.print("Temperature for the device 1 (index 0) is: "); 65 | previousTemp = tempF; 66 | tempF = sensors.getTempFByIndex(0); 67 | if(tempFmaxTemp) 73 | { 74 | deleteMaxTemp(); 75 | maxTemp = tempF; 76 | } 77 | if(previousTemp!=tempF) 78 | { 79 | deletePreviousTemp(); 80 | printTemp(); 81 | printMinTemp(); 82 | printMaxTemp(); 83 | } 84 | } 85 | 86 | void deletePreviousTemp() 87 | { 88 | tft.setCursor(TEMP_X, TEMP_Y); 89 | tft.setTextSize(5); 90 | tft.setTextColor(BLACK); 91 | tft.println(previousTemp,1); 92 | } 93 | 94 | void printTemp() 95 | { 96 | tft.setCursor(TEMP_X, TEMP_Y); 97 | tft.setTextSize(5); 98 | tft.setTextColor(WHITE); 99 | tft.println(tempF,1); 100 | } 101 | 102 | void printMinTemp() 103 | { 104 | tft.setCursor(10, 210); 105 | tft.setTextSize(2); 106 | tft.setTextColor(CYAN); 107 | tft.println(minTemp,1); 108 | } 109 | 110 | void printMaxTemp() 111 | { 112 | tft.setCursor(150, 210); 113 | tft.setTextSize(2); 114 | tft.setTextColor(RED); 115 | tft.println(maxTemp,1); 116 | } 117 | 118 | void deleteMaxTemp() 119 | { 120 | tft.setCursor(150, 210); 121 | tft.setTextSize(2); 122 | tft.setTextColor(BLACK); 123 | tft.println(maxTemp,1); 124 | } 125 | 126 | void deleteMinTemp() 127 | { 128 | tft.setCursor(10, 210); 129 | tft.setTextSize(2); 130 | tft.setTextColor(BLACK); 131 | tft.println(minTemp,1); 132 | } 133 | 134 | void printMinTempDegreesSymbol() 135 | { 136 | tft.setCursor(70, 210); 137 | tft.setTextSize(2); 138 | tft.setTextColor(CYAN); 139 | tft.println((char)247 ); 140 | tft.setCursor(85, 210); 141 | tft.println("F"); 142 | } 143 | 144 | void printMaxTempDegreesSymbol() 145 | { 146 | tft.setCursor(210, 210); 147 | tft.setTextSize(2); 148 | tft.setTextColor(RED); 149 | tft.println((char)247 ); 150 | tft.setCursor(225, 210); 151 | tft.println("F"); 152 | } 153 | -------------------------------------------------------------------------------- /demo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/educ8s/Arduino-ST7789-Temperature-Monitor-DS18B20/5d9e1881d2ae059ba1a94650f8a7f1b34b7a9b93/demo.jpg -------------------------------------------------------------------------------- /schematic.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/educ8s/Arduino-ST7789-Temperature-Monitor-DS18B20/5d9e1881d2ae059ba1a94650f8a7f1b34b7a9b93/schematic.jpg --------------------------------------------------------------------------------