Académique Documents
Professionnel Documents
Culture Documents
01. INTRODUCTION
Temperature sensors are vital to a variety of everyday products. For example,
household ovens, refrigerators, and thermostats all rely on temperature maintenance
and control in order to function properly. Temperature control also has applications in
chemical engineering. Examples of this include maintaining the temperature of a
chemical reactor at the ideal set-point, monitoring the temperature of a possible
runaway reaction to ensure the safety of employees, and maintaining the temperature
of streams released to the environment to minimize harmful environmental impact.
A Light Detector or a Light Sensor is a device or circuit that detects the intensity of the
light incident on it. Different types of light detectors are LDRs (or Light Dependent
Resistors), Photo Diodes, Photo Transistors, etc.
All these devices are called as Photoelectric Devices as they convert light energy to
electric energy. These Light Detectors or Sensors can detect different types of light like
visible light, ultraviolet light, infrared light etc.
In this project, we have designed a simple Light Detector using LDR. When the light
falls on the LDR, the light stays off and when the light stops falling on LDR, the LED
glows.
PIC18F4550
16*2 LCD
5V POWER SUPPLY
TEMPERATURE SENSOR(LM35)
CONNECTING WIRES
LDR(Light Dependent Resistor)
3.1 PIC18F4550
3.3 LM35
The LM35 does not require any external n Calibrated directly in ˚ Celsius (Centigrade)
calibration or trimming to provide typical accuracies of ±1⁄4˚C n Linear + 10.0 mV/˚C
scale factor at room temperature and ±3⁄4˚C over a full −55 to +150˚C n 0.5˚C accuracy
guaranteeable (at +25˚C) temperature range.
Typical Applications
(+2˚C to +150˚C)
3.4 LDR
Applications
Photoconductive cells are used in many different types of circuits and applications.
05. CONSTRUCTION
You will need a PIC18F4520 chip running at 20MHz attached with a standard 16×2
LCD Module and LM35 on AN0 pin. LM35 is a 3 pin device as show above.
connect the +Vs Pin to 5v and GND to GND. The output must be connected to the
analog input pin 0 of the PIC18F4550 MCU.
The extra part required for this project like LCD and the LM35 temperature sensor are
installed in the expansion board.
Turn on the power supply, the screen should show the current temperature readings.
Bring a Hot soldering iron tip near the LM35’s pins, don’t touch it keep it 1 or 2mm
away.
The screen should update with the rising temperature. Now finally touch the pins of
LM35 with the tip of iron, the temperature should rise quickly. Keep it there until
temperature rise to 80 degrees, then remove the iron.
You can now blow some air by your mouth on the sensor to cool it down
07. CODE
#include <stdio.h>
#include <string.h>
#include <p18f4550.h>
#include "Configuration_Header_File.h" /* Header File for Configuration bits
*/
#include "LCD_16x2_8-bit_Header_File.h" /* Header File for LCD
Functions */
#include "PIC18F4550_ADC_Header_File.h"
void main()
{
char Temperature[10];
float celsius;
int i;
OSCCON=0x72; /* set internal Oscillator frequency to 8 MHz*/
LCD_Init(); /* initialize 16x2 LCD*/
ADC_Init(); /* initialize 10-bit ADC*/
while(1)
{
LCD_String_xy(0,0,"Temperature");
/* convert digital value to temperature */
celsius = (ADC_Read(0)*4.88);
celsius = (celsius/10.00);
/*convert integer value to ASCII string */
sprintf(Temperature,"%d%cC ",(int)celsius,0xdf);
LCD_String_xy(1,0,Temperature); /* send string data for
printing */
MSdelay(1000);
memset(Temperature,0,10
08. FEATURES
09. CONCLUSION
A simple but useful project called temperature and light sensor using Arduino is
designed and developed here. Using this project, the proper control over temperature
can be obtained and controlled.