Pages: 1 [2]   Go Down
Author Topic: Project #3 - Love-O-Meter  (Read 2105 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 15
High School Teacher - Design & Technology Education Bloomfield Hills Schools Bloomfield Hills, MI
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The lights tell me if the temp is above or below the baseline
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 238
Posts: 24322
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

OK, now comes the first tool of debugging - the serial print.
What do they tell you?
(Ignore the lights)
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline Offline
Newbie
*
Karma: 0
Posts: 15
High School Teacher - Design & Technology Education Bloomfield Hills Schools Bloomfield Hills, MI
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Who is they?
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 238
Posts: 24322
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This stuff
Code:
int sensorVal = analogRead(sensorPin);
  Serial.print("Sensor Value: ");
  Serial.print(sensorVal);
isn't there for decoration.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline Offline
Newbie
*
Karma: 0
Posts: 15
High School Teacher - Design & Technology Education Bloomfield Hills Schools Bloomfield Hills, MI
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm brand new to this, so I apologize for my lack of knowledge, but I have no idea what you are getting at. I see the line of code on my screen. What are you trying to point out? Is there something I am supposed to change?
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 238
Posts: 24322
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What I'm pointing out is that the sketch has a built-in mechanism for reporting the actual values read from the sensor.
This is what you should be looking at, not the lights.
This will help indicate whether you have your sensor wired correctly and if it is working as expected.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline Offline
Newbie
*
Karma: 0
Posts: 15
High School Teacher - Design & Technology Education Bloomfield Hills Schools Bloomfield Hills, MI
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you.
I have it working now (wire was not pushed all the way in on the bread board).
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 238
Posts: 24322
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

That's one of the other things about debugging - use as many different approaches as you can to examine the problem or its symptoms, but make sure you understand the limitations of each method.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline Offline
Newbie
*
Karma: 0
Posts: 15
High School Teacher - Design & Technology Education Bloomfield Hills Schools Bloomfield Hills, MI
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I appreciate the input
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,

Could you explain to me why do we have to remove -0,5 to convert the voltage temperature, I don't understand why it's neceesary to create an offset.

Thanks in advance ;-)
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 69
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If you open the serial monitor you will see the value being returned from the temperature sensor,  go to line two of your code -"const float baselineTemp = 20.0;" and change the 20.0 to the value shown in the serial monitor. This will calibrate your program correctly.

If you want the code to calibrate itself simply remove the "const" from line 2 and ad the line "baselineTemp = analogRead(sensorPin);" to your setup void. This will record the initial value returned from the sensor and use that as your base line. Since you will be doing this in the setup void it will happen only once each time the arduino is reset or turned on.

Another option is to add a push button to your setup and add the appropriate code to set your baseline when the button is pressed. This can turn your Love-o-meter into a Who's Hotter game!
Logged

Pages: 1 [2]   Go Up
Jump to: