Thursday, 8 November 2012

PRESENTATION DAY


For the presentation day, we should have poster and full complete project.



Friday, 2 November 2012


TOUCH UP PART FOR PRESENTATION


To show strategic place for the components to present and easy to explain , I use Clear Acrylic Sheet. Lastly I wrap up it with black tape.




Friday, 26 October 2012

FULL COMPLETE PART PIC.

When on the supply, both led will on and display  "electric turbocharge" at LCD.



After delay, LCD display value of humidity on the left and temp on the right. For on and off the supply use cut off switch. Both led will ofF and will on until reach the value that have been set >40% humidity and temp >40'c.



Friday, 19 October 2012

PIC RESULT (HARDWARE 2)

To focus on my target to use this project motorcycle, I use the sk40c board. Why I use this board because simple to modify, compact , and tough suitable for my target.


sk40c


 LCD joint cable























Friday, 5 October 2012

PIC (HARDWARE)


This project first try at the straight board,using power supply converter to convert 240v ac to 12v dc.Soldering all the components and the tough part is to solder LCD port.All the components is from my previous project and that mean is not effect my budget for this project. The circuit is function but the problem is to big and not suitable for motorcycle user.The compiler is from CYTRON product USB ICSP PIC Programmer V2010 from my friend.




Testing PIC circuit.









Friday, 28 September 2012

C LANGUAGE PIC

#include<pic.h>//includePICmicrocontrollerlibrary

//configuration//==========================================================================
__CONFIG(0x3F32);//PICmicrocontrollerconfiguration

//define//==========================================================================
#define rs RB4//RSpinofLCDdisplay
#define e RB5//EpinoftheLCDdisplay
#define lcd_data PORTD//LCDdisplaydataPORT(8-bit)
#define led1 RB7//led1(activehigh)
#define led2 RB6//led2(activehigh)

void delay(unsigned long data);
void send_config(unsigned char data);
void send_char(unsigned char data);
void lcd_goto(unsigned char data);
void lcd_clr(void);
void send_string(const char *s);
void send_num(unsigned short data);
unsigned char usart_rec(void);
void beep_short(void);
void beep_short2(void);
void beep_long(void);
unsigned char read_ad(unsigned char channel);

void main(void)
    {
        //assignvariable
        unsigned char temp,temp1,jwp,jwp1;//declareatemporaryvariableforreadingADC
        unsigned char mode;//declareavariabletorepresentcurrentmode

        //setI/Oinputoutput
        TRISB=0b00000011;//configurePORTBI/Odirection
        TRISA=0b11011011;//configurePORTAI/Odirection
        TRISD=0b00000000;//configurePORTCI/O
       
               //configure lcd
    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);            //display on, cursor off and cursor blink off
    send_config(0b00111000);
               
        //configure
            ADCON0=0b10000001;//enableADCconvertermodule
            ADCON1=0b01000100;//configureADCandANxpin
               
        //initialcondition


    lcd_goto(0);                        //set the lcd cursor to location 0
    send_string("    ELECTRIC    ");        //display "Cytron Tech."
    lcd_goto(20);                        //set the lcd cursor to location 20
    send_string("  TURBOCHARGE");                //display "SK40C"
    delay(100000);
    delay(100000);
             led1=0;//onled1
            led2=0;//offled2
    lcd_clr();
    while(1)//infinityloop
               
    {
    mula:
    lcd_goto(0);//setlcdcursortolocation0
    send_string("HumidityHeatSen ");//display"HumiditySensor"
    temp=read_ad(0);//readAN1(HumiditySensor)
    jwp1= (temp*100)/255;
    temp1=read_ad(1);//readAN1(HumiditySensor)
    jwp=temp1/2;
    lcd_goto(20);//setlcdcursortolocation20
    send_num(jwp1);//displaytheanalogvalueofthegassensor
    lcd_goto(25);//setlcdcursortolocation20
    send_string("%");        //display "Cytron Tech."
    lcd_goto(28);//setlcdcursortolocation20
    send_num(jwp);//displaytheanalogvalueofthegassensor
    lcd_goto(33);//setlcdcursortolocation20
    send_string("C");        //display "Cytron Tech."
   
    if (temp>93 && temp1>100)
    {
    led2=1;
    led1=1;
    goto mula;
    }
    else if (temp1>100)
    {
    led1=1;
    goto mula;
    }
    else if (temp>93)
    {
    led2=1;
    goto mula;
    }

    else
    {   
    led1=0;
    led2=0;
    }
    }
    }
//functions//==========================================================================

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

void send_config(unsigned char data)    //send lcd configuration
{
    rs=0;                                //set lcd to configuration mode
    lcd_data=data;                        //lcd data port = data
    e=1;                                //pulse e to confirm the data
    delay(50);
    e=0;
    delay(50);
}

void send_char(unsigned char data)        //send lcd character
{
     rs=1;                                //set lcd to display mode
    lcd_data=data;                        //lcd data port = data
    e=1;                                //pulse e to confirm the data
    delay(10);
    e=0;
    delay(10);
}
   
void lcd_goto(unsigned char data)        //set the location of the lcd cursor
{                                        //if the given value is (0-15) the
     if(data<16)                            //cursor will be at the upper line
    {                                    //if the given value is (20-35) the
         send_config(0x80+data);            //cursor will be at the lower line
    }                                    //location of the lcd cursor(2X16):
    else                                // -----------------------------------------------------
    {                                    // | |00|01|02|03|04|05|06|07|08|09|10|11|12|13|14|15| |
         data=data-20;                    // | |20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35| |
        send_config(0xc0+data);            // -----------------------------------------------------   
    }
}


void lcd_clr(void)                        //clear the lcd
{
     send_config(0x01);
    delay(600);   
}

void send_string(const char *s)            //send a string to display in the lcd
{         
      while (s && *s)send_char (*s++);
}

    void send_num(unsigned short data)//functiontodisplayavalueonlcddisplay
{
    unsigned char tenthou,thou,hund,tenth;
    tenthou=data/10000;//gettenthousandvalue
    data=data%10000;
    thou=data/1000;//getthousandvalue
    data=data%1000;
    hund=data/100;//gethundredvalue
    data=data%100;
    tenth=data/10;//gettenthvalue
    data=data%10;//getunitvalue
   
   
    send_char(0x30+tenthou);//displaythetenthousandvalue
    send_char(0x30+thou);//displaythethousandvalue
    send_char(0x30+hund);//displaythehundredvalue
    send_char(0x30+tenth);//displaythetenthvalue
    send_char(0x30+data);//displaytheunitvalue
   
    }
   
        unsigned char read_ad(unsigned char channel)//fucntionreadanaloginputaccordingtothegivenchannel
    {
   
        unsigned char result;//declareavariablecallresult
        switch(channel)
        {
        case 0://if
       
    ADCON0 = 0b10000001;
       
        break;
        case 1://ifchannel=1
       
            ADCON0 = 0b10001001;
       
        break;
       
        }
        GO=1;//startADCconvertion
        while(GO);//waitforADCconvertiontocomplete
        result=ADRESH;//readtheresult
        return result;//returntheresult
       
        }
THE RESULT PIC (SOFTWARE)


Firstly, it will show "ELECTRIC TURBOCHARGE",  then it will delay and after that show the result below;









The sensor is setting according to datasheet. When the output is 2.5V is the result humidity 45% and temp is 40'c.When data is reach the value that we set, the led is on. Led red is for temp and yellow is for humidity.