In an industry will have to use electronic circuit to run a machine.When the machine is used to operate in a very long time, the circuit will definitely heat. When the temperature is increased the circuit will be at risk of suffering damage or fire.Therefore to solve the problem,temperature sensor is designed to prevent and reduce the cost of maintenance.
Thursday, 17 May 2012
Sunday, 25 March 2012
HARDWARE
This project
will require following hardware:
a)
1
x PIC16F873A
b)
1
x PJT 11 Printed Circuit Board (PCB)
c)
1
x LCD
d)
1
x Buzzer
e)
2
x Temperature Sensor (LM35)
f)
Other
related electronic component
Interface PIC16F873A with Temperature
Sensor (LM35)
Signal pin
(Vout) from LM35 can be connected to either one of analog input pin (AN0-AN4)
except AN3 (pin 5) but make sure the ADC configuration is correct. In fact, pin
5 (Vref+)from PIC should be given for 1V but it may has offset, so a variable
resistor (VR1) was installed for voltage adjusting. For more stability, user is
recommended add a capasitor (104) between the analog signal and GND for every
analog input such as signal from LM35 and variable resistor (VR1).
Interface PIC16F873A with LCD
The 16
header pin should be soldered to the LCD first. The following table shows the
LCD (2X16 character) connection:
PIN
|
PIN NAME
|
FUNCTION
|
CONNECTION
|
1
|
VSS
|
Ground
|
GND
|
2
|
VCC
|
Positive
supply for LCD
|
5V
|
3
|
VEE
|
Contrast
adjust connected to a preset for contrast adjusting
|
|
4
|
RS
|
Select
register, select instruction or data register
|
RA2
|
5
|
R/W
|
Select
read or write
|
GND
|
6
|
E
|
Start
data read or write
|
RA5
|
7
|
DB0
|
Data bus
pin
|
RC0
|
8
|
DB1
|
Data bus
pin
|
RC1
|
9
|
DB2
|
Data bus
pin
|
RC2
|
10
|
DB3
|
Data bus
pin
|
RC3
|
11
|
DB4
|
Data bus
pin
|
RC4
|
12
|
DB5
|
Data bus
pin
|
RC5
|
13
|
DB6
|
Data bus
pin
|
RC6
|
14
|
DB7
|
Data bus
pin
|
RC7
|
15
|
LED+
|
Backlight
positive input
|
5V
|
16
|
LED-
|
Backlight
negative input
|
GND
|
TABLE 1
FEATURES
Power Transistor (BD135)
-BD135 is
used for controlling the DC brushless fan with sufficient current.
Temperature Sensor (LM35)
-In this
project, two LM35s are used for two difference temperature. Vs of the LM 35 are
given 5v and the Vout pins are
connected to AN0 and AN1 (PIC16F873A) separately.
PIC16F873A (Microcontroller)
This
powerful (200 nanosecond instruction execution) yet easy-to-program (only 35
single word instructions).CMOS FLASH-based 8-bit microcontroller packs
Microchip’s powerful PIC® architecture into an 28-pin package and is
upwards compatible with thePIC16C5X, PIC12CXXX and PIC16C7X devices. The
PICF873A features:
·
256
bytes of EEPROM data memory
·
Self
programming
·
An
ICD
·
2
Comparators
·
5
channels of 10-bit Analog-to-Digital (A/D)converter
·
2
capture/compare/PWM functions
·
The
synchronous serial port can be
configured as either 3-wire Serial Peripheral Interface(SPI™) or the 2-wire Inter- Integrated
Circuit (I²C™) bus
·
A
Universal Asynchronous Receiver Transmitter (UART)
All of these
features make it ideal for more advanced level A/D applications in automotive,
industrial, appliances and consumer applications.
Sunday, 18 March 2012
week 10 : OVERVIEW
This report
describes the development project (PJT11). This project will use PIC16F873A to
control NPN power transistor (BD135) further drive DC brushless fans, LEDs and
buzzer when the certain temperature was detected. The value of temperature always
displayed on a LCD screen. Circuit schematic and PIC source code will be
provided.
FEATURES
PIC controlled DC brushless fan, LEDs
and buzzer
-PIC16F873A with internal ADC read the analog voltage from LM35
(Temperature sensor) and display it
on LCD display.
BD135 power transistor
-Capable of driver DC brushless fan (0.12A)
Temperature sensor (LM35DZ)
-Sensor gain, 10mV/°C (average slope)
-0-100°C
-LCD display (always display the value of the temperature)
Fans, LEDs and buzzer are activated
when the certain temperature was detected.
Monday, 12 March 2012
week 8 :
GENERAL DESCRIPTION
PIC has been
used to control the LED or buzzer directly for some other projects. But in this
project, PIC cannot directly activate the DC brushless fan because it has not
enough current.NPN power transistor (BD135) is required, so that dc brushless
fan can be controlled by PIC.PIC16F873A will read the analog voltage (using
ADC) from LM35 temperature sensor and display it on LCD display. A buzzer, LEDs
or fans will be activated when temperature reach a certain temperature value.
For this project, temperature sensors (LM35) and cooling fans
are connected to the circuit board through some wires and connectors. The
length of the wires is various depend on the distance of certain where would be
measured. Each polarity should be correctly connected. Differentiate the of the
connector and please use 2510 connector for LM35 and 2532 connector for cooling
fan.
Thursday, 1 March 2012
week 7:
our pic program:
//==================inckude=================================
#include<pic.h>
//===============configuration==============================
__CONFIG (0x3F32);
//===============define IO port=============================
#define lcd PORTC
#define RS RA2
#define E RA5
#define CHANNEL0 0b10000001 // AN0
#define CHANNEL1 0b10001001 // AN1
#define buzzer RB5
#define fanA RB4
#define fanB RB3
#define ledA RB2
#define ledB RB1
//==============FUNCTION PTOTOTYPE=========================
void e_pulse(void);
void delay(unsigned short i);
void send_char(unsigned char data);
void send_config(unsigned char data);
void lcd_goto(unsigned char data);
void lcd_clr(void);
void dis_num(unsigned long data);
void increment(unsigned long data);
void read_adc(void);
unsigned short read_temp(void);
//====================MAIN================================
unsigned short result;
unsigned short temp,tempA,tempB;
void main(void)
{
ADRESH=0; //clear A/D result
ADRESL=0; //clear A/D result
//setting ADCON1 Register
ADCON1=0b11000101; // A/D result right justified,
// configure RA2 and RA5 as digital I/O
TRISA=0b11011011; //configure PORTA I/O direction
TRISB=0b00000000; //configure PORTB as output
TRISC=0b00000000; //configure PORTC as output
PORTA=0;
PORTB=0;
while(1)
{
send_config(0b00000001); //clear display at lcd
send_config(0b00000010); //Lcd Return to home
send_config(0b00000110); //entry mode-cursor increase 1
send_config(0b00001100); //diplay on, cursor off and cursor blink off
send_config(0b00111000); //function set
lcd_goto(0); //cursor start from beginning
//display character on LCD
send_char(' ');
send_char('T');
send_char('E');
send_char('M');
send_char('P');
send_char('.');
send_char('A');
send_char('=');
lcd_goto(20); //cursor go to 2nd line of the LCD
//display character on LCD
send_char(' ');
send_char('T');
send_char('E');
send_char('M');
send_char('P');
send_char('.');
send_char('B');
send_char('=');
while(1) //infinity loop
{
//sensor A
ADCON0=CHANNEL1; //CHANNEL1=0b10001001
lcd_goto(8);
read_adc();
temp=read_temp();
dis_num(temp/10);
send_char('.');
dis_num(temp%10);
send_char(0b11011111);
send_char('C');
send_char(' ');
send_char(' ');
tempA=temp;
//sensor B
ADCON0=CHANNEL0; //CHANNEL0=0b10000001
lcd_goto(28);
read_adc();
temp=read_temp();
dis_num(temp/10);
send_char('.');
dis_num(temp%10);
send_char(0b11011111);
send_char('C');
send_char(' ');
send_char(' ');
tempB=temp;
if((tempA>400)&&(tempB<350)) // *****************************************
{ // * LED A and Fan A activated only for *
ledA=1; // * temperature A greater than 40'C *
ledB=0; // * and temperature B less than 35'C *
fanA=1; // *****************************************
fanB=0;
buzzer=0;
}
else if((tempB>350)&&(tempA<400)) // *****************************************
{ // * LED B and Fan B activated only for *
ledA=0; // * temperature A less than 40'C and *
ledB=1; // * temperature B greater than 35'C *
fanA=0; // *****************************************
fanB=1;
buzzer=0;
}
else if((tempB>350)&&(tempA>400)) // *****************************************************
{ // * All LED A & LED B, Fan A & Fan B and Buzzer *
ledB=1; // * activated for temperature A greater than 40'C *
ledA=1; // * and temperature B greater than 35'C *
fanA=1; // *****************************************************
fanB=1;
buzzer=1;
}
else if((tempB<350)&&(tempA<400)) // *****************************************************
{ // * All LED A & LED B, Fan A & Fan B and Buzzer *
ledB=0; // * disactivated for temperature A less than 40'C *
ledA=0; // * and temperature B less than 35'C *
fanA=0; // *****************************************************
fanB=0;
buzzer=0;
}
delay(2000);
}
}
}
//==================subroutine LCD setting ==========================
void send_config(unsigned char data)
{
RS=0;
lcd=data;
delay(500);
e_pulse();
}
void e_pulse(void)
{
E=1;
delay(500);
E=0;
delay(500);
}
void send_char(unsigned char data)
{
RS=1;
lcd=data;
delay(500);
e_pulse();
}
void lcd_goto(unsigned char data)
{
if(data<16)
{
send_config(0x80+data);
}
else
{
data=data-20;
send_config(0xc0+data);
}
}
void lcd_clr(void)
{
RS=0;
send_config(0x01);
delay(600);
}
void dis_num(unsigned long data)
{
unsigned char hundred_thousand;
unsigned char ten_thousand;
unsigned char thousand;
unsigned char hundred;
unsigned char tenth;
hundred_thousand = data/100000;
data = data % 100000;
ten_thousand = data/10000;
data = data % 10000;
thousand = data / 1000;
data = data % 1000;
hundred = data / 100;
data = data % 100;
tenth = data / 10;
data = data % 10;
if(hundred_thousand>0)
{
send_char(hundred_thousand + 0x30); //0x30 added to become ASCII code
send_char(ten_thousand + 0x30);
send_char(thousand + 0x30);
send_char(hundred + 0x30);
send_char(tenth + 0x30);
send_char(data + 0x30);
}
else if(ten_thousand>0)
{
send_char(ten_thousand + 0x30); //0x30 added to become ASCII code
send_char(thousand + 0x30);
send_char(hundred + 0x30);
send_char(tenth + 0x30);
send_char(data + 0x30);
}
else if(thousand>0)
{
send_char(thousand + 0x30); //0x30 added to become ASCII code
send_char(hundred + 0x30);
send_char(tenth + 0x30);
send_char(data + 0x30);
}
else if(hundred>0)
{
send_char(hundred + 0x30); //0x30 added to become ASCII code
send_char(tenth + 0x30);
send_char(data + 0x30);
}
else if(tenth>0)
{
send_char(tenth + 0x30); //0x30 added to become ASCII code
send_char(data + 0x30);
}
else send_char(data + 0x30); //0x30 added to become ASCII code
}
void increment(unsigned long data)
{
unsigned short j;
for(j=10;j>0;j--)
{ lcd_goto(32);
data=data+1;
dis_num(data);
delay(10000);
}
}
//==================subroutine ADC=========================
void read_adc(void)
{
unsigned short i;
unsigned long result_temp=0;
for(i=2000;i>0;i-=1) //looping 2000 times for getting average value
{
ADGO = 1; //ADGO is the bit 2 of the ADCON0 register
while(ADGO==1); //ADC start, ADGO=0 after finish ADC progress
result=ADRESH;
result=result<<8; //shift to left for 8 bit
result=result|ADRESL; //10 bit result from ADC
result_temp+=result;
}
result = result_temp/2000; //getting average value
}
unsigned short read_temp(void)
{
unsigned short temp;
temp=result;
return temp;
}
//==================subroutine DELAY==========================
void delay(unsigned short i)
{
for(;i>0;i--);
}
our pic program:
//==================inckude=================================
#include<pic.h>
//===============configuration==============================
__CONFIG (0x3F32);
//===============define IO port=============================
#define lcd PORTC
#define RS RA2
#define E RA5
#define CHANNEL0 0b10000001 // AN0
#define CHANNEL1 0b10001001 // AN1
#define buzzer RB5
#define fanA RB4
#define fanB RB3
#define ledA RB2
#define ledB RB1
//==============FUNCTION PTOTOTYPE=========================
void e_pulse(void);
void delay(unsigned short i);
void send_char(unsigned char data);
void send_config(unsigned char data);
void lcd_goto(unsigned char data);
void lcd_clr(void);
void dis_num(unsigned long data);
void increment(unsigned long data);
void read_adc(void);
unsigned short read_temp(void);
//====================MAIN================================
unsigned short result;
unsigned short temp,tempA,tempB;
void main(void)
{
ADRESH=0; //clear A/D result
ADRESL=0; //clear A/D result
//setting ADCON1 Register
ADCON1=0b11000101; // A/D result right justified,
// configure RA2 and RA5 as digital I/O
TRISA=0b11011011; //configure PORTA I/O direction
TRISB=0b00000000; //configure PORTB as output
TRISC=0b00000000; //configure PORTC as output
PORTA=0;
PORTB=0;
while(1)
{
send_config(0b00000001); //clear display at lcd
send_config(0b00000010); //Lcd Return to home
send_config(0b00000110); //entry mode-cursor increase 1
send_config(0b00001100); //diplay on, cursor off and cursor blink off
send_config(0b00111000); //function set
lcd_goto(0); //cursor start from beginning
//display character on LCD
send_char(' ');
send_char('T');
send_char('E');
send_char('M');
send_char('P');
send_char('.');
send_char('A');
send_char('=');
lcd_goto(20); //cursor go to 2nd line of the LCD
//display character on LCD
send_char(' ');
send_char('T');
send_char('E');
send_char('M');
send_char('P');
send_char('.');
send_char('B');
send_char('=');
while(1) //infinity loop
{
//sensor A
ADCON0=CHANNEL1; //CHANNEL1=0b10001001
lcd_goto(8);
read_adc();
temp=read_temp();
dis_num(temp/10);
send_char('.');
dis_num(temp%10);
send_char(0b11011111);
send_char('C');
send_char(' ');
send_char(' ');
tempA=temp;
//sensor B
ADCON0=CHANNEL0; //CHANNEL0=0b10000001
lcd_goto(28);
read_adc();
temp=read_temp();
dis_num(temp/10);
send_char('.');
dis_num(temp%10);
send_char(0b11011111);
send_char('C');
send_char(' ');
send_char(' ');
tempB=temp;
if((tempA>400)&&(tempB<350)) // *****************************************
{ // * LED A and Fan A activated only for *
ledA=1; // * temperature A greater than 40'C *
ledB=0; // * and temperature B less than 35'C *
fanA=1; // *****************************************
fanB=0;
buzzer=0;
}
else if((tempB>350)&&(tempA<400)) // *****************************************
{ // * LED B and Fan B activated only for *
ledA=0; // * temperature A less than 40'C and *
ledB=1; // * temperature B greater than 35'C *
fanA=0; // *****************************************
fanB=1;
buzzer=0;
}
else if((tempB>350)&&(tempA>400)) // *****************************************************
{ // * All LED A & LED B, Fan A & Fan B and Buzzer *
ledB=1; // * activated for temperature A greater than 40'C *
ledA=1; // * and temperature B greater than 35'C *
fanA=1; // *****************************************************
fanB=1;
buzzer=1;
}
else if((tempB<350)&&(tempA<400)) // *****************************************************
{ // * All LED A & LED B, Fan A & Fan B and Buzzer *
ledB=0; // * disactivated for temperature A less than 40'C *
ledA=0; // * and temperature B less than 35'C *
fanA=0; // *****************************************************
fanB=0;
buzzer=0;
}
delay(2000);
}
}
}
//==================subroutine LCD setting ==========================
void send_config(unsigned char data)
{
RS=0;
lcd=data;
delay(500);
e_pulse();
}
void e_pulse(void)
{
E=1;
delay(500);
E=0;
delay(500);
}
void send_char(unsigned char data)
{
RS=1;
lcd=data;
delay(500);
e_pulse();
}
void lcd_goto(unsigned char data)
{
if(data<16)
{
send_config(0x80+data);
}
else
{
data=data-20;
send_config(0xc0+data);
}
}
void lcd_clr(void)
{
RS=0;
send_config(0x01);
delay(600);
}
void dis_num(unsigned long data)
{
unsigned char hundred_thousand;
unsigned char ten_thousand;
unsigned char thousand;
unsigned char hundred;
unsigned char tenth;
hundred_thousand = data/100000;
data = data % 100000;
ten_thousand = data/10000;
data = data % 10000;
thousand = data / 1000;
data = data % 1000;
hundred = data / 100;
data = data % 100;
tenth = data / 10;
data = data % 10;
if(hundred_thousand>0)
{
send_char(hundred_thousand + 0x30); //0x30 added to become ASCII code
send_char(ten_thousand + 0x30);
send_char(thousand + 0x30);
send_char(hundred + 0x30);
send_char(tenth + 0x30);
send_char(data + 0x30);
}
else if(ten_thousand>0)
{
send_char(ten_thousand + 0x30); //0x30 added to become ASCII code
send_char(thousand + 0x30);
send_char(hundred + 0x30);
send_char(tenth + 0x30);
send_char(data + 0x30);
}
else if(thousand>0)
{
send_char(thousand + 0x30); //0x30 added to become ASCII code
send_char(hundred + 0x30);
send_char(tenth + 0x30);
send_char(data + 0x30);
}
else if(hundred>0)
{
send_char(hundred + 0x30); //0x30 added to become ASCII code
send_char(tenth + 0x30);
send_char(data + 0x30);
}
else if(tenth>0)
{
send_char(tenth + 0x30); //0x30 added to become ASCII code
send_char(data + 0x30);
}
else send_char(data + 0x30); //0x30 added to become ASCII code
}
void increment(unsigned long data)
{
unsigned short j;
for(j=10;j>0;j--)
{ lcd_goto(32);
data=data+1;
dis_num(data);
delay(10000);
}
}
//==================subroutine ADC=========================
void read_adc(void)
{
unsigned short i;
unsigned long result_temp=0;
for(i=2000;i>0;i-=1) //looping 2000 times for getting average value
{
ADGO = 1; //ADGO is the bit 2 of the ADCON0 register
while(ADGO==1); //ADC start, ADGO=0 after finish ADC progress
result=ADRESH;
result=result<<8; //shift to left for 8 bit
result=result|ADRESL; //10 bit result from ADC
result_temp+=result;
}
result = result_temp/2000; //getting average value
}
unsigned short read_temp(void)
{
unsigned short temp;
temp=result;
return temp;
}
//==================subroutine DELAY==========================
void delay(unsigned short i)
{
for(;i>0;i--);
}
Monday, 20 February 2012
week 6 :
Our Objective : Save energy by setting the temperature heat or cool. Temperature controller designed to provide on/off control of heating and cooling. A thermostat is a device for regulating the temperature of a system so that the system's temperature is maintained near a desired set point temperature. A thermostat may be a control unit for a heating or cooling system or a component part of a heater or air conditioner. The output of the sensor then controls the heating or cooling apparatus.
Our Objective : Save energy by setting the temperature heat or cool. Temperature controller designed to provide on/off control of heating and cooling. A thermostat is a device for regulating the temperature of a system so that the system's temperature is maintained near a desired set point temperature. A thermostat may be a control unit for a heating or cooling system or a component part of a heater or air conditioner. The output of the sensor then controls the heating or cooling apparatus.
Tuesday, 14 February 2012
fifth week : Today, we had been to Jalan Pasar to buy the components. We didn't manage to buy some components. There's a few things that is out of stock and some are not available. We are planning to buy it later on. The component that are not available are :-
1) IC PIC16F873 or PIC16F876 (with program) - 1 pcs
2)BD135 - 2 pcs
3)X-TAL 20m - 1 pcs
COMPONENT USED :-
REG 7805
resistor
IN 4148
X-TAL 20M
preset
on/off switch
LCD 16x2
IC base 28 pin
switch 4 pin
PCB temperature control system
BD 135
diagram PIC16F873
sensor LM 35
schematic diagram
COMPONENT USED :-
REG 7805
IN 4148
X-TAL 20M
preset
on/off switch
IC base 28 pin
switch 4 pin
PCB temperature control system
BD 135
diagram PIC16F873
sensor LM 35
schematic diagram
*we do some study to understand each of the component and circuit arrangement.
*the circuit diagram is important to understand the circuit operation before we do the simulation.
*we also still in process on simulation in order to understand the output from this device.So that's all we're doing in this week.
Tuesday, 7 February 2012
fourth week : holidays again...hehe...tuesday i will be back to beloved BMI..a new day has come...Three weeks had passed and we have took our fyp project up to one more level.This week we will have our third session with madam Fatin Liyana to discuss about the some unavailable components. till here for now. Catch us up later and thanks for everything..:)
Wednesday, 1 February 2012
Introduction (our TEMPERATURE SENSING)
First of all I would like to thank to our advisor madam Fatin Liyana because she is willing to be our advisor for Fyp project.
The title for my fyp project is"Temperature Sensing".Let me introduce you all to my partner.She is Intan Shakila Jaafar.We do this project together and before this (last semester) we had done the report and proposal for this project in engineering design. So. it will become easier to do it.I hope so..huhu.
first week: after the first briefing on 19/01/2012, we asked to update the profile in RPS website and and announced the use of the blog to replace the logbook system previously used. Then I take back my logbook last semester from sir MANG.
second week: we met our advisor,madam Fatin Liyana to discuss about the project and my progress and we also attend to the second briefing on the next thursday. Deputy dean give us advice and spirit to do well and great for our fyp project.
third week: nothing much to do..we met our advisor and ask her opinion about the circuit. we plan to retouch a little bit on the circuit. maybe the IC. But still in the discussion with my partner.
The title for my fyp project is"Temperature Sensing".Let me introduce you all to my partner.She is Intan Shakila Jaafar.We do this project together and before this (last semester) we had done the report and proposal for this project in engineering design. So. it will become easier to do it.I hope so..huhu.
first week: after the first briefing on 19/01/2012, we asked to update the profile in RPS website and and announced the use of the blog to replace the logbook system previously used. Then I take back my logbook last semester from sir MANG.
second week: we met our advisor,madam Fatin Liyana to discuss about the project and my progress and we also attend to the second briefing on the next thursday. Deputy dean give us advice and spirit to do well and great for our fyp project.
third week: nothing much to do..we met our advisor and ask her opinion about the circuit. we plan to retouch a little bit on the circuit. maybe the IC. But still in the discussion with my partner.
Subscribe to:
Posts (Atom)