Review:
What is LM35 Temperature sensor?
A temperature sensor is a device which is designed specifically to measure the hotness or coldness of an object. The LM35 series are precision integrated-circuit temperature to the Centigrade temperature.
How about LM34 Temperature sensor?
The LM34 series are precision integrated-circuit temperature to the Fahrenheit temperature.
Materials Need:
1 x gizDuino PLUS ATmega644P
1 x Solderless Breadboard
1 x LM35 Temperature Sensor or LM34 Temperature Sensor
1 x USB Cable
3 x 1pin Jumper wire (male-male)
Schematic Diagram:
Codes for LM35 in Celcius:
| /* |
| "GizDuino Starter kit" |
| |
| Temperature sensor (LM35) Sample code |
| |
| STEP 1: Construct the circuit of GizDuino Temperature sensor. |
| STEP 2: Connect the USB Cable to your computer. |
| STEP 3: Open the Arduino IDE. |
| STEP 4: Open the Temperature sensor (LM35) Sample code from GizDuino Starter kit code. |
| STEP 5: Then, click Upload. |
| |
| This sample code is simply read the Sensor output. |
| */ |
| |
| |
| float Temp; |
| int TempPin = 0; // |
| // the setting up of pins. |
| void setup() |
| { |
| // initialize the digital pin as an output. |
| Serial.begin(9600); |
| } |
| // the loop is where your program runs repeatedly. |
| void loop() |
| { |
| Temp = analogRead(TempPin); //read the analogpin |
| Temp = (Temp * 0.488)/10; //multiply by 0.488 for calibration and exact value of temperature. |
| Serial.print(Temp); // print the result open the serial monitor. |
| Serial.println(); |
| delay(1000); // 1 second delay. |
| } |
Codes for LM34 in Fahrenheit and converted to Celcius:
| /* |
| LM34 Temperature Sensor Sketch |
| |
| This sample sketch is for LM34 IC |
| Temperature Sensor, it can display the |
| degrees in Fahrenheit and Celcius. |
| |
| STEP 1: Construct the circuit of GizDuino Temperature sensor. |
| STEP 2: Connect the USB Cable to your computer. |
| STEP 3: Open the Arduino IDE. |
| STEP 4: Open the Temperature sensor (LM34) Sample code from GizDuino Starter kit code. |
| STEP 5: Then, click Upload. |
| |
| This sample code is simply read the Sensor output. |
| |
| */ |
| //initializes/defines the output pin of the LM34 temperature sensor |
| int LM34_pin= 0; |
| //this sets the ground pin to LOW and the input voltage pin to high |
| void setup() |
| { |
| Serial.begin(9600); |
| } |
| |
| |
| void loop() |
| { |
| int raw_voltage = analogRead(outputpin); |
| float milli_volts= (raw_voltage/1024.0) * 5000; |
| float fahrenheit= milli_volts/10; |
| Serial.print(fahrenheit); |
| Serial.println(" degrees Fahrenheit, "); |
| |
| float celsius= (fahrenheit - 32) * (5.0/9.0); |
| |
| Serial.print (celsius); |
| Serial.println(" degrees Celsius"); |
| delay(1000); |
| |
| } |
Leave a Comment