Grove Minimal Thermometer

5.3K95

Intro: Grove Minimal Thermometer

For newbies in Arduino world, temperature sensor/thermo resistor can be one of the most familiar sensors.There are countless way to display the temperature information, like color of LED, serial tool on your PC, LED bar, LCD display and so on.

Different from them, this is a minimal thermometer that uses the movement of a servo to indicate the room temperature.

All modules involved can be found in Grove - Starter Kit provided by Seeed:

1. Base Shield : a conversion shield for Grove modules to connect with Arduino/Seeeduino;

2. Grove - Temperature Sensor: sense the temperature information and feed to Arduino/Seeeduino;

3. Grove - Servo: servo with Grove interface.

Attention!

Microcontroller is not included in this kit, so make sure you have a Arduino, or other Arduino compatible controller, like Seeeduino, before you use this instructables.

Assembly

The thermometer is quite simple to assemble.

1. Grove - Temperature Sensor --> port A0 on Base Shield

2. Grove - Servo --> port D5 on Base Shield

3. Cut your servo a paper face to make it a dash board.

Code

Download the .ino file in this instructables and upload it to your controller. DONE!

4 Comments

Not certain what is happening in the code here:
" if (t <=12) pos = 0;
else if(t > 20 && t < 30)
{
pos = map(t,12,30,180,0);
}
else if (t>= 30) pos = 180;
else pos = 180;
myservo.write(pos);"

But I got it working.
I had a little time, so I made a thing. I started to write out what each part of the code was doing, then decided it might work better in an image. Hopefully this helps.

Essentially that code is taking any temperature value t between 20 and 30 and mapping those values from 180 to 0. Additionally, any value outside of the 20-30 range will be translated as 180 and then written to the servo.

I think the code actually has an error in it, and you should rewrite the second if statement
from: (t > 20 && t < 30)
to: (t > 12 && t < 30)
Since the map function is mapping all of the values from 12 to 30, there's no reason not to include them. If you wanted to go the extra mile you could make them >= & <= you could, but since the values at 12 and 30 are basically home on the servo (180), it's not necessary.

Also, just to let you know, my image assumes my code rewrite above.

Dear LitLiao, thanks for your tutorial, I am now trying your project. I have downloaded your code for arduino, however when transfering, I got a compilation error. Do you know maybe where it can come from ? Best.

It worked out fine ! ;)