24 Ekim 2012 Çarşamba

A simple Arduino based Temperature logger System



LM35 are cheap yet accurate temperature Sensor from National instruments whose output voltage is linearly proportional to the Fahrenheit temperature. Its outputs 10mV for each degree rise in temperature (in Fahrenheit scale). The Arduino will measure the voltage input from the LM35 (Connected to Analog Pin 0 of the Arduino) and convert it to temperature reading in Celsius from the voltage measured and output the result to the serial port.

The connection of the Arduino with the LM35 temperature sensor is as given below …
My arrangement on a Breadboard …
After completing the connection on a breadboard , I build the code and uploaded it into the arduino board’s microcontroller’s program memory , which would be continuously read the sensor value and send the recorded values to the serial port of the computer.
In order to calculate the Celsius reading from the analog value, we use the following formula to calculate the temperature in Celsius:
Where
Val = is the value send to the computer by the serial port
tempC= is the calculated temperature value (in Celsius)
5 is the reference we are using
1024 is the resolution of the 10 bit internal ADC of the Arduino
01float tempC;
02int Sensor = 0;
03 
04void setup()
05{
06Serial.begin(9600); //opens serial port, sets data rate to 9600 bps
07}
08 
09void loop()
10{
11float val = analogRead(Sensor);           //read the value from the sensor
12tempC = (5.0 * val * 100.0)/1024.0;  //convert the analog data to temperature
13Serial.print("Temperature = ");
14Serial.print((byte)tempC);     //send the data to the computer
15Serial.println("C");
16delay(1000);                           //wait one second before sending new data
17}
The Output (Temperature Values of the Sensor) can be monitored by Clicking the Serial monitor icon on upper right corner of the console (where you write your Arduino code) ……
I touched the Head of the Temperature sensor LM35 with a cotton soaked in icy cold water to check the working of the sensor. If every thing goes right you will be able to see the temperature values in your PC in a Tab as shown ….

Hiç yorum yok: