KY-028 NTC Thermistor Digital Temperature Sensor
Measure temperature curves with an NTC thermistor using the Steinhart-Hart Beta equation and LM393 setpoint alarm.
Explore precision analog thermal sensing with the KY-028 NTC thermistor module. Convert nonlinear thermistor ADC readings into accurate degrees Celsius using the Beta equation, while simultaneously monitoring the onboard LM393 hardware over-temperature comparator.
Key Learning Objectives & Robotics Concepts
By building and programming this project, you will master the following core engineering skills:
Power Architecture & Voltage Staging
5V / 3.3V Regulated PowerThe KY-028 operates cleanly from Arduino Uno 5V, consuming under 5mA across its 10kΩ NTC thermistor divider and LM393 comparator. NTC bead self-heating is negligible through the onboard 10kΩ divider; keep bead away from open flame.
Bill of Materials (BOM) & Hardware Components
| Component | Specifications & Alternative | Qty | Approx Cost |
|---|---|---|---|
| Arduino Uno R3 | ATmega328P @ 16MHz | 1 | $8.00 |
| KY-028 Digital Temperature Module | 10kΩ NTC thermistor (B≈3950) + LM393 comparator | 1 | $1.50 |
| 5mm Red LED + 220Ω Resistor | Over-temperature warning indicator | 1 | $0.15 |
| Breadboard & Jumper Wires | 6× breadboard leads | 1 | $2.00 |
Electrical & System Architecture
Connect KY-028 (+) to 5V, (G) to GND, (A0) to A0, and (D0) to D2. Wire a thermal warning LED (+220Ω resistor) to D8.
Autonomous Behavior & Finite State Machine (FSM)
Deterministic Arduino loop handling KY-028 NTC Thermistor + LM393 Module acquisition, filtering, and real-time output updates.
Step-by-Step Physical Assembly & Wiring Tutorial
Follow each of the 5 sequential milestone stages with technical photos, wiring checks, and pre-flight tests.
Inspect KY-028 NTC Glass Bead & Pinout
Locate the tiny glass-encapsulated NTC thermistor at the tip of the PCB and verify pin labels.
- Verify pin labels left-to-right: A0, G (GND), + (5V), D0.
- Note the blue multi-turn potentiometer used to dial the D0 hardware trigger temperature.
- Keep fingers off the bead during baseline calibration.
Wire KY-028 to A0/D2 & Thermal LED to D8
Connect power, analog/digital outputs, and the warning LED.
- Connect KY-028 + → 5V and G → GND.
- Connect KY-028 A0 → Arduino A0 and D0 → Arduino D2.
- Wire D8 → 220Ω resistor → Red LED anode → cathode to GND.
Verify Thermal Direction with Diagnostic
Run the quick ADC test and touch the bead with a warm fingertip to see which way A0 moves.
- Upload the diagnostic test below and open Serial Monitor.
- Observe baseline room ADC (typically ~480–550 near 25°C).
- Warm the bead gently with your finger and note whether ADC falls or climbs.
Upload Steinhart-Hart Thermometer Firmware
Flash the calibrated °C/°F converter and verify room temperature matches a desk thermometer.
- Upload the production sketch below.
- Compare printed °C against room ambient temperature.
- Hold the thermistor between your fingers until it crosses 30.0°C and watch D8 LED turn ON!
Dial Hardware Comparator Setpoint
Adjust the blue multi-turn screw so the module's D0 LED stays OFF at room temp and triggers on fingertip touch.
- Turn the screw until the module's onboard trigger LED just switches OFF at room temperature.
- Pinch the thermistor bead for 3 seconds—confirm onboard LED and D2 jump HIGH.
- Release and watch both return cleanly to normal.
Subsystem Benchtop Verification Scripts
Test each hardware subsystem independently before deploying the full autonomous firmware.
1Bench Diagnostic: KY-028 NTC Thermistor + LM393 Module Hardware Check
Subsystem DiagnosticMinimal standalone sketch to verify pin wiring and signal response for KY-028 NTC Thermistor + LM393 Module before running the full project firmware.
// Diagnostic: KY-028 Raw ADC & Digital Trigger Check
void setup() { pinMode(2, INPUT); Serial.begin(115200); }
void loop() {
Serial.print("A0: "); Serial.print(analogRead(A0));
Serial.print(" | D0(D2): "); Serial.println(digitalRead(2));
delay(250);
}Complete Production Firmware
Full working C++ source code with pin mappings, non-blocking timers, and FSM avoidance routines.
/**
* Project 22: KY-028 NTC Thermistor Precision Thermometer & Alarm
* Board: Arduino Uno R3 | Pins: A0 (KY-028 A0), D2 (D0), D8 (Thermal LED)
*/
#include <math.h>
const uint8_t THERM_AO = A0;
const uint8_t THERM_DO = 2;
const uint8_t ALERT_LED = 8;
const bool NTC_TO_GND = true; // Set false if ADC rises when heated
const float R_SERIES = 10000.0f;
const float R_NOMINAL = 10000.0f;
const float T_NOMINAL_K = 298.15f; // 25°C in Kelvin
const float BETA_COEFF = 3950.0f;
const float OVER_TEMP_C = 30.0f;
float readTempC() {
long sum = 0;
for (uint8_t i = 0; i < 16; i++) { sum += analogRead(THERM_AO); delay(2); }
float adc = constrain(sum / 16.0f, 1.0f, 1022.0f);
float rNtc = NTC_TO_GND
? R_SERIES * (adc / (1023.0f - adc))
: R_SERIES * ((1023.0f - adc) / adc);
float invT = (1.0f / T_NOMINAL_K) + (log(rNtc / R_NOMINAL) / BETA_COEFF);
return (1.0f / invT) - 273.15f;
}
void setup() {
pinMode(THERM_DO, INPUT);
pinMode(ALERT_LED, OUTPUT);
Serial.begin(115200);
Serial.println(F("KY-028 NTC Thermal Monitor Ready"));
}
void loop() {
float tempC = readTempC();
bool hwTrip = (digitalRead(THERM_DO) == HIGH);
bool alert = (tempC >= OVER_TEMP_C) || hwTrip;
digitalWrite(ALERT_LED, alert ? HIGH : LOW);
Serial.print(F("Temp: ")); Serial.print(tempC, 2);
Serial.print(F(" C (")); Serial.print(tempC * 1.8f + 32.0f, 1);
Serial.print(F(" F) | HW D0: ")); Serial.print(hwTrip ? F("TRIP") : F("OK"));
Serial.print(F(" | Alert: ")); Serial.println(alert ? F("OVER-TEMP") : F("NORMAL"));
delay(400);
}Firmware Architecture Explanation:
- Averages 16 ADC samples and computes exact NTC resistance from the ratiometric 10kΩ divider.
- Solves the Steinhart-Hart Beta equation in Kelvin and converts cleanly to Celsius and Fahrenheit.
- OR-combines software limit (30°C) with the onboard LM393 comparator for redundant thermal alerting.
Operational Verification & Pin State Matrix
Input Signal vs. System Output Truth Table:
| Input / State | Pin / Signal | Detected Condition | Expected Output |
|---|---|---|---|
| Temp < 30.0°C | D2 = LOW | Nominal Thermal Band | D8 LED OFF (NORMAL) |
| Temp ≥ 30.0°C | or D2 = HIGH | Over-Temp Threshold | D8 LED ON (OVER-TEMP) |
Engineering Troubleshooting Matrix
| Problem | Likely Cause | Diagnostic Check | Engineering Solution |
|---|---|---|---|
| Temperature drops when you warm the sensor with fingers | NTC divider leg orientation opposite of NTC_TO_GND | Pinch bead and observe °C trend | Flip NTC_TO_GND between true and false. |
| Prints -273°C or NaN | A0 reading pinned at 0 or 1023 due to loose jumper | Run raw A0 diagnostic | Re-seat 5V, GND, and A0 connections. |
| D2 hardware trigger stays stuck HIGH | Blue multi-turn trimpot dialed below ambient temperature | Observe module onboard LED | Rotate trimpot screw until trigger LED just turns OFF at room temp. |
Engineering Challenges & Upgrades
Take your build to the next level with these progressive engineering upgrades:
Turn on a 5V DC fan (Project 29) above 29°C and shut it off below 27°C.
Plot a rolling temperature sparkline on the Project 4 SSD1306 OLED.
Wire DHT11 (Project 3) side-by-side and compare response speed and agreement over Serial.