PIC Project: Temperature Control


PIC Temperature Control

Temperature Control adalah projek untuk mengawal suhu persekitaran seperti dalam sebuah bilik. Menggunakan sensor suhu LM35 untuk membaca suhu persekitaran. Sekiranya suhu panas melebihi suhu yang disetkan, kipas akan berpusing untuk menyejukkan persekitaran. Sekiranya suhu sejuk, kipas akan berhenti berpusing. Projek ini boleh disetkan had suhu dan kelajuan kipas.

Skematiknya adalah seperti berikut.

Schematic Temperature Control

PCB komponen layout nya adalah seperti berikut.

PCB Temperature Control

Senarai komponen projek PIC Temperature Control seperti berikut.
No Component Label Unit
1 031 PCB PIC LCD Monitoring (100mm X 88mm) PCB 1
2 031 PCB PIC LCD Monitoring (100mm X 88mm) PCB 1
3 Capacitor Ceramic 0.1uF C5 1
4 Capacitor Electrolytic 10uF C1-C2 2
5 DC Bulb 12V 1.5W OUT_1-OUT_4 2
6 DC Fan 12V 0.3A 80mmx80mm OUT_1-OUT_4 2
7 DC Jack Female DC Jack Female 1
8 Diode 1N4001 D1 1
9 IC PIC16F1939 DIP PIC16F1939 1
10 IC Socket 40pin PIC16F1939 1
11 LCD 20X4 LCD 1
12 Mosfet IRF540 TO220 Q2-Q5 4
13 PCB Connector Header (Right) 3 Ways IN_1 1
14 PCB Connector Housing 3 Ways IN_1 1
15 PCB Stand (screw nut) PCB Stand 6
16 Push Button 4 pin 6x6x1 PB1-PB4 4
17 Resistor 0.25W 1K R18-R21 4
18 Resistor 0.25W 1K R12-R15 4
19 Resistor 0.25W 1K/4.7K R4 1
20 Resistor 0.25W 330 R1 1
21 Right Angle Pin Header (Male) ICSP 1
22 Sensor LM35 IN_1 1
23 Slide Switch S1 1
24 Terminal Block 2 Way OUT_1-OUT_4 4
25 Terminal Block 2 Way PWR 1
26 Terminal Pin IN_1 3
27 Transistor 2N2222 Q1 1
28 Voltage Regulator 5V TO220 7805 1

Harga projek PIC Temperature Control adalah RM580 tidak termasuk bantuan teknikal. Di bawah adalah cara projek ini berfungsi.


45 responses to “PIC Project: Temperature Control”

  1. saya ada beli temp sensor dari cytron..LM35..tp bru je smbung power dah panas..ikut data sheet dah..kalau tgok kat comment bwh page tu ada jgk org komen masalah sama..agak2 kenapa ek??

  2. saya ada satu program dalam bentuk .hex.
    bolehkah saya menggunakan MPLAB untuk terus memprogramkan PIC saya tanpa guna fail .ASM.
    minta tolong jelaskan ye..saya baru lagi dalam bidang ni.kalau tidak boleh,software apa patut saya gunakan

    • Kena ikut port apa yg digunakan. Pada .hex file, x boleh baca program, x tahu apa2 port apa yg digunakan, jenis PIC, jenis Crystal kecuali ia diberitahu oleh pemiliknya. Menggunakan .hex file bukan pilihan bijak, lebih baik buatkan program sendiri.

  3. ya memang betul..hex file hanya ada angka sahaja.terima kasih atas keterangan tersebut.ianya sangat2 membantu.teruskan usaha2 mendidik anda.

  4. regarding on above issue,how can i convert the .hex file to .asm file.can you clarify this thing.or is it any method or software that i can use.

  5. sya de wt prjek cmni..tpi nk interface ngn pc….da cbe link ngn hypertermnal…bru dpat display perkataan je….pe command ntuk display temperature value kt hypertmnal…..cnthnye klu hntar perkataan sya gna uart_str….klu value dri sensor cmne,pe command yg perlu?

  6. sya da try wt..tp pas build error cmni…de pe2 initialization kne tmbh kew?

    Build C:\Users\shawnzazas\Desktop\ImPoRtAnT\zas for device 16F877A
    Using driver C:\Program Files\HI-TECH Software\PICC\9.70\bin\picc.exe

    Make: The target “C:\Users\shawnzazas\Desktop\ImPoRtAnT\nak.p1” is out of date.
    Executing: “C:\Program Files\HI-TECH Software\PICC\9.70\bin\picc.exe” –pass1 C:\Users\shawnzazas\Desktop\ImPoRtAnT\nak.c -q –chip=16F877A -P –runtime=default –opt=default -D__DEBUG=1 -g –asmlist “–errformat=Error [%n] %f; %l.%c %s” “–msgformat=Advisory[%n] %s” “–warnformat=Warning [%n] %f; %l.%c %s”
    Executing: “C:\Program Files\HI-TECH Software\PICC\9.70\bin\picc.exe” -ozas.cof -mzas.map –summary=default –output=default nak.p1 –chip=16F877A -P –runtime=default –opt=default -D__DEBUG=1 -g –asmlist “–errformat=Error [%n] %f; %l.%c %s” “–msgformat=Advisory[%n] %s” “–warnformat=Warning [%n] %f; %l.%c %s”
    (1273) Omniscient Code Generation not available in Lite mode (warning)
    HI-TECH C Compiler for PIC10/12/16 MCUs (Lite Mode) V9.70
    Copyright (C) 2009 Microchip Technology Inc.
    Error [499] ; 0. undefined symbol:
    _uart_char(zas.obj)

    ********** Build failed! **********

  7. ni sye pnye code…..de x pe2 yg kne ubh??

    #include
    #include
    #define _XTAL_FREQ 20000000

    __CONFIG (0x3F22);

    unsigned char uart_rec(void); //receive uart value
    void uart_send(unsigned char data);
    void uart_str(const char *s);
    void uart_char(char number);
    void delay(unsigned long data); //delay function, the delay time
    unsigned char read_ad(unsigned char channel);
    char di[10];
    void convert(int no, char base);

    void main ()
    {
    unsigned char temp;
    int value,i;
    //set I/O input output
    TRISA = 0b00000000;
    TRISB = 0b00000011;

    ADCON0=0b10000001; //enable ADC converter module
    ADCON1=0b01000000;

    //Configure UART
    SPBRG=129; //set baud rate as 9600 baud
    BRGH=1; //baud rate high speed option
    TXEN=1; //enable transmission
    TX9 =0; //8-bit transmission
    RX9 =0; //8-bit reception
    CREN=1; //enable reception
    SPEN=1; //enable serial port

    uart_str(” ADC LESSON “); //display string
    uart_send(10);
    uart_send(13);
    uart_send(10);
    uart_send(13); //select second line
    uart_str(” VOLTAGE: . V “); //display string

    temp=read_ad(0);
    convert(4*temp,10);
    uart_char(di[3]);
    for(i=2;i>=0;i–) uart_char(di[i]);

    convert(temp,2);
    for(i=9;i>=0;i–) uart_char(di[i]);

    convert(temp,10);
    for(i=3;i>=0;i–) uart_char(di[i]);

    }

    unsigned char uart_rec(void) //receive uart value
    {
    unsigned char rec_data;
    while(RCIF==0); //wait for data
    rec_data = RCREG;
    return rec_data; //return the data received
    }

    void uart_send(unsigned char data)
    {
    while(TXIF==0); //only send the new data after
    TXREG=data; //the previous data finish sent
    }

    void uart_char(char number)
    {
    while(TXIF==0); //only send the new data after
    TXREG=number; //the previous data finish sent
    }

    void uart_str(const char *s)
    {
    while(*s)uart_send(*s++);
    }

    void delay(unsigned long data) //delay function, the delay time
    { //depend on the given value
    for( ;data>0;data–);
    }

    unsigned char read_ad(unsigned char channel) //fucntion read analog input according to the given channel
    {
    unsigned char result; //declare a variable call result
    switch(channel)
    {
    case 0: //if channel = 0
    CHS2=0; //CHS2=0
    CHS1=0; //CHS1=0
    CHS0=0; //CHS0=0
    break;
    }
    ADGO=1; //start ADC convertion
    while(ADGO); //wait for ADC convertion to complete
    result=ADRESH; //read the result
    return result; //return the result
    }

    void convert(int no, char base)
    {char i;
    for(i=0;i<=9;i++) di[i]=0;
    i=0;
    do{
    di[i]=no%base;
    no=no/base;
    i=i+1;}
    while(no!=0);
    }

  8. saya da dpt cmne nk intrfce…..cmne plk kte nk msukkkan rmus dlam program jka rmus kte ade prpluhan?Cnthnye sye pnye code

    send_num(temp);

    so ble sya msuk rmus jdi cmni

    send_num((temp*0.67)-50);

    tpi error cmni, de pe2 kne tmbh kew??

    Warning [356] C:\Users\shawnzazas\Desktop\MeNu\All about FYP2\save mplab\res.c; 95.24 implicit conversion of float to integer

  9. salam bolh tak email kn sy detail-detail tentang projek nie???komponen yang perlu..kos yang di gunakan dalam projek nie…?prosedure dan bagaimana projek ini berfungsi dan detail-detail yang lain…sekian terima kasih..

  10. Can i get the assembly coding of ur project?
    I am currently doing a project that almost the same with yours.
    So may I have your coding for reference?

  11. salam..kami ada membeli projek temp. control ni kt abg shahrul.. tp projek ade troubleshoot skit.. lcd ade display.. tp x leh msuk menu.. ape solution dye ye..

Leave a Reply

Your email address will not be published. Required fields are marked *