Friday, April 18, 2014

Circuit #7 Temperature Sensor Notes

Goal: Use the "serial monitor" window to read a temperature sensor.

TMP36 - Temperature sensor that outputs a voltage that is proportional to the ambient temperature.

Serial.begin(baud rate) -Initialize Arduino's serial port and set communications speed. Speed is measured in bits per second, aka baud rate. 9600 transfers ~10 characters per second

float - Floating point variable. Can handle fractional numbers.

Serial.print("text") - Prints "text"

Serial.print(variable) - Prints variable value

Serial.println( ) - Print prints text to the same line and println inserts a carriage return.

Challenge: Make a thermostat
Solution: Connect a potentiometer between circuit and A0.
Connect j6 through the bottom pin of the potentiometer (e22). Connect top pin of the pot to "+." Connect middle pin of the pot to A0.
No change to Sketch needed.

Challenge: Turn on/off an LED if the temperature is above or below a value
Solution: Left the potentiometer in to better control the temperature. Attached an LED and 330 Ohm resistor between GND and pin 9.
Additional code added to the Sketch.

Sources:
Vilros Ultimate Starter Kit Tutorial Sketches 1-12

No comments:

Post a Comment