Upload
piyush-kr
View
225
Download
0
Embed Size (px)
Citation preview
8/3/2019 Digital Thermometer Reloaded
1/22
AMBIENTTEMPERATUREDIGITAL MONITOR
By:
PIYUSH - 2K10\EC\097
8/3/2019 Digital Thermometer Reloaded
2/22
CERTIFICATE
This is to certify thatName - PIYUSHBranch - Electronics and CommunicationRoll no 2k10\EC\097has successfully completed the digital electronics project on Ambient Temperature Digital Monitor.
Teachersignature
2
8/3/2019 Digital Thermometer Reloaded
3/22
ABSTRACT
This project intends to display the ambient room
temperature as measured by the LM-35(temperature sensor) which is directly calibrated indegree Celsius. The analog output from thetransistor is fed into the micro-controller through
ADC programming. The final temperature isdisplayed in lcd.
3
8/3/2019 Digital Thermometer Reloaded
4/22
INTRODUCTION
This digital thermometer can measure temperatures up to 150C withan accuracy of 1C. The transistor used this way makes a low-costsensor. Theentire circuit works off a 9V battery.
These sensors use a solid-state technique to determine thetemperature. That is to say, they dont use mercury (like old
thermometers), bimetalic strips(like in some home thermometers orstoves), nor do they use thermistors (temperature sensitive resistors).Instead, they use the fact as temperature increases, the votage acrossa diode increases at a known rate. (Technically, this is actually thevoltage 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, neverwear out, don't need calibration, work under many environmentalconditions, and are consistant between sensors and readings.
The analog readings of LM-35 are converted into its digital counterpartthrough microcontroller (A and the resultant output is shown throughlcd interfacing.
The lcd shows one temperature measurement is taken about everysecond and displayed as current temperature. Every 8 measurementsa temperature average of those is calculated and displayed as Av.T.The same time a calculation about the min, max average temperatureis done ( displayed as Min and Max) for all the power on one period ofArduino board.
4
http://en.wikipedia.org/wiki/Bimetallic_striphttp://en.wikipedia.org/wiki/Thermistorhttp://en.wikipedia.org/wiki/Bimetallic_striphttp://en.wikipedia.org/wiki/Thermistor8/3/2019 Digital Thermometer Reloaded
5/22
CONTENT
CIRCUIT DIAGRAM
PRELIMINARY ANALYSIS
TEMPERATURE SENSOR-LM35
LM35 STRUCTURE
MICROCONTROLLER ARDUINO
ARDUINO
READING THE ANALOG TEMPERATURE DATA
PROGRAMMING
LCD INTERFACING
CONCLUSION
BIBLOGRAPHY
5
8/3/2019 Digital Thermometer Reloaded
6/22
CIRCUIT
Fig: Showing the Arduino Board with LCD interfacing
Parts:
1. Arduino Board
2. LCD 2x16 screen3. 10k Potentometer
4. Breadboard
5. LM-35 transistor 6. Connecting wires
7. Resistors and Capacitors.
6
8/3/2019 Digital Thermometer Reloaded
7/22
SCHEMATIC DIAGRAM
Calibration of the digital thermomet
To set the minimum level (00C), place the diode in a glass of water filled with crushed ice (check thetemperature first with a normal thermometer) wait until the thermometer shows zero degrees centigra
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 t
digital meter exactly displays 99.9.
7
8/3/2019 Digital Thermometer Reloaded
8/22
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 be0.25V.
FIG:- The sensor is indicating that the temperature is 26.3C
8
http://www.ladyada.net/images/sensors/tmp36test.jpg8/3/2019 Digital Thermometer Reloaded
9/22
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
9
8/3/2019 Digital Thermometer Reloaded
10/22
TEMPERATURESENSOR
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 notrequired to subtract a large constant voltage from its output to obtain
convenient Centigrade scaling. The LM35 does not require any externalcalibration 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 especiallyeasy. 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
8/3/2019 Digital Thermometer Reloaded
11/22
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 theirworking.
11
8/3/2019 Digital Thermometer Reloaded
12/22
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 theArduino
programming language and the Arduino development environment.
12
http://arduino.cc/en/Reference/HomePagehttp://arduino.cc/en/Reference/HomePagehttp://arduino.cc/en/Reference/HomePagehttp://arduino.cc/en/Reference/HomePage8/3/2019 Digital Thermometer Reloaded
13/22
13
8/3/2019 Digital Thermometer Reloaded
14/22
ARDUINO
Arduino is anopen-sourcesingle-board microcontroller, descendant of the open-source
Wiring platformdesigned to make the process of using electronics in multidisciplinaryprojects more accessible. The hardware consists of a simple open hardware design for the
Arduino board with anAtmel AVRprocessor and on-boardI/O support. The software
consists of a standard programming language compiler and theboot loaderthat 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-basedIDE.
(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
http://en.wikipedia.org/wiki/Open-source_hardwarehttp://en.wikipedia.org/wiki/Open-source_hardwarehttp://en.wikipedia.org/wiki/Single-board_microcontrollerhttp://en.wikipedia.org/wiki/Wiring_(development_platform)http://en.wikipedia.org/wiki/Wiring_(development_platform)http://en.wikipedia.org/wiki/Atmel_AVRhttp://en.wikipedia.org/wiki/Atmel_AVRhttp://en.wikipedia.org/wiki/Input/outputhttp://en.wikipedia.org/wiki/Input/outputhttp://en.wikipedia.org/wiki/Booting#Boot_loaderhttp://en.wikipedia.org/wiki/C%2B%2Bhttp://en.wikipedia.org/wiki/C%2B%2Bhttp://en.wikipedia.org/wiki/Processing_(programming_language)http://en.wikipedia.org/wiki/Integrated_development_environmenthttp://en.wikipedia.org/wiki/Integrated_development_environmenthttp://en.wikipedia.org/wiki/Integrated_development_environmenthttp://upload.wikimedia.org/wikipedia/commons/4/42/Arduino_Uno_logo.pnghttp://upload.wikimedia.org/wikipedia/commons/a/a7/Arduino_IDE_-_v0011_Alpha.pnghttp://en.wikipedia.org/wiki/Open-source_hardwarehttp://en.wikipedia.org/wiki/Single-board_microcontrollerhttp://en.wikipedia.org/wiki/Wiring_(development_platform)http://en.wikipedia.org/wiki/Atmel_AVRhttp://en.wikipedia.org/wiki/Input/outputhttp://en.wikipedia.org/wiki/Booting#Boot_loaderhttp://en.wikipedia.org/wiki/C%2B%2Bhttp://en.wikipedia.org/wiki/Processing_(programming_language)http://en.wikipedia.org/wiki/Integrated_development_environmenthttp://en.wikipedia.org/wiki/Integrated_development_environment8/3/2019 Digital Thermometer Reloaded
15/22
READING THE ANALOGTEMPERATURE DATA
We can use anywhere between 2.7V and 5.5V as the power supply. Wecan 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 anAnalog 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 0-5000mV (= 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 0-3300mV (= 3.3V)
Then, to convert millivolts into temperature, use this formula:
Centigrade temperature = [(analog voltage in mV) - 500] / 10
15
8/3/2019 Digital Thermometer Reloaded
16/22
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 theLM35 and analog pin 0 (zero) to read the analog output from the
sensor.
// 3 NOVEMBER 2011
// include the library code:
#include // include the LCD driver library
//declare variables
float tempC = 0; // variable for holding Celcius temp (floating fordecimal points precision)
float tempf = 0; // variable for holding Fareghneit temp
int tempPin = 0; // Declaring the Analog input to be 0 (A0) of Arduinoboard.
float samples[8]; // array to hold 8 samples for Average tempcalculation
float maxi = 0,mini = 100; // max/min temperature variables withinitial 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
8/3/2019 Digital Thermometer Reloaded
17/22
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 thesampled value before conversion to real Temperature reading
// Start of calculations FOR loop.for(i = 0;i
8/3/2019 Digital Thermometer Reloaded
18/22
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 temperatureif(tempC < mini) {mini = tempC;} // set min temperature
// Send Results to Serial MonitorSerial.println("New measurement");
Serial.print(" Average Temperature in Celcius is " ); //send thedata to the computer
Serial.println(tempC);//send the data to the computerSerial.print(" Average Temperature in Farenait is " ); //send
the data to the computer
Serial.println(tempf);//send the data to the computerSerial.print(" MAX Temperature in Celcius is " ); //send the
data to the computerSerial.println(maxi);//send the data to the computer
Serial.print(" MIN Temperature in Celcius is " ); //send the
data to the computerSerial.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 templcd.print(mini);
digitalWrite(13, HIGH); // set the LED off
delay(3000); // Wait about 3 seconds to display the results to LCDscreen befor starting the loop again
tempC = 0; // Set tempC to 0 so calculations can be done again
}
18
8/3/2019 Digital Thermometer Reloaded
19/22
LCD INTERFACING
The Displaytech 162B is a HD44780 compatible device, and interfacethem 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 GND3 Ground GND
4 Supply V for Logic +5V
5 Input Voltage for LCD Middle pin of 50K potentiometer6 RS (Data/Instruction) Ard pin 12
7 R/W (Read/Write) GND8 E (Enable) Ard pin 2
9 Data bit 0
10 Data bit 111 Data bit 2
12 Data bit 313 Data bit 4 Ard pin 7
14 Data bit 5 Ard pin 8
15 Data bit 6 Ard pin 916 Data bit 7 Ard pin 10
19
8/3/2019 Digital Thermometer Reloaded
20/22
The other two pins of the potentiometer are connected to +5V andGND 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 enoughand 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 RS EN DB4 DB5 DB6 DB7
Arduino pin # 7 8 9 10 11 12
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
And change it to:
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
20
8/3/2019 Digital Thermometer Reloaded
21/22
CONCLUSION
The lcd shows one temperature measurement which is taken aboutevery second and displayed as current temperature. Every 8measurements a temperature average of those is calculated anddisplayed as Av.T. The same time a calculation about the min, maxaverage temperature is done ( displayed as Min and Max) for all thepower on one period of Arduino board.
21
8/3/2019 Digital Thermometer Reloaded
22/22
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
http://www.ladyada.net/learn/lcd/charlcd.htmlhttp://www.national.com/mpf/LM/LM35.html#Overviewhttp://www.ladyada.net/learn/sensors/tmp36.htmlhttp://www.ladyada.net/learn/lcd/charlcd.htmlhttp://www.national.com/mpf/LM/LM35.html#Overviewhttp://www.ladyada.net/learn/sensors/tmp36.html