Skip to main content

Arduino Starter Kit - Video 3. Love-o-meter

In this tutorial, Massimo Banzi, the co-founder of Arduino, shows you how to build a LOVE-O-METER. The Love-o-Meter measures your body temperature and lights up a string of LEDs to show you how "hot" you are. This project introduces the use of a heat sensor and shows how to use analog input pins to read a wider range of values than shown in previous tutorials.

The circuit is composed by a sensor and 5 LEDs in a row, which are used to visualise the temperature level. If this is your first tutorial, it may be useful to have a look at the previous tutorial [VIDEO 2] to see how LEDs can be handled with Arduino. The TMP36 is a heat sensor that generates a voltage proportional to the temperature that it measures. In previous examples we were taught only how to read LOW and HIGH voltages, whereas here we will learn how to cope with a range of values that we have to decode, organise and transform into control signals for the LEDs.

The wiring of the circuit is straightforward, but new concepts are introduced on the code level: elseif statements, for loops, analog pin input and serial port communication.

The "serial.begin()" command is used to set up a 9600 bits/s data transfer between the Arduino and the computer, so that the Arduino can show the sensor values in real time on the laptop's console by using "serial.print()". The "for" loop is used to simplify the code and repeat the same set of instructions for all 5 LEDs, deciding which should be turned on or off.

The analogRead() instruction is used to read a value from 0 to 1023 from the analog input pins connected to the sensor. This value is then compared to a number of possible 'heat' bands and if/else-if statements are used to determine which bands are activated and which LEDs should be turned on.

This tutorial moves a step forward in showing how to build an interactive product or installation. Some of the basic coding techniques shown in this video will also be useful when approaching the upcoming tutorials. The use of the serial port communication also implicitly opens up to new opportunities, such as getting the Arduino to talk directly to other software services running on a computer and listening for serial communications.

RS DesignSpark is the go-to platform for students, makers, hobbyists and professional design engineers, providing design resources such as the award winning DesignSpark PCB and DesignSpark Mechanical CAD software. Join the community today at https://www.rs-online.com/designspark/register
DesignSpark Electrical Logolinkedin