Shop OBEX P1 Docs P2 Docs Learn Events
PIR to Relay — Parallax Forums

PIR to Relay

halfblinddadohalfblinddado Posts: 59
edited 2009-07-08 18:20 in Accessories
Hello,

I am trying·to switch a relay from the output of the PIR sensor. It seems that the PIR output is not enough to drive a 5v relay.

I can switch the relay from the output of a basic stamp but I would like to do this with just electronics.

I tried using an NPN transistor and I can light an LED from the transistor based on the input from the PIR but I still can't get it to switch the relay?

As you can tell I am not a EE but I wondering if there is some simple circuit or IC I can use for this?

-Mike



▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"Everything is working so why do we pay him?"


"Nothing is working so why do we pay him?"

Comments

  • halfblinddadohalfblinddado Posts: 59
    edited 2009-06-07 15:20
    Hi SLRM,

    First let me thank you for your replys and posts. You have been very helpful to me in the past and I appreciate your contribution to the board. I read the link you suggested over and over yesterday as well as the links attached to it.

    I tried the schematic from your post before I posted this one but I have several questions.

    1. What transistors did you use.
    2. Are the second and third transistors necessary?
    3. How are the second and third transistors connected?

    Thanks,

    -Mike

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "Everything is working so why do we pay him?"


    "Nothing is working so why do we pay him?"
  • SRLMSRLM Posts: 5,045
    edited 2009-06-07 16:22
    1. Any general purpose PNP and NPN transistors will work. I think I used PN2222 and PN2907.
    2. I'd use both if you're going to drive a relay.
    3. The three circles are the connections. I left them unconnected to indicate that you could choose between which circuit you wanted (PIR ON - other OFF or PIR ON - other ON).
  • halfblinddadohalfblinddado Posts: 59
    edited 2009-06-08 03:20
    I replaced the transistor with an NP2222 and now it works fine!

    Thanks again for your help.

    -Mike

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "Everything is working so why do we pay him?"


    "Nothing is working so why do we pay him?"
  • halfblinddadohalfblinddado Posts: 59
    edited 2009-06-30 17:12
    It seems I spoke too soon.

    The problem I am having now is that sometimes the circuit works but most times the PIR goes into a loop and keeps triggering the relay.


    I have attached a schematic with boxes representing the PIR and the transmitter. I have found that when I disconnect the transmitter the PIR stops looping.

    Any Idea whats causing this?

    Thanks,

    Mike

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "Everything is working so why do we pay him?"


    "Nothing is working so why do we pay him?"
  • SRLMSRLM Posts: 5,045
    edited 2009-07-01 06:38
    You should have a diode in there to protect against kickback on the relay coil. That may be causing the PIR to reset. Have you tried starting up the PIR with absolutely no motion in it's operating environment?
  • halfblinddadohalfblinddado Posts: 59
    edited 2009-07-01 14:14
    I have tried no motion at all I even tried putting just the sensor in a toolbox to make sure and I still get the same behaviour. I have 2 PIR sensors and they behave the same.

    I put an ocilliscope on the output of the PIR and it is indeed looping at a regular interval.

    I will try the diode. Should it go between the relay trigger connections or the output/input of the relay?

    Thanks,

    Mike

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "Everything is working so why do we pay him?"


    "Nothing is working so why do we pay him?"
  • FranklinFranklin Posts: 4,747
    edited 2009-07-01 14:42
    You may have a problem with the power being drawn down to a point where things reset. Also be aware the PIR needs time to stabilize before using.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • halfblinddadohalfblinddado Posts: 59
    edited 2009-07-01 15:55
    I have made sure the PIR has time to stabilize. Once the PIR starts looping it will continue to do so until the power is removed.

    I thought the same about the power I checked it and there does not seem to be a problem.

    If I connect other circuits to the relay such as an led or a motor it seems to work fine.

    -Mike

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "Everything is working so why do we pay him?"


    "Nothing is working so why do we pay him?"
  • PrettybirdPrettybird Posts: 269
    edited 2009-07-01 15:57
    Depending on the relay size, I have also used a LED in series. Makes a good indicator turning on and off with the ground.
  • halfblinddadohalfblinddado Posts: 59
    edited 2009-07-08 18:20
    Ok I added the Diode and it works now. I have added a picture of the transmitter.

    Thanks for your help,

    -Mike

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "Everything is working so why do we pay him?"


    "Nothing is working so why do we pay him?"
    2032 x 1520 - 1M
Sign In or Register to comment.