PIC Lesson: HR202 Humidity Sensor

January 10th, 2013  Posted at   Lesson PIC

HR202 adalah salah satu Humidity Sensor. Di bawah adalah gambar HR202 humidity sensor dengan keluarannya digital dan analog.

HR202 Humidity Sensor

HR202 Humidity Sensor Ex

Sensor ini disambungkan 5V, GND, digital signal dan analog signal.

Berikut adalah videonya.

PIC Source Code

11 Responses to “PIC Lesson: HR202 Humidity Sensor”

  1. Razzi says:

    Salam, saudara shahrul,saya ade membuat satu projek untuk temperature dgn humidity mgunakan pic16f877a, component yg sama utk humidity (HR202). Saya telah membuat coding sendiri dan terdapat kesilapan dalam coding saya. Saya minta jasa baik tuan untuk memeriksa coding saya. Saya mggunakan humidity sensor kat a01(kaki no 3|) dan temp sensor kat a02(kaki no 4). Saya meminta jasa baik en shahrul untuk memeriksa, disebabkan bahagian temperature telah siap,tetapi tidak boleh di sekalikan dengan bahagian humidity. Koding :

    // Lcd pinout settings
    sbit LCD_RS at RB0_bit;
    sbit LCD_EN at RB1_bit;
    sbit LCD_D4 at RB2_bit;
    sbit LCD_D5 at RB3_bit;
    sbit LCD_D6 at RB4_bit;
    sbit LCD_D7 at RB5_bit;

    // Pin direction
    sbit LCD_RS_Direction at TRISB0_bit;
    sbit LCD_EN_Direction at TRISB1_bit;
    sbit LCD_D4_Direction at TRISB2_bit;
    sbit LCD_D5_Direction at TRISB3_bit;
    sbit LCD_D6_Direction at TRISB4_bit;
    sbit LCD_D7_Direction at TRISB5_bit;

    unsigned int adc;
    char k[14];
    char l[14];
    char loop1;
    char loop2;
    char loop3;
    char loop4;
    int adc2;
    int adc1;

    void main()
    {
    ADCON1 = 0x80; // Configure analog inputs and Vref
    TRISA = 0xFF; // PORTA is input
    TRISD=0;PORTD=0;
    Lcd_Init();
    Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off
    Lcd_Out(1,1, “HUMIDITY & TEMP”);
    Lcd_Out(2,1, “MONITORING”);
    delay_ms(2000);
    Lcd_Cmd(_LCD_CLEAR);

    Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off
    Lcd_Out(1,1, “TEMP:”);
    Lcd_Out(2,1, “RS:”);
    Lcd_Out(2,6, “%”);
    delay_ms(500);

    PORTD=0B00000000;

    while(1)
    {
    l2:
    PORTD=0B00000000;
    adc = Adc_Read(2);
    adc2 = 0.49*adc;
    IntToStr(adc2,k);
    lcd_out(1,6,k);
    goto l7;
    }

    while(1)
    {
    l7:
    if(adc2>27&&adc231)
    {
    Lcd_Out(2,1, “Temp:”);
    PORTD=0B00001010;
    delay_ms(60000);
    PORTD=0B00001010;
    delay_ms(3500);

    }

    while(1)
    {
    l3:
    PORTD=0B00000000;
    adc = Adc_Read(1);
    adc1 = 4.888*adc;
    IntToStr(adc1,k);
    lcd_out(2,4,k);
    goto l8;
    }
    while(1)
    {
    l8:
    if(adc2>80)
    {
    Lcd_Out(2,1, “RS:”);
    PORTD=0B00001000;
    delay_ms(60000);
    PORTD=0B00001000;
    delay_ms(3500);
    goto l7;
    }

    }
    }
    }

  2. Mohamed Khadar says:

    Slm. T. Kaseh. Abng, sila boleh tolong “code”, MBLAP COde, for this project. sy tak tahu PM, tapi sikit lah. :) sila tolong, T. Kaseh

  3. mono says:

    Salam nk tnye, boleh ke nk convert analog result yg keluar kpd bacaan RH% ?

  4. aishah says:

    sekadar bertanya. tq

  5. aishah says:

    encik,mcm mana ye nk bc ADC tu, sy xpndai coding..

  6. aishah says:

    encik,mcm mana nk sambungkan sensor ni pd pic dan code dia?

  7. Khairul says:

    Salam En.Shahrulnizam… berapa harga Temperature & humidity sensor ini ? dan boleh kah sy beli dgn En.Shahrul?

Leave a Reply

What is 15 + 7 ?
Please leave these two fields as-is:
IMPORTANT! To be able to proceed, you need to solve the following simple math (so we know that you are a human) :-)