Вы находитесь на странице: 1из 22

AMBIENT TEMPERATURE DIGITAL MONITOR

By: PIYUSH 2K10\EC\097

CERTIFICATE

This is to certify that Name - PIYUSH Branch - Electronics and Communication Roll no 2k10\EC\097 has successfully completed the digital electronics project on Ambient Temperature Digital Monitor.

signature

Teacher

ABSTRACT

This project intends to display the ambient room temperature as measured by the LM-35 (temperature sensor) which is directly calibrated in degree Celsius. The analog output from the transistor is fed into the micro-controller through ADC programming. The final temperature is displayed in lcd.

INTRODUCTION

This digital thermometer can measure temperatures up to 150C with an accuracy of 1C. The transistor used this way makes a low-cost sensor. The entire circuit works off a 9V battery. These sensors use a solid-state technique to determine the temperature. That is to say, they dont use mercury (like old thermometers), bimetalic strips(like in some home thermometers or stoves), nor do they use thermistors (temperature sensitive resistors). Instead, they use the fact as temperature increases, the votage across a diode increases at a known rate. (Technically, this is actually the voltage drop between the base and emitter - the Vbe - of a transistor. LM-35 is calibrated directly in Celsius (Centigrade). Because these sensors have no moving parts, they are precise, never wear out, don't need calibration, work under many environmental conditions, and are consistant between sensors and readings. The analog readings of LM-35 are converted into its digital counterpart through microcontroller (A and the resultant output is shown through lcd interfacing. The lcd shows one temperature measurement is taken about every second and displayed as current temperature. Every 8 measurements a temperature average of those is calculated and displayed as Av.T. The same time a calculation about the min, max average temperature is done ( displayed as Min and Max) for all the power on one period of Arduino board.

CONTENT
CIRCUIT DIAGRAM PRELIMINARY ANALYSIS TEMPERATURE SENSOR-LM35 LM35 STRUCTURE MICROCONTROLLER ARDUINO ARDUINO READING THE ANALOG TEMPERATURE DATA PROGRAMMING LCD INTERFACING CONCLUSION BIBLOGRAPHY

CIRCUIT

Fig:

Showing the Arduino Board with LCD interfacing

Parts:
1. 2. 3. 4. 5. 6. 7. Arduino Board LCD 2x16 screen 10k Potentometer Breadboard LM-35 transistor Connecting wires Resistors and Capacitors.

SCHEMATIC DIAGRAM

Calibration of the digital thermometer


To set the minimum level (00C), place the diode in a glass of water filled with crushed ice (check the temperature first with a normal thermometer) wait until the thermometer shows zero degrees centigrade. Set P1 so that the digital voltmeter will display 000 when the diode senses zero degree centigade. To set the maximum level (1000C), place the diode sensor into a boiling water and adjust P2 so that the digital meter exactly displays 99.9.

PRELIMINARY ANALYSIS

Testing these sensors requires a battery pack or power supply. Connect a 2.7-5.5V power supply so that ground is connected to pin 3 (right pin), and power is connected to pin 1 (left pin) Then connect your multimeter in DC voltage mode to ground and the remaining pin 2 (middle). The voltage across LM-35 transistor will be 0.25V.

FIG:- The sensor is indicating that the temperature is 26.3C

How to measure temperature!

We simply connect the left pin to power (2.7-5.5V) and the right pin to ground. Then the middle pin will have an analog voltage that is directly proportional (linear) to the temperature. The analog voltage is independant of the power supply. To convert the voltage to temperature, we simply use the basic formula: Temp in C = [(Vout in mV) - 500] / 10 So for example, if the voltage out is 1V that means that the temperature is ((1000 mV - 500) / 10) = 50 C ON using a LM35, use line 'a' in the image above and the formula: Temp in C = (Vout in mV) / 10

TEMPERATURE SENSOR LM-35

Features Calibrated directly in Celsius (Centigrade) Linear + 10.0 mV/C scale factor 0.5C accuracy guaranteeable (at +25C) Rated for full -55 to +150C range Suitable for remote applications Low cost due to wafer-level trimming Operates from 4 to 30 volts Less than 60 A current drain Low self-heating, 0.08C in still air Nonlinearity only C typical Low impedance output, 0.1 Ohm for 1 mA load

Description

The LM35 series are precision integrated-circuit temperature sensors, whose output voltage is linearly proportional to the Celsius (Centigrade) temperature. The LM35 thus has an advantage over linear temperature sensors calibrated in Kelvin, as the user is not required to subtract a large constant voltage from its output to obtain convenient Centigrade scaling. The LM35 does not require any external calibration or trimming to provide typical accuracies of C at room temperature and C over a full -55 to +150C temperature range. Low cost is assured by trimming and calibration at the wafer level. The LM35's low output impedance, linear output, and precise inherent calibration make interfacing to readout or control circuitry especially easy. It can be used with single power supplies, or with plus and minus supplies. As it draws only 60 A from its supply, it has very low 10

self-heating, less than 0.1C in still air. The LM35 is rated to operate over a -55 to +150C temperature range.

LM-35 STRUCTURE

The figure showing the two temperature controlled resistors that control the temperature sensing capability of LM-35.

Schematic diagram showing LM-35 with the three output terminals along with their working. 11

MICROCONTROLLER ARDUINO

Microcontroller board

Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software. Arduino can sense the environment by receiving input from a variety of sensors and can affect its surroundings by controlling lights, motors, and other actuators. The microcontroller on the board is programmed using the Arduino programming language and the Arduino development environment.

12

13

ARDUINO
Arduino is an open-source single-board microcontroller, descendant of the open-source Wiring platform designed to make the process of using electronics in multidisciplinary projects more accessible. The hardware consists of a simple open hardware design for the Arduino board with an Atmel AVR processor and on-board I/O support. The software consists of a standard programming language compiler and the boot loader that runs on the board. Arduino hardware is programmed using a Wiring-based language (syntax + libraries), similar to C++ with some simplifications and modifications, and a Processing-based IDE. (Integrated development environment) Currently shipping versions can be purchased pre-assembled; hardware design information is available for those who would like to assemble an Arduino by hand. Additionally, variations of the Italian-made Arduinowith varying levels of compatibilityhave been released by third parties; some of them are programmed using the Arduino software.

14

READING THE ANALOG TEMPERATURE DATA

We can use anywhere between 2.7V and 5.5V as the power supply. We can use a 5V supply but note that we can also use this with a 3.3v supply just as easily. No matter what supply we use, the analog voltage reading will range from about 0V (ground) to about 1.75V. On using a 5V Arduino, and connecting the sensor directly into an Analog pin, we can use these formulas to turn the 10-bit analog reading into a temperature: Voltage at pin in millivolts = (reading from ADC) * (5000/1024) This formula converts the number 0-1023 from the ADC into 05000mV (= 5V) If using a 3.3V Arduino, we want to use this: Voltage at pin in millivolts = (reading from ADC) * (3300/1024) This formula converts the number 0-1023 from the ADC into 03300mV (= 3.3V) Then, to convert millivolts into temperature, use this formula: Centigrade temperature = [(analog voltage in mV) - 500] / 10

15

PROGRAMMING
// Arduino LCD Ambient Temperature Monitor. // Displays Current, 8 sec Average, Max and Min Temperature. // To wire your LED screen to your Arduino, connect the following pins: // LCD RS pin to digital pin 12 // LCD Enable pin to digital pin 11 // LCD D4 pin to digital pin 5 // LCD D5 pin to digital pin 4 // LCD D6 pin to digital pin 3 // LCD D7 pin to digital pin 2 // additionally, wire a 10K pot to +5V and GND, with it's wiper (output) to LCD screens VO pin (pin3). // We used the on board power source (5v and Gnd) to power the LM35 and analog pin 0 (zero) to read the analog output from the sensor. // 3 NOVEMBER 2011 // include the library code: #include <LiquidCrystal.h> // include the LCD driver library //declare variables float tempC = 0; // variable for holding Celcius temp (floating for decimal points precision) float tempf = 0; // variable for holding Fareghneit temp int tempPin = 0; // Declaring the Analog input to be 0 (A0) of Arduino board. float samples[8]; // array to hold 8 samples for Average temp calculation float maxi = 0,mini = 100; // max/min temperature variables with initial values. LM35 in simple setup only measures Temp above 0. int i; // initialize the library with the numbers of the interface pins LiquidCrystal lcd( 7, 8, 9, 10, 11, 12); void setup() { Serial.begin(9600); //opens serial port, sets data rate to 9600 bps 16

pinMode(13, OUTPUT); // The Red arduino led lcd.begin(16, 2); // set up the LCD's number of columns and rows: lcd.setCursor(0, 0); lcd.print("LCD Ambient Temp"); lcd.setCursor(0, 1); lcd.print(" Digital Monitor "); delay(5000); lcd.clear(); lcd.setCursor(0, 0); lcd.print("All temp are in "); // print text to LCD lcd.setCursor(0, 1); lcd.print("degree celsius"); delay(5000); lcd.clear(); // clear LCD display } void loop() { digitalWrite(13, LOW); // set the LED on Serial.println(analogRead(tempPin)); // Displays on serial monitor the sampled value before conversion to real Temperature reading // Start of calculations FOR loop. for(i = 0;i<=7;i++){ // gets 8 samples of temperature samples[i] = ( 4.4 * analogRead(tempPin) * 100.0) / 1024.0; // conversion math of LM35 sample to readable temperature and stores result to samples array. 1024 is the Bit depth (quantization) of Arduino. // 5 is the supply volts of LM35. Change appropriatelly to have correct measurement. My case is 4.4Volts. // Serial.println(samples[i]); Serial.print("."); // print a dot for every sample at serial monitor // Display Current Celcius Temp to LCD // ( LCD note: line 1 is the second row, since counting begins with 0): lcd.setCursor(0, 0); // set LCD cursor position lcd.print("Current T: "); // print to LCD lcd.setCursor(12, 0); lcd.print(samples[i]); // print current Temp sample to LCD tempC = tempC + samples[i]; // do the addition for average temperature delay(800); // wait 800ms } // END of FOR loop 17

Serial.println(""); // Like and CR at serial monitor Serial.println(""); tempC = tempC/8.0; // calculated the average of 8 samples in Celsius tempf = (tempC * 9)/ 5 + 32; // converts to Fahrenheit if(tempC > maxi) {maxi = tempC;} // set max temperature if(tempC < mini) {mini = tempC;} // set min temperature // Send Results to Serial Monitor Serial.println("New measurement"); Serial.print(" Average Temperature in Celcius is " ); //send the data to the computer Serial.println(tempC);//send the data to the computer Serial.print(" Average Temperature in Farenait is " ); //send the data to the computer Serial.println(tempf);//send the data to the computer Serial.print(" MAX Temperature in Celcius is " ); //send the data to the computer Serial.println(maxi);//send the data to the computer Serial.print(" MIN Temperature in Celcius is " ); //send the data to the computer Serial.println(mini);//send the data to the computer // Send results to LCD. lcd.setCursor(0, 0); lcd.print("Av.T Max Min"); // set the cursor to column 0, line 1 // (note: line 1 is the second row, since counting begins with 0): lcd.setCursor(0, 1); // print the measured temp average lcd.print(tempC); lcd.setCursor(6, 1); // print the maximum temp lcd.print(maxi); lcd.setCursor(12, 1); // print the minimum temp lcd.print(mini); digitalWrite(13, HIGH); // set the LED off delay(3000); // Wait about 3 seconds to display the results to LCD screen befor starting the loop again tempC = 0; // Set tempC to 0 so calculations can be done again } 18

LCD INTERFACING

The Displaytech 162B is a HD44780 compatible device, and interface them with the Arduino. They can be driven with a eight data lines which uses up most of the digital I/O pins on the Arduino, or more sensibly you can use 4 bit mode. LCD Pin Connected to

1 Backlight Anode +5V (via small resistor) 2 Backlight Cathode GND 3 Ground GND 4 Supply V for Logic +5V 5 Input Voltage for LCD Middle pin of 50K potentiometer 6 RS (Data/Instruction) Ard pin 12 7 R/W (Read/Write) GND 8 E (Enable) Ard pin 2 9 Data bit 0 10 Data bit 1 11 Data bit 2 12 Data bit 3 13 Data bit 4 Ard pin 7 14 Data bit 5 Ard pin 8 15 Data bit 6 Ard pin 9 16 Data bit 7 Ard pin 10 19

The other two pins of the potentiometer are connected to +5V and GND and provide a contrast control (and we will need it at least initally). 50K is over the top for the purpose, 10K is more typical. The resistor on the backlight was added because the backlight LED on the board was getting rather warm. The display stays bright enough and runs a bit cooler with a resistor on the supply. The pin allocations on the Arduino were dictated by the LCD4Bit library. Twist the potentiometer to get a readable display.

Following pin diagram corresponds us to make the necessary changes in the program.

LCD pin name Arduino pin #

RS 7

EN 8

DB4 9

DB5 10

DB6 11

DB7 12

LiquidCrystal lcd(12, 11, 5, 4, 3, 2); And change it to: LiquidCrystal lcd(7, 8, 9, 10, 11, 12);

20

CONCLUSION

The lcd shows one temperature measurement which is taken about every second and displayed as current temperature. Every 8 measurements a temperature average of those is calculated and displayed as Av.T. The same time a calculation about the min, max average temperature is done ( displayed as Min and Max) for all the power on one period of Arduino board.

21

BIBLOGRAPHY

The idea for the following project has been taken from: http://www.ladyada.net/learn/lcd/charlcd.html http://www.national.com/mpf/LM/LM35.html#Overview http://www.ladyada.net/learn/sensors/tmp36.html Electronics for You 2010

22

Вам также может понравиться