Introduction: Arduino Project - Thermometer
This project demonstrates a device that use servos to deliver required objects through detection of the current environment temperature by using a thermistor. It detects temperature display using two LEDs with the color of red and blue that indicates hot and cold. The servo read message from the thermistor to allow the servos to move.
Supplies
- Arduino Leonardo
- Breadboard
- Wires
- 10k and 2k resistors
- Thermistor
- LEDs
- Servo motors
Step 1: Arduino Circuit
- Prepare the materials listed above.
- Connect the positive pin on the Breadboard to 5V on the Arduino Leonardo.
- Connect the negative pint to the GND.
- Place the thermistor on the Breadboard, connect one pin to the 2k resistor.
- Connect the overlapping part of both thermistor and a 2k resistor to A0.
- Connect one pin of the thermistor to positive pin and the other pin o the resistor to the negative pin.
- Place a LED on the Breadboard connect its negative (shorter) pin with a 10k resistor.
- Connect the positive (longer) pin of the LED to a digital pin (D12/11) and the other pin of the resistor to the negative pin.
- Repeat 7 and 8 for the second LED.
- Place a servo motor on the Breadboard.
- Connect its pin with black wire to negative pin, red wire to positive pin, and the white wire to a digital pin (D2/3).
- Repeat 10 and 11 for the second servo motor.
Step 2: Code
#include
int _1_i;
Servo servo_pin_2;
int _2_i;
Servo servo_pin_3;
void setup()
{
Serial.begin(9600);
pinMode( 12 , OUTPUT);
pinMode( 11 , OUTPUT);
servo_pin_2.attach(2);
servo_pin_3.attach(3);
}
void loop()
{
Serial.print(analogRead( A0 ));
Serial.print(" ");
Serial.println();
if (( ( analogRead( A0 ) ) < ( 500.0 ) ))
{
digitalWrite( 12 , HIGH );
digitalWrite( 11 , LOW );
for (_1_i=1 ; _1_i<= ( 1.0 ) ; ++_1_i )
{
servo_pin_2.write( 20.0 );
delay( 1000.0 );
servo_pin_2.write( 160.0 );
delay( 1000.0 );
}
}
if (( ( analogRead( A0 ) ) > ( 600.0 ) ))
{
for (_2_i=1 ; _2_i<= ( 1.0 ) ; ++_2_i )
{
digitalWrite( 12 , LOW );
digitalWrite( 11 , HIGH );
servo_pin_3.write( 20.0 );
delay( 1000.0 );
servo_pin_3.write( 160.0 );
delay( 1000.0 );
}
}
if (( ( ( analogRead( A0 ) ) > ( 500.0 ) ) && ( ( analogRead( A0 ) ) < ( 600.0 ) ) ))
{
digitalWrite( 12 , LOW );
digitalWrite( 11 , LOW );
}
}
Step 3: Decorate You Box
- Find a cardboard
- Measure the size of your box, including length, width, and height on the cardboard.
- Prepare a box cutter.
- Use the box cutter to carefully cut the components of your box on the cardboard, be careful not to play around with the sharp box cutter.
- Heat the glue gun.
- Use the glue gun to glue to cardboards together that forms a box, be aware of the glue gun when heated.
- Decorate the box or wrap it with the wrapper.
- Cut off two areas for the servo motors that can place the servo motors with their rotary bar appear outside.
- Poke several holes, where the LEDs and thermistor can be placed.
Step 4: Finish
The device is a thermometer that uses a thermistor to detect the temperature around. The two LEDs are red and blue color, which indicates a different temperature. Red indicates hot and blue indicates cold. The two servo motors read the messages from the thermistor and rotate when the temperature is either too hot or too cold. They are used as hooks that can hold things on. For example, users may put a sunglass or a jacket on the two servo motors. Thus, when the thermistor detects a high temperature, the servo motor will rotate, and the sunglass will drop for the user. At last, this device can use in a different environment that can deliver objects needed for the current temperature.