loading
Picture of 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!

Step 1: Parts list

Picture of 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
 
PepeR122 days ago
Diannes31 month ago
I want this, send to me please dianneschuur@gmail.com
Vitor Reppen2 months ago

Ok I modify some things on the code and got it work on a LM35, If anyone want the code just reply this comment and I let you know.

Great job in this project, thank you. Helped a lot!

I want to know please!!
vih_neta@hotmail.com

I don't send by email, but I let you know here :D

#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(1,2,3,4,5,6,7,8,9,10,11,12,13);
}

void loop()
{
sevseg.PrintOutput();

//LM35 code to display celsius
celsius = (5.0 * analogRead(0) * 100.0) / 1024;

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

Thanks to :

salexandridis

xBacon

iamakidilam3 months ago

does this work? i'm having a common cathode display

MokshJadhav3 months ago

@salexandridis has made the proper code. Check my instructable(PING with 2 LED seven segment displays) for the proper diagram if you have any difficulties in assembling the project.

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!

is it possible to display the readings on serail as well as on the LED Dsiplay?

I've tried but I can only get one or the other but not both.

gmally4 months ago

is it possible to display the readings on serail as well as on the LED Dsiplay?

I've tried but I can only get one or the other but not both.

ozuniga19805 months ago

no works sorry bad code

enhatem8 months ago

Shouldn't there be resistors connect for each LED in the 7-Segment Display ?

ahmeds79 months ago

thank you

ggomes31 year ago

ythghgd

jameeljoker2 years ago
how exactly do i wire all this up? the image is blurry and i really dont get the schematic. Can anyone please help??
mkor682 years 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.
yzheng2 years ago
professorred

did you use this wiring diagram?
http://mysite.du.edu/~etuttle/electron/circ186.gif
yzheng2 years 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 ü2 years 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!
marcusone2 years ago
Can it work with individual 7-seg displays?
soccer22912 years ago
Is there supposed to be seven series resistors in line with each segment on the display?
nharun12 years ago
can it work with 3 digit 7-segment?? thanks in advance.
xBacon (author)  nharun12 years 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)  professorred2 years 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)  professorred2 years 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)  professorred3 years 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)  professorred3 years ago
No problem :)
randofo3 years ago
Do you have any further plans for this project? Are you going to use the thermometer for anything?
xBacon (author)  randofo3 years 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)  xBacon3 years ago
Also, I was planning on using http://oshpark.com to fabricate the PCBs.