How do I use PIR motion sensor to trigger 3v relay module?

Thread Starter

truwebs

Joined Apr 2, 2016
78
gentlemen,

it appears i have some shopping and homework to do on this project.

thanks for everything you have shared thus far. stay tuned for when i get back to this.

TRU
 

Thread Starter

truwebs

Joined Apr 2, 2016
78
Gentlemen,

Want to start for thanking you for your guidance. Have learned a lot in the time it has taken for my transistors and resistors to arrive.

Cost has driven me towards Allen's solution using the 2n2222 transistor voltage level shift. Do not have a schematic yet, but planning on working that into my to do list.

Currently have a level shifting circuit working somewhat. I have a 9v source for PIR and 5v source for the relay. But I have an odd behavior. The PIR is operating reverse as it should. In other words with NO motion the relay triggers. With motion the PIR deactivates the relay. Any ideas where I should look to solve this problem? I reversed the 2n2222 and that did not solve the problem . By the way I think I am using 1k resistors instead of what was in the schematic Allen provided as the voltage at the relay was coming in at 3.8 volts. Thinking the high voltage was causing the backwards behavior of PIR I started switching out resistors. Currently voltage coming in at relay is 3.2 volts.

So much smarter than yesterday.;)

Thanks,
TRU
 

Thread Starter

truwebs

Joined Apr 2, 2016
78
Hope this will bring more response to solve my problem. The level shifting is working but the behavior of the PIR is inverted. The PIR triggers relay with NO MOTION, but then deactivates relay with motion. So... what do I have A$$ Backwards?

PIR 3v relay_bb.png
 

ericgibbs

Joined Jan 29, 2010
18,865
hi tru.
That relay PCB is not the same as your original post.:rolleyes:
It appears to have a resistor driving a transistor/relay, so with the 2N2222 driving the onboard transistor/relay, you have an inverted operation.

Remove the 2N2222 and drive the relay directly from the PIR, also remove the 'horizontal' resistor, connected to +V and the 2N2222.

E

NOTE:
If the PIR is able to drive the relay PCB directly [ which it should be able to do] then you could power the whole project with just the 5v supply, drop the 9v battery.
 

Thread Starter

truwebs

Joined Apr 2, 2016
78
Eric,


yes you are correct as you see a different relay. it is there just for diagraming purposes as was not able to find my 3v in any fritzing libraries.

as you stated in earlier post " You need a voltage level shifter between the PIR out and Relay input in order to increase the signal from 3v to specified 5v." so that is what i have breadboarded. The 2n22222 was what i have at this time and recommemded by Allen.

So... Is it possible to correct this inverted signal with the 2n2222 and transistors?

TRU
 

ericgibbs

Joined Jan 29, 2010
18,865
So... Is it possible to correct this inverted signal with the 2n2222 and transistors?
hi tru,
Are you asking to correct/modify the posted circuit in order to use the 'fritz' relay module or the actual module you have on the bench.??

If I recap on what I believe you are trying to do:
Use a PIR 3Vout level to drive the original relay PCB, which has an Opto-isolator input driving a transistor, which in turn switches the relay coil.
That relay PCB requires a +5v signal level on the input in order to couple thru the opto to the onboard transistor.
The 3V out from the PIR is unable to fully drive the opto, so no relay operation.

In order to to raise the PIR +3Vout to a +5v, a level shifter is required, the problem is this will introduce a signal inversion, so when the PIR is inactive, the relay will be On.
To overcome this, my suggested circuit used two transistors, which corrected the signal inversion.

If you used the relay PCB module as shown in the 'fritz', it does not have an opto-coupler, just a transistor driving the relay.
This PCB would be suitable for a direct drive from the 3v PIR signal.

Eric

EDIT:
The circuit shown in post#20 is not suitable for your pre-built opto PCB, it would be OK for the 'fritz' relay PCB.

I use a similar circuit, which works OK.
 
Last edited:

Thread Starter

truwebs

Joined Apr 2, 2016
78
Eric,

It appears we are on the same path now. Yes I am using the 3v relay with opto. I am not using the relay in the fritzing diagram.

So....should I be able to do add another 2n2222 circuit to correct the inversion?

Tru
 

Thread Starter

truwebs

Joined Apr 2, 2016
78
Eric,

Can you send me links to the transistors you recommend? Can't recall but one I had a hard time finding.

Thanks from the newbie,
Tru
 

ericgibbs

Joined Jan 29, 2010
18,865
hi tru,
For your application, all you need is a general purpose NPN and a PNP transistor.
The 2N2222 will be OK for the NPN, so check the PNP's list for an available type, ref images.

Eric
 

Attachments

Thread Starter

truwebs

Joined Apr 2, 2016
78
Eric,

Thanks again. Transistor kit should arrive tomorrow. My circuitry inventory is growing at a rapid pace. :D

It's a shame I am having to jump through all these hoops to get what seemed to be a simple project of connecting a PIR to a pre-built 3v relay PCB. On the bright side though.. have been learning a lot and inventory is growing.

TRU
 

ericgibbs

Joined Jan 29, 2010
18,865
hi tru,
A simple option would have been a PIR > 470R resistor > 2N2222 driving a 5V relay with a 1N4001 diode across the coil.;)

Note: on your pre-built relay PCB it has jumper links, which can select the drive and onboard voltage sources.

E
 

ericgibbs

Joined Jan 29, 2010
18,865
hi,
I cannot see any lettering on the PCB for the two jumpers.
The eBay spec only says.
- Double power selection design anti-interference ability is strong, photoelectric isolation protection of high reliability
All I can suggest is that you connect the low voltage supplies to the PCB and PIR and try to determine the function of the two power jumpers..

Typically for correct isolation the PIR and signal input/power wiring would be opto-isolated from the relay 3v supply.

As the VCC, In and Gnd is a 3 Way connector block and the relay contacts are on their own connector block, I don't see how its possible to isolate the power grounds by using only 2 jumpers.?

E

EDIT:

This circuit is 'representative' of your PCB, not showing the two link jumpers.
I do not see how its possible to jumper for two separate ground connections.?????
 

Attachments

Last edited:

Thread Starter

truwebs

Joined Apr 2, 2016
78
If i recall correctly, those jumpers simply completed the connection of + and - from block to relay. With jumpers off, no power can get to relay. Will have to confim when i get back to my bench tonight. Their purpose has had me puzzled as well.

TRU
 

Thread Starter

truwebs

Joined Apr 2, 2016
78
Based on eric's analysis,

"Your relay PCB has a EL817 opto-coupler for the input signal, it requires a 5V drive voltage on the Input in order to drive the onboard transistor which controls the relay coil current.
With only a 3v drive from the PIR output, there is insufficient current to drive the opto and transistor."

Would it be possible to modify the original pcb to work properly without the level shifting circuit?

TRU
 

ericgibbs

Joined Jan 29, 2010
18,865
hi tru,
If you could identify the Base of the transistor which drives the relay, its possible to modify.
Let me know if you can locate the Base, it will have a surface mount resistor connected to it, let me know its value.
Eric
 

Thread Starter

truwebs

Joined Apr 2, 2016
78
Here is an image of the relay. Added labels just in case image does not come through clear. Looks like I forgot to lable the EL817 optocoupler

Excuse my ignorance and untrained eye.

It appears the 13Y transistor base (if that is the top pin on the 13Y) may make a connection to the top side of the M7 diode? At least that is how it appears on the topside of the PCB. Perhaps it makes it way back to the 101 resistor? Again, untrained (and weak) eyes.

Hope this is helpful.
TRU

relay_Top.jpg
 
Top