Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Neeed some help with dual PIR sensor circuit

Status
Not open for further replies.

whiteangel

New Member
I want to put some LED light strips to light up stairs going into the basement. The LEDs need to automatically turn on when they sense motion. For this I am planning to use two PIR motion sensors. One sensor will be placed at the top of the stairs and the other at the bottom. The sensor I want to use is the HC-SR501
**broken link removed**

The circuit will remain lit as long there there is motion within the range at least one sensor. It will turn off the lights when both sensors detect no motion for 30 seconds. The PIR sensor can be adjusted from 5 sec to 300 sec.

I am new to electronics and this is my first project. Please check the circuit below and give your suggestions if this will be sufficient. The only problem I have with this circuit is that the SPST relay needs at least 6V input to activate, but the PIR sensor only outputs 3.3V. I would be grateful if someone can suggest how to best bump up the voltage to at least 6V to activate the relay. Secondly, I'm not sure if I need to add a fuse somewhere.

**broken link removed**
 
hi,
This circuit would be one option, switching the 12V side to the lights and using the +12V to power the 6V relay via a resistor.
What is the specification of the relay.?? ie: coil resistance and contact rating

E
 

Attachments

  • pir2.jpg
    pir2.jpg
    43.1 KB · Views: 1,527
The LED strip needs a 2A supply. The 12V adapter shown is rated at 1A :arghh:
It will turn off the lights when both sensors detect no motion for 30 seconds.
Neither circuit provides a 30s turn-off delay, but is that delay really necessary?
 
hi,
This circuit would be one option, switching the 12V side to the lights and using the +12V to power the 6V relay via a resistor.
What is the specification of the relay.?? ie: coil resistance and contact rating

E
I'm not sure about the specification of the relay. I was hoping someone could shed some light on what type of relay would be appropriate. Also I'm not sure if 3.3V is sufficient to power the relay, because most of the relays I have come across need a minimum of 6V.

alec_t
The delay is built into the PIR sensor itself, it can be adjusted by turning the orange knob on the sensor, so I don't need to put it in the circuit. The delay is necessary because if someone passes by the first sensor, he will be out of range and the sensor will stop sending 3.3V to the relay which will turn the lights off, hence the time delay.

Your right about the adapter, I need to get a 2amp one.
 
Do you know the spec/current draw of the PIR sensors? You may be able to power those from the 12V adapter via a suitable dropper/regulator and avoid the need for two adapters.
 
Do you have a test meter that can measure Ohms.? Does the relay have any text printed on it, like type etc.?

I prefer to have the relay contacts switching the 'low' voltage side of the 12Vdc adapter, which needs to be of a higher current rating to suit the lights.
 
Do you know the spec/current draw of the PIR sensors? You may be able to power those from the 12V adapter via a suitable dropper/regulator and avoid the need for two adapters.

The PIR sensor has a working voltage range between 4.5V to 20V. It might be possible to run the entire setup off one adapter but I'm not sure how I would implement that. I have a few adapters lying around, so I thought I might as well put them to use.

Eric
Why would you prefer switching the low voltage side?
I do have a multimeter for testing purpose. I haven't really purchased any of the stuff as yet. I want to get the circuit right first before I buy the stuff. I'm still not sure what the specification of the relay should be and whether it would be possible for the relay to work with 3.3V input
 
Eric
Why would you prefer switching the low voltage side?
I do have a multimeter for testing purpose. I haven't really purchased any of the stuff as yet. I want to get the circuit right first before I buy the stuff. I'm still not sure what the specification of the relay should be and whether it would be possible for the relay to work with 3.3V input

Switching the 12Vdc side would mean the relay contacts would not be carrying the 220Vac mains and the risk of electric shock hazard would be minimised.
You could get a 3.3V relay, but the problem maybe the PIR outs cannot supply sufficient current to energise the relay coil.
Do you have a datasheet for the PIR's.?

If you have a 12Vdc 2.5A mains adaptor power supply, I would suggest a 12V relay, controlled by a low power transistor [ as per my original diagram]
Power everything from the 12Vdc adaptor.
E
 
Attached is some information.
It looks like the HC-SR501 can work with supply voltages from 4.5 to 20 volts so it and the LEDs can live on the same 12V supply.
On page 5 there are pictures of the HC-SR501 driving a transistor that turns on/off something. The pictures are not good but it looks like the HC-SR501 is built to drive the base of a transistor that will drive (LEDs or relay).
 

Attachments

  • HC-SR501.pdf
    99.5 KB · Views: 1,168
hi Ron,
Many thanks for the pdf, it looks as though a transistorised relay drive will be required.
E
 
I don't see the need for a relay. I think a power Darlington like a TIP120 should drive the 2A LEDs. The base current will need to be above 2mA.

With out more research, I don't know the output current of the 501, just the output voltage of 0 and 3.3V.

2A LEDs.... really wow that is a great amount of light. The 12V supply is only 1A and the LEDs are 2A. There is a problem.
 
.... or instead of a power Darlington (which would probably need a heatsink) perhaps a power FET with a non-inverting level-shifter to drive its gate at ~12V (the 3.3V might not turn the FET on fully, even if it were a logic-level type).
 
Thanks to everyone for their feedback. From what I have understood, I would be better off running everything off a 12V (2.5 amp) adapter. Take a look at the reworked circuit and tell me what you think.
**broken link removed**
Regarding the PIR sensor, the specs are as follows.

HC-SR501 Human Sensor Module Pyroelectric Infrared
Sensitive Setting: turn to right, distance increases (About 7M); turn to left, distance reduce (About 3M)
Time Setting: turn to right, time increases (About 300S); turn to left, time reduce (About 5S).

Description:

  • Color: White + Green
  • Dimension: 3.2cm x 2.4cm x 1.8cm (approx)
  • Infrared sensor with control circuit board
  • The sensitivity and holding time can be adjusted
  • Working Voltage Range: DC 4.5V- 20V
  • Current drain:<60uA
  • Voltage Output: High/Low level signal:3.3V TTL output
  • Detection distance: 3--7M(can be adjusted)
  • Detection range: <140°
  • Delay time: 5-200S(can be adjusted, default 5s +-3%)
  • Blockade time: 2.5 S (default)
  • Trigger: L: Non-repeatable trigger H: Repeat Trigger (default)
  • Work temperature:-20-+80°C
  • Trigger Method: L unrepeatable trigger / H repeatable trigger

I found a relay that might be suitable. This one is DPDT. Would an SPST relay with the same specs be appropriate for my project?

Nominal Operate Power 100-230mW
Arrangement 2 Form c
Switching Voltage 2VDC
Switching Current 170mA
Carrying Current 10A
Coil voltage 3 VDC
Ambient Temperature -40 to +85 °C
SafetyStandard UL,CSA,IEC
Note/Option Single coil latch type
 
Last edited:
hi
The datasheet for the PIR suggests/indicates that the PIR output cannot drive a relay directly.
Voltage Output: High/Low level signal:3.3V TTL output

Your relay requires ~70mA at 3V = 230mW.

You need an intermediate transistor/FET to drive a relay or a power transistor.
 
hi
The datasheet for the PIR suggests/indicates that the PIR output cannot drive a relay directly.
Voltage Output: High/Low level signal:3.3V TTL output

Your relay requires ~70mA at 3V = 230mW.

You need an intermediate transistor/FET to drive a relay or a power transistor.

Ok so here's the updated circuit. What do you think?

**broken link removed**
 
hi,
Thats looking better, I would reduce the R1 [ 1k] to around 330/390 Ohms
With a 1k you have only approx 2mA of Base current and assuming a transistor gain of 10 to 20 the transistor will not be hard ON.
BTW: Checking on the internet, one poster has stated that the 3.3V output current max is only 10mA

Its very important you add a parallel diode on the relay coil, this is to protect the transistor from the back emf from the coil when it switches OFF.
A 1N400x series diode would be OK, look at my original diagram to show the connection.

As a point, you may find that when the light is OFF the 12Vdc from the adaptor may rise in value, I would quickly check it to ensure that it stays below 20Vdc.

E

EDIT: I would use a 12Vdc relay, with a 5Amp DC contact rating.
 
Last edited:
Hi Eric

I don't get why the diode needs to be in parallel with the relay coil to protect the transistor from EMF. Can the diode not be placed right after the transistor to prevent the backflow of current to the transistor.

I am also not clear about what type of transistor I need in the circuit. Could you please share the specs. Also the diodes after the PIR, can you please tell me what their specs need to be.

Secondly why would the voltage rise to 20 V after the light turns off and how do I keep it in check?
 
Hi Eric

I don't get why the diode needs to be in parallel with the relay coil to protect the transistor from EMF. Can the diode not be placed right after the transistor to prevent the backflow of current to the transistor.
When the transistor switches OFF, the inductance of the coil generates an EMF on the collector that can be higher than the specified maximum Vce rating of the transistor and can cause it to fail. The diode conducts when the collector voltage exceeds the 12V + the diode voltage drop, so it clamps the collector voltage to approx +12.7V.

I am also not clear about what type of transistor I need in the circuit. Could you please share the specs. Also the diodes after the PIR, can you please tell me what their specs need to be.
I would choose a general purpose transistor like the 2N2222.
I would use 1N914 or 1N4148 low cost signal diodes


Secondly why would the voltage rise to 20 V after the light turns off and how do I keep it in check?
Some low cost adaptors will not hold their regulated Voutput when they have a low current load.
If you found for example the off load voltage was too high you could add a fixed resistor load that draws 10 to 20mA. Some users would fit a a resistor and LED to draw the fixed current, it also would show when the unit is powered


hi,
Hope this covers your questions.
E
 
Thanks you have been very helpful. I've revised the circuit and I guess I am good to go. Regarding the off voltage, I'll look into it and if I see a spike then I'll implement the fix you suggested.

**broken link removed**
 
The top end of the relay coil needs to be connected to the +12V rail.
Note that two DC current values are specified for a relay: the switching current and the carry current. It is the switching current value which needs to be >2A (e.g. 5A as Eric suggested).
The diodes can be almost any general-purpose silicon type, e.g. 1N914 (as shown), 1N4148, 1N400x .....
The 2N2222 transistor is fine. Other general-purpose silicon NPN types with a current rating >> the relay coil current would also be ok.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top