Connect with us

interfacing pic16f877A with motion sensor

Discussion in 'Microcontrollers, Programming and IoT' started by orient, Aug 7, 2015.

Scroll to continue with content
  1. orient

    orient

    2
    0
    Aug 4, 2015
    I am working on a project that senses when a person enters a room, and then switch ON the light in the room and then switch it OFF when the person leaves.
    I want to use two PIR motion sensors, one outside the room and the other inside such that when the outside sensor is triggered before the inside sensor, then the microcontroller will switch ON the light and if the inside sensor is triggered before the outside sensor then the light will be switched OFF.
    I also want to count the number of persons that go into the room so that the light will only switch OFF when all the persons that entered the room has left.
    I am using two buttons to mimick the two sensors in proteus and I am using mikroC compiler.
    please I need help on the code that will perform this task. I'll be very grateful.
     
  2. jayanthd

    jayanthd

    43
    10
    Jul 4, 2015
    If you still need a code then I can provide you a full working code using mikroC Compiler. If would be good if you zip and post your mikroC project files and Proteus file.
     
  3. chopnhack

    chopnhack

    1,573
    354
    Apr 28, 2014
    An interesting project! What happens when you have more people passing the exterior than actually go into the room?
     
  4. jayanthd

    jayanthd

    43
    10
    Jul 4, 2015
    One sensor will be outside room and another inside room. So, when person goes into the room then outside sensor triggers first and inside sensor triggers next. So, only when both sensors are triggered the counter which is used to hold the value of persons entering or leaving the room is incremented or decremented. So, if only one sensor is triggered then the counter value doesn't change.

    This thing can happen, one person tries to enter the room and he triggers the outside sensor and before he enters the room a person from the room tries to get out of the room and triggers the inside sensor and this will increment the counter.
     
    chopnhack likes this.
  5. chopnhack

    chopnhack

    1,573
    354
    Apr 28, 2014
    Very astute! This would end up yielding false light on conditions, which could probably be taken care of with some programming to poll the interior PIR for heat and motion. If none found, lights out.
     
  6. orient

    orient

    2
    0
    Aug 4, 2015
    Thanks a lot Jayanthd for your wealth of knowledge. Your observation about false light on conditions is very correct. please I will be grateful if you can assist me in the code to take care of that limitation. I attached herewith the mikroC code I have written but have not been able to take care of the false light on condition and also the proteus file. thanks a lot. I look forward to seeing your reply.
     

    Attached Files:

Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-