NEED HELP WITH THERMOMETER WITH LED READOUT

HELLO,

I wanting to create a thermometer that displays LED lights in the form of a bar graph to show temperature change. I have searched around and have come across a few similar projects, but am looking for some help with my current parts and an suggestions and help with refining coding for it.

I have a sunfounder mega 2560 arduino board (all starter kit components as well), the temperature sensor(s) i want to use are DS18B20, I want to have two of them and I want them to each connect to their own led bar graph to show difference in temperature.

Can anyone lend a hand with this project and help me?

What kind of bargraph do You want to use? You could use an LED strip. Length at Your decire from 1 foot to 30 feet or more…..
Search for the tempsensor and start running just the mega and the DS18B20 so You get familiar with it. Use Serial Monitor to show the temperature as a beginning.
Then do the same with the bar graph. Run the mega and the LEDs to get familiar.
By then You will surely manage.

Is your bar graph common cathode or anode? How many LEDs? Post a link to the bar graph.

#include <DallasTemperature.h>
#include <OneWire.h>

int temp_sensor = A0;

float temperature;

int pin2 = 2;
int pin3 = 3;
int pin4 = 4;
int pin5 = 5;
int pin7 = 7;
int pin8 = 8;
int pin9 = 9;
int pin10 =10;

OneWire oneWirePin(temp_sensor);

DallasTemperature sensors(&oneWirePin);

void setup()
{

Serial.begin(9600);

pinMode(pin2, OUTPUT);
pinMode(pin3, OUTPUT);
pinMode(pin4, OUTPUT);
pinMode(pin5, OUTPUT);
pinMode(pin7, OUTPUT);
pinMode(pin8, OUTPUT);
pinMode(pin9, OUTPUT);
pinMode(pin10, OUTPUT);
sensors.begin();
}

void loop()
{

Serial.print(" Requesting temperatures...");
sensors.requestTemperatures(); // Send the command to get temperatures
Serial.println("DONE");

Serial.print("Temperature is: ");
Serial.print(sensors.getTempCByIndex(0));
Serial.println();

if(temperature>=18.00){digitalWrite(pin10,HIGH);}
if(temperature>=22.00){digitalWrite(pin9,HIGH);}
if(temperature>=24.00){digitalWrite(pin8,HIGH);}
if(temperature>=24.00){digitalWrite(pin7,HIGH);}
if(temperature>=26.00){digitalWrite(pin5,HIGH);}
if(temperature>=28.00){digitalWrite(pin4,HIGH);}
if(temperature>=30.00){digitalWrite(pin3,HIGH);}
if(temperature>=32.00){digitalWrite(pin2,HIGH);}
delay(99);
digitalWrite(pin10, LOW);
digitalWrite(pin9, LOW);
digitalWrite(pin8, LOW);
digitalWrite(pin7, LOW);
digitalWrite(pin5, LOW);
digitalWrite(pin4, LOW);
digitalWrite(pin3, LOW);
digitalWrite(pin2, LOW);
delay(1);
}

That's really "helpful". NOT.

Post code without answering questions.

Lots of luck getting help that way.

.

You are just kidding yourself with a delay of 100 total. Delay(1000): would be a little more to the point. At the default resolution which you have but don't need, the sensor takes 750 to do its job.

Your DS18B20 example should have the lines to set the resolution. Using the lowest and ints rather than floats would be a lot faster, and your proposed delay times might actually be OK.

I don't know about bar graphs. The code seems reasonable but you might be able to do things a lot more elegantly using the MAX72xx chip.

Hi,
Welcome to the forum.

Please read the post at the start of any forum , entitled "How to use this Forum".
OR
http://forum.arduino.cc/index.php/topic,148850.0.html.
Then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks.. Tom.. :slight_smile:

ieee488:
That's really "helpful". NOT.

Post code without answering questions.

Lots of luck getting help that way.

.

Sorry, for the inconvenience.

Nick_Pyner:
You are just kidding yourself with a delay of 100 total. Delay(1000): would be a little more to the point. At the default resolution which you have but don't need, the sensor takes 750 to do its job.

Your DS18B20 example should have the lines to set the resolution. Using the lowest and ints rather than floats would be a lot faster, and your proposed delay times might actually be OK.

I don't know about bar graphs. The code seems reasonable but you might be able to do things a lot more elegantly using the MAX72xx chip.

I should've clarified on my original post, I am a total noob. If that wasn't obvious enough...

I was going off of two different projects that I found online and attempting to mash them together..

MAX72xx chip would be a great solution! I am very interested in that. thank you for the suggestion. I will dive into that as well as my temperature sensor.

Hi,
Have you built and tried your code?
If so what does it do/not do?

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

What do you see on the IDE monitor screen?

Thanks.. Tom.. :slight_smile: