Warm-hands meter on an Arduino Uno
A TMP36 on A0 and three LEDs: hold the sensor and the LEDs light one by one as it warms two, four and six degrees over the room. The whole build, an Arduino Uno and 7 more parts, runs here in your browser on the firmware below; open it in the editor to change the wiring or the code and run it again.
Teaching? Assign it to your class in one click.
Beginner Runs in your browser. Free, and no account needed.
Build it as the Starter Projects Kit: the parts in numbered bags and a booklet that checks every step. Free.
The code
The firmware exactly as the editor opens it. Change a line there and press Run: it compiles in the browser.
// Warm-hands meter: a TMP36 temperature sensor and three LEDs that light one
// by one as the sensor warms up.
//
// TMP36 left leg (flat side toward you) -> 5V, middle -> A0, right -> GND
// pin 2, 3, 4 the three LEDs, each through 220 ohm to GND
//
// The TMP36 gives 0.5 V at 0 C and 10 mV more for every degree, so
// volts = reading * 5.0 / 1024
// celsius = (volts - 0.5) * 100
//
// The room is the baseline: 22 C here. Set BASELINE to what the serial
// monitor reads in your room before you touch the sensor. Then squeeze the
// sensor between your fingers and it climbs toward skin temperature: two
// degrees over the baseline lights the first LED, four the second, six the
// third.
const int SENSOR = A0;
const float BASELINE = 22.0; // the room: change it to what yours reads
const int LEDS[3] = {2, 3, 4};
void setup() {
for (int i = 0; i < 3; i++) pinMode(LEDS[i], OUTPUT);
Serial.begin(9600);
Serial.println("Mokxi Uno: warm-hands meter");
}
void loop() {
int reading = analogRead(SENSOR);
float volts = reading * 5.0 / 1024.0;
float celsius = (volts - 0.5) * 100.0;
Serial.print("reading ");
Serial.print(reading);
Serial.print(", volts ");
Serial.print(volts, 2);
Serial.print(", degrees C ");
Serial.println(celsius, 1);
int lit = 0;
if (celsius >= BASELINE + 2) lit = 1;
if (celsius >= BASELINE + 4) lit = 2;
if (celsius >= BASELINE + 6) lit = 3;
for (int i = 0; i < 3; i++) digitalWrite(LEDS[i], i < lit ? HIGH : LOW);
delay(250);
}
Parts list
9 parts, plus the jumper wires. Every one is in the editor's parts bin.
- 1 × Arduino Uno R3
- 1 × Full-size breadboard
- 1 × Temperature sensor
- 3 × Resistor, 220 Ω
- 3 × LED, red
How it is wired
9 connections, pin by pin, read from the circuit itself. Each line is one set of pins joined together, by a jumper wire or a breadboard strip.
- Ground: Arduino Uno R3 pin GND; Temperature sensor pin GND; LED, red (1) pin C; LED, red (2) pin C; LED, red (3) pin C
- Arduino Uno R3 pin 4; Resistor, 220 Ω (3) pin 1
- Arduino Uno R3 pin 3; Resistor, 220 Ω (2) pin 1
- Arduino Uno R3 pin 2; Resistor, 220 Ω (1) pin 1
- Arduino Uno R3 pin 5V; Temperature sensor pin VS
- Arduino Uno R3 pin A0; Temperature sensor pin VOUT
- Resistor, 220 Ω (1) pin 2; LED, red (1) pin A
- Resistor, 220 Ω (2) pin 2; LED, red (2) pin A
- Resistor, 220 Ω (3) pin 2; LED, red (3) pin A
Change it and keep it
Open it in the editor, change the circuit or the code, and keep your version in a free account.