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- 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
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 :-)
Das_Wookie made it!