Hey everyone,
here's a quick project "Temperature Monitor with Thermistor and OLED Display"
INTROA thermistor is a resistance thermometer or a resistor whose resistance is dependent on temperature. The term is a combination of “thermal” and “resistor”. It is made of metallic oxides, pressed into a bead, disk, or cylindrical shape and then encapsulated with an impermeable material such as epoxy or glass.
There are two types of thermistors: Negative Temperature Coefficient (NTC) and Positive Temperature Coefficient (PTC). With an NTC thermistor, when the temperature increases, resistance decreases. Conversely, when the temperature decreases, resistance increases.
I'll be using NTC in this Post which would be this-
So the goal of this project is to make a temperature measurement device (like a digital thermometer)
MATERIAL REQUIRED- NTC 10K
- Nodemcu (you can use any MCU here)
- Pro Micro (for an alternate setup)
- Breadboard
- OLED SSD1306
- any hot apparatus
- any cold apparatus
Wiring is pretty straight forward and simple, first we connect NTC with Nodemcu A0 pin with a Classic Voltage divider circuit with 10K resistor connected with GND and NTC connected to VCC, the middle terminal will go to A0.
The OLED display wiring is this-
- GND to GND
- VCC to 3V3
- SCL to D1
- SDA to D0
after wiring both setup, its time to flash this with code, and for that, we need to first download and install the Adafruit SSD1306 Library, you can download that from here- https://github.com/adafruit/Adafruit_SSD1306
just extract the files in the library folder inside the Arduino folder in Documents.
(follow the library installation process mentioned in its DOC)
CODEThe code for this project is attached below. It works on the Steinhart-Hart equation.
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);
int ThermistorPin = 0;
int Vo;
float R1 = 10000;
float logR2, R2, T, Tc;
float c1 = 1.009249522e-03, c2 = 2.378405444e-04, c3 = 2.019202697e-07;
void setup(){
display.begin(SSD1306_SWITCHCAPVCC,0x3C); //OLED address
display.clearDisplay();
Serial.begin(9600);
}
void loop(){
Vo = analogRead(ThermistorPin);
R2 = R1 * (1023.0 / (float)Vo - 1.0);
logR2 = log(R2);
T = (1.0 / (c1 + c2*logR2 + c3*logR2*logR2*logR2));
Tc = T - 273.15;
display.clearDisplay();
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(70, 0);
display.println("C");
display.display();
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(3, 0);
display.println(Tc);
display.display();
delay(10);
}
Upload the code to your Nodemcu setup and after uploading the code, bring out the hot and cold stuff for testing!
RESULTFor Testing this setup, we first tape the NTC with anything which would get HOT, and for this, I used one of my previous projects - SMT HOTPLATE
Also, normal Tape would burn so I used TEFLON TAPE
As for Cold Temperature TEST, I used Teflon tape to properly attached the NTC with Glass outer surface so we can get temperature degrees for measuring liquid temperature. I'm using this method to test the cold temperature but it can be also used to measure hot liquids.
We can use any MCU in this project, so now let's wire this same setup but with a Pro Micro instead of a Nodemcu.
Wire the pro micro’s SDA SCA with OLED and connect the NTC with A0 pin with the same voltage divider setup and do the same water test, but this time let’s do a hot test.
I poured hot coffee for temperature measurement and here’s the result.
Our setup is displaying proper temperature readings, well not exactly, readings are near perfect as we aren’t directly dipping the NTC into the liquid but using glass as a medium for heat transfer...
For getting perfect readings, we can put the NTC into a metallic/aluminum cylinder and seal this up with epoxy to make a proper NTC sensor!
or buy an expensive NTC.
Comments