Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

PIR sensor pIC16f877 explanation pLEASE!!

Status
Not open for further replies.

delifadzli

Member level 2
Joined
Feb 5, 2010
Messages
50
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
malaysia
Activity points
1,774
PIR sensor pIC16f877

hi everyone , i want to ask on how to deal with PIR sensor...PIR sensor is basically a motion detector that detect motion...so in this case, i would like use that sensor to act as as input to my ceiling fan controller( using LM35 sensor)...

the problem is, this sensor only operate as the motion goes through. while in my project i would like to use it to detect the human that pass through the door which automatically turn on the entire ceiling fan controller....i wonder, as the human pass through the door like 5 meter away from the door...isn't the overall system will turn off? how to make it still operating??? i just want to turn it off (overall system) if the human leave the door/room....

easy to say, if someone entering the room overall system still on...if the someone leave the room the system will be off...

can anyone help me?
 

No, it will not work. for a PIR sensor to function correctly you need signal condisioning and amplification, thus I suggest you search for PIR circuit in google.

Then to detect a human, it depend how you want to go about doing that. You can make use of a comparator circuit or write a software alorithm for a microcontroller.
 

u use PIR from cytron??

i think if you want to let your system remain ON, it depend on your programing..
 

yup i bought it from cytron

i had done the programing....in C

can u check it for conformation..



Code:
#include <16F877A.H>
#device ADC=10
#fuses HS, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock = 20000000)


#include "C:\Users\deli\Documents\Google Talk Received Files\teng\brum\Flexlcd2.c"

//==========================

#define      LED1     PIN_D7
#define      LED2     PIN_D6
#define      LED3     PIN_D5
#define      LED4     PIN_D4

void main(void)
{
       int16 temp_adc,counter1;
       int temp, inout_counter=0,PIR1,PIR2,in,out;


        setup_adc(ADC_CLOCK_DIV_8);
        setup_adc_ports(PIN_A1);
        set_adc_channel(1); //read analog input from channel 1


        lcd_init();

         lcd_putc("\fTemperature:\n");

          while(1)


          {
	        PIR1=0;
          PIR2=0;
          in=0;
          out=0;
            temp_adc = read_adc();
            temp = 5.00*temp_adc*100.00/1023.00;
            lcd_gotoxy(1,2);
            printf(lcd_putc,"%d",temp);

          {//?


          PIR1 = input(PIN_B6);
          PIR2 = input(PIN_B7);

	  if(PIR1==1)
          {
            for(counter1=2000;counter1>0;counter1--)
            {
               PIR2 = input(PIN_B7);
               delay_ms(1);
               if(PIR2==1)
               in=1;
            }
            if(in==1)
            inout_counter++;
          }

          else if(PIR2==1)
          {
            for(counter1=2000;counter1>0;counter1--)
            {
               PIR1 = input(PIN_B6);
               delay_ms(1);
               if(PIR1==1)
               out=1;
            }
            if(out==1)
            inout_counter--;
          }

          if(inout_counter>0)
          {
            if((temp<20))
            {
            //delay_ms (500);
            output_high(LED1);
            }
            else
            {
            output_low(LED1);
            }

            if ((temp>= 20) && (temp_adc <30))
            {
            output_high(LED2);

            }
            else
            {
            output_low(LED2);
            }

            if ((temp_adc >= 30))
            {
            output_high(LED3);

            }
            else
            {

            output_low(LED3);
            }
         }
         else

         output_high(PIN_D4);
        }
        }

}


i will be using 2 PIR sensor...to check out for human detection
 

hak3..sory bro..

i hate c..im BASIC user. it is more easier to use..
 

Hi,

I would add a 30 second to 1min start up delay for the detector to stabilize. Then average samples can be used to create a profile of detection. Remember that depending from which side you approach the detector the signal will differ. Make sure you have added sufficient gain on the front end, because a proper profile cannot be created with a signal in the mV range. You can also add a pulse counter to avoid false triggering.

Hope this could make things easier.

MN
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top