Introduction: Arduino - Analog LED Thermometer

I originally thought this project might be too basic to share on Instructables, but I have since realized there is room for learning at every skill level. I hope you enjoy it.

After reading numerous books and experimenting with many tutorials, I decided it was time to apply what I had learned and create my first "from scratch" Arduino project. I wanted to keep it simple but also provide the opportunity to try out some of the new coding techniques I had learned.

I came up with the idea of a large-display thermometer that uses an array of colored LEDs to represent the traditional column of liquid. In theory, a completed project of this type could be housed in an enclosure and hung on the wall, where it would be easily readable from a distance.

Step 1: Parts I Used

1- Arduino UNO
1- Breadboard
1- Protoshield (optional)
1- TMP36 temperature sensor
16- 10mm, diffused-lens LEDs (blue, green, yellow, red)
16- 330 ohm, 1/4w resistors
2- 74HC595 shift register ICs
Jumper wires

Step 2: Assembly

One important consideration when I began assembly was how to get all 16 of the LEDs to fit, evenly-spaced on the breadboard. I found I had just enough room to fit them on my 4"x6" breadboard with the upper and lower LEDs leaning slightly outward. After that, it was just a matter of placing the other components in a convenient and logical location to facilitate the many jumper wire connections. Just connect everything as shown in the Fritzing diagram and/or as commented in the sketch.

I was a bit concerned about the power usage in the event all 16 LEDs were lit at the same time. The 5v power output on the Arduino has a maximum rating of 500ma. Considering the resistors I chose, I estimated that the display should use less than 300ma. However, I never thought to actually measure it once the project was done. The power for each LED sinks through the pins in the shift register chips, so powering the full array from the Arduino output pins isn't an issue.

Note: The use of the protoshield is optional. You could just as easily connect the TMP36 to the breadboard (as shown in the Fritzing diagram). I just found it convenient to separate the display and sensing portions of the project.

After I had the hardware working, I devised an example template the might be put around the LEDs to indicate, along with the colors, what temperature was being sensed (PDF file)

Step 3: Arduino Sketch

I had used multiple shift registers in previous projects, so it wasn't too tough to adapt the necessary code for my thermometer. I thought it would be useful to be able to set the range of temperatures that the LEDs would display, so I included MAX and MIN variables to be set within the sketch.

I struggled with a more elegant way to code the way the temperature cutoff points for each LED would be tested, but finally conceded defeat and went with a long list of IF-ELSE IF statements. I realized that in the event all or none of the LEDs were lit, you wouldn't be able to tell if the temperature was merely at or well outside the specified limits. Therefore, there's a test that will flash either the top or bottom LED to show if the sensor reading is outside the range of the display. Finally (mostly because I like to watch flashy, LED thingys), I added a self-test of the display at power-up that lights all the LEDs in sequence.

Step 4: Conclusion

I originally built this project over a year ago, and have long since disassembled it. In retrospect, I've had a few further thoughts and realizations:

- It should be possible to add dimming control to the display by applying a PWM signal to the OE pins of the shift registers. The display brightness could then be adjusted manually with a potentiometer or automatically with a photocell.

- While this project was built to display temperature, I would think it could be adapted to display information from any type of sensor, humidity, sound or fluid levels for example.

- Perhaps someday I will revisit the ELSE IF issue. Maybe some of you expert coders out there can throw me a bone :-)


KDLaun (author)2016-01-24

Looks like Club Jameco has come up with a $35 PCB kit that utilizes the basic ideas of this project. :-)

RoSi (author)2015-05-25

Hi, will it be possible to add another one, two shift registers and made it from 24, 32 LEDs please?

vinceo (author)2014-05-25

Friend the circuit can be affected if I use the lm35 temperature sensor?, because I'm using it and I do not check the room temperature only when one raises the temperature a lighter and the temperature does not remain low until the minimum

oguzhan.ulucan.9 (author)vinceo2015-02-25

Yes, i also wondering that.. Did u do this circuit with LM35?

Das_Wookie made it! (author)2014-12-28

Excellent project for learning 595 Shift Registers. I made one of my own, just using one register for now... but am planning on adding another and building a custom PCB for it. My source and project files can be found here:

KDLaun (author)Das_Wookie2015-01-02

Thanks for sharing your photos and code. I look forward to seeing some of your finished PCB when you get it completed.

moimoipalamoi (author)2014-04-13

Hi there, is the code differs much if i want to use the Celcius base instead of Fahrenheit ?

KDLaun (author)moimoipalamoi2014-04-14

It shouldn't be a problem at all. In fact, the temperature input voltage from the TMP36 is first read as Celsius, then converted to Fahrenheit so both the tempC and tempF variables exist already in the sketch.

You can find these in the section of the code that looks like this:

float tempC = (probeVolts - 0.5) * 100 ; // convert voltage to degrees (subtract 500 mv offset)
float tempF = (tempC * 9.0 / 5.0) + 32.0; // convert C to F

What you would have to do is replace all the tempF notations (in the part that tests the temperature ranges and assigns byte values) with tempC.

alexmac131 (author)2014-01-18

it is good - thank you

AlistairM (author)2014-01-18

Also if you do get round to rebuilding it, i imagine it would be cool to make a dedicated pcb for it with an arduino (or attiny?) embedded in it.

AlistairM (author)2014-01-18

You said you would put it up, looks good by the way :)