Switching PIR Sensor with MOSFET

Discussion in 'Analog & Mixed-Signal Design' started by Sam Matthews, May 8, 2016.

  1. Sam Matthews

    Thread Starter Member

    Jan 16, 2016
    178
    3
    I'm currently trying to have a PIR motion sensor (HC-SR501, Datasheet) connected to a microcontroller being able to be switched on and off to save power consumption in busy areas. I propose to have the sensor on throughout the night and off in the day, this will stop the power consumption going through the roof when its not needed to know if there is any motion detected.

    MotionSchematic.jpg

    I have setup the above on a breadboard and i observe the following;
    1. While the gate is pulled low (GND), the sensor is alternating between a HIGH and LOW output, false triggering.
    2. While the gate is pulled high (5V), the sensor is not responding at all, as expected when using an N-Channel MOSFET configuration.

    I am speaking to someone who claims that using a P-Channel MOSFET in a low side configuration is working for him, and he prefers to use a Low Side Switching P-Channel design over a High Side Switching N-Channel design.

    I'm finding it very very hard to get my hands on a P-Channel logic level MOSFET in the UK for a small purchase. I can get them from places such as Farnell but there is a handling fee unless i spend over £20, which i think i have no choice to do.
     
  2. ericgibbs

    AAC Fanatic!

    Jan 29, 2010
    2,504
    380
  3. Sam Matthews

    Thread Starter Member

    Jan 16, 2016
    178
    3
    I'm assuming that by a light/dark detector you mean a light sensor to detect the right level of light, and once it drops below a certain LUX level, switch the motion on?

    If this is what you are referring to, i do have a ambient light sensor on board of this module, however i would still need some way to switch the motion sensor through the micro controller, i have a few other features that i wish the micro controller to handle such as alarm mode and house monitor mode.

    Thank you for the recommendation for the two suppliers, i will give them a look into now :)
     
  4. ericgibbs

    AAC Fanatic!

    Jan 29, 2010
    2,504
    380
  5. Sam Matthews

    Thread Starter Member

    Jan 16, 2016
    178
    3
    You are correct indeed.

    It still activates the PIR sensor when it detects motion therefor drawing current.

    If you mean the GND line of the whole sensor module then that is what i was initially attempting to do, but if you was referring to the OUTPUT line as 0v (low when no motion) then i have answered above.
     
  6. ericgibbs

    AAC Fanatic!

    Jan 29, 2010
    2,504
    380
    hi,
    Consider what level or state of the PIR output will be if the 0V is disconnected, even with a 10K to 0v the PIR output will not be 0V, but it will be indeterminate, that's why it is switching up/down.
    E
     
  7. Sam Matthews

    Thread Starter Member

    Jan 16, 2016
    178
    3
    But if the current of the whole sensor is fluctuating because it is detecting motion then its drawing power just like it would be if the output is being activated high and read by the MCU. So i might as well just be reading the output pin throughout the day then. I just wait to switch the whole module on or off, is it not as simple as i thought?

    Have i just completely misunderstood your point here? I'm sorry if i have.
     
  8. ericgibbs

    AAC Fanatic!

    Jan 29, 2010
    2,504
    380
    hi,
    I have just built your circuit on a bread board, using my PIR module, as I have said, the PIR output is oscillating between ~ 5V and 1V at a approx a 2 second rate.
    You will get indeterminate operation of the PIR if the 0V is not connected to 0V

    E
     
  9. Sam Matthews

    Thread Starter Member

    Jan 16, 2016
    178
    3
    Okay, now i understand you. Yes i set it up just like you have done now. And do you not feel that the only way to solve this is to use a low side switching MOSFET. So therefor use a P-Channel MOSFET on the vcc line of the sensor, or are you telling me a different way that i'm struggling to understand?
     
  10. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    5,813
    1,105
    I'd just use a PNP transistor as a high-side switch for the PIR.
    PIR-switch.PNG
     
    EM Fields likes this.
  11. ericgibbs

    AAC Fanatic!

    Jan 29, 2010
    2,504
    380
    hi,
    Please post a datasheet or link for your PIR module, some of these modules are specified to switch high to only 3V when activated, even though they can be powered from 4.5v thru 20v.

    E
     
  12. Sam Matthews

    Thread Starter Member

    Jan 16, 2016
    178
    3
    @Alec_t - That is what i'm proposing. Thank you.

    The datasheet is in the original post.
     
  13. jkwilborn

    New Member

    Jan 26, 2016
    25
    4
    Did this get working somehow? Have you thought about just using the software to determine day/night. If night, then turn on the sensor on for a short amount of time, less than required to cross the area, then off.

    Also many of these PIR modules that I've seen do not just switch to some level they actually send out a pulse that has an adjustable length. I see nobody mentioning this.... Except a one sentence or something entry.

    I have a number of projects with power mosfets and I run the output line of the micro to the gate, no resister or anything. No other connections to the gate. This drives it properly in my devices, so far. My 328p drives the mosfet that switches over ten amps to an inductive heater, no problems.

    I have used them as in his suggested schematic (without the resistor (what's it for anyway?)). There is only ~5 mili ohms resistance when switched on. I've seen worse solder joints....

    Seems that Alex_t has a good simple solution... Unless you want to use mosfets?

    We'd like to hear how you solved it....???
     
Loading...