Instructables

Arduino Digital 7-Segment Thermometer

Hello everybody! I will be showing you how to make a digital 7-segment thermometer using the LM335 temperature sensor.

This a guide for an Arduino version, but I am working on a mini ATtiny84 version. Once I get that working, I will post another Instructable on how to make it.

I'm sure you could make this same thermometer with an LM35 also, if that's what you have, and you probably won't have to modify the code.

This is an entry in both the LED contest with Elemental LED and the Hurricane Lasers contest, so if you like it, vote for it! Thanks!

Also, I am considering starting an electronics kit business to sell kits for the Instructables that I make, so if you like the idea, drop a comment or PM me!
 
Remove these adsRemove these ads by Signing Up

Step 1: Parts list

Here are the things you will need for this project. You can get all these parts from a wholesale supplier like Mouser or Digi-Key for around $10-$15 or less, except for the Arduino board. You can get this from Mouser for around $30.

Parts:
1x Arduino Uno/Duemilanove/maybe Diecimila or equivalent
1x LM335 temperature sensor (I'm sure you could make it work with a LM35 too)
2x Single digit 7-segment display, common cathode (or a single 2 digit one)
1x 2.2k ohm resistor (not sure if you need this if you are using an LM35)
Jumper wires

Tools:
USB A-B cable
Breadboard
ggomes31 month ago

ythghgd

It seems that Mr/Mrs xBacon is unwilling to answer any question related to this instructable. He/She obviously doesn't even read the comments....or his/her inbox! So, that's why I undertook to search and evntually find the solution to the 'Zeros Problem" ! Here's the CORRECT, 100% WORKING code:

#include "SevSeg.h"

SevSeg sevseg;

int refreshTime = 2000; //how many seconds should it wait before it checks and displays the temp again? 1000 = 1 second

unsigned long timer;
float celsius = 0, kelvin = 0, fahrenheit = 0;

void setup()
{
sevseg.Begin(0,2,3,4,5,6,7,8,9,10,11,12,13);
}

void loop()
{
sevseg.PrintOutput();

//Reads the input and converts it to Kelvin degrees
kelvin = analogRead(0) * 0.004882812 * 100;

//Converts Kelvin to Celsius minus 2.5 degrees error
celsius = kelvin - 2.5 - 273.15;

//Converts Kelvin to Fahrenheit minus 2.5 degrees error
fahrenheit = ((kelvin - 2.5) * 9 / 5) - 459.67;

unsigned long mils=millis();
if (mils-timer>=refreshTime) {
timer=mils;
//Print teperature to the displays
sevseg.NewNum(celsius,(byte) 2);
}
}

If you want to change the unit of temperature, all you have to do is to change the last command: sevseg.NewNum(celsius,(byte) 2);
Instead of "celsius", you can type "fahrenheit" or "kelvin". It seems that all this "tempUnits" thing doesn't work, so I totally excluded it from the code.
You may also change the delay by following the steps of this instructabe.
Have fun!
how exactly do i wire all this up? the image is blurry and i really dont get the schematic. Can anyone please help??
mkor681 year ago
Love the simplicity of your project. I'm trying to make this work but it only gives zeros. The wiring is correct. Is the sketch missing something?
Thx.
I get the 0s too. There are no problems in wiring and I'm using the LM335.
yzheng1 year ago
professorred

did you use this wiring diagram?
http://mysite.du.edu/~etuttle/electron/circ186.gif
yzheng1 year ago
if i want to add a 3rd digit 7 segment, the common cathode is connected to D3?

more importantly, will you be selling/making ready-made pcbs? it would be alot easier than buying a prototyping board and using crude solder traces.
tbagain ü1 year ago
Hi! I've tried doing this. It seems I wired everything correctly. However, it displays "00." I'm using a LM335 temp sensor with common cathode 7-segment as you've done in your demonstration. Is this a problem with the sensor? do I need to calibrate it? thanks!
marcusone1 year ago
Can it work with individual 7-seg displays?
soccer22911 year ago
Is there supposed to be seven series resistors in line with each segment on the display?
nharun11 year ago
can it work with 3 digit 7-segment?? thanks in advance.
xBacon (author)  nharun11 year ago
Yes, it can work with that. Since the 3 digit is already multiplexed, you just connect the segment pins to the arduino, and the first 2 digit pins to the arduino. It should work then.
Hi. No matter how I set up the LM35, I am getting a result of 00. I am not sure what is going on. Thank you.
xBacon (author)  professorred1 year ago
you must use the LM335, not the LM35.
Ah. I was wondering because of the line in the parts list that mentioned that it should work with the LM35 but thank you. :)
xBacon (author)  professorred1 year ago
well, it should work if you connect the lm35 in the correct way. the connections are different for the lm35 and he lm335. try going on google and searching "lm35 arduino" and you should come up with a circuit diagram. just follow the diagram and connect it to the analog input used in the sketch.
Hi. I copied and pasted the code to my arduino program and when I hit verify, it came up with an error saying Fahrenheit was not declared in this scope. Please help. Thank you.
xBacon (author)  professorred1 year ago
Try moving the line:

int tempUnits = fahrenheit;

to under the line that says:

float celsius = 0, kelvin = 0, fahrenheit = 0;

Tell me if this works.
Thank you much. That worked like a charm. Now to build it. Thanks again.
xBacon (author)  professorred1 year ago
No problem :)
randofo1 year ago
Do you have any further plans for this project? Are you going to use the thermometer for anything?
xBacon (author)  randofo1 year ago
I am working on developing a version of this that runs on an ATtiny84 or ATtiny44 chip. I am designing the PCB in Eagle as we speak, and last night I ordered the parts to prototype it on a breadboard.

I was thinking about making a waterproof and or heatproof version that is wireless (maybe xBee).
xBacon (author)  xBacon1 year ago
Also, I was planning on using http://oshpark.com to fabricate the PCBs.
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!