Latch relay 2 by short pulse relay 1

Thread Starter

arishy

Joined Apr 26, 2014
93
I have a two relay module that activate on 0 volt. This is a 5 volt module.
I have 4 pins ( +5v,GND,IN1 and IN2) Also I have a "weird" 3 pin with a jumper ( JD-Vcc, Vcc, GND) Default is using jumper between 1 & 2. I have no clue for what they are used for.

All what I want is to latch Relay 2 when a short pulse ( Positive Pulse of 3 volt) applied to IN1 Relay 1

P.S. I believe I need to invert the triggering pulse to negative , but I do not know how.

Your help will be greatly appreciated.

tworelaymodule.jpg
 

ScottWang

Joined Aug 23, 2012
7,117
I have a two relay module that activate on 0 volt. This is a 5 volt module.
I have 4 pins ( +5v,GND,IN1 and IN2) Also I have a "weird" 3 pin with a jumper ( JD-Vcc, Vcc, GND) Default is using jumper between 1 & 2. I have no clue for what they are used for.
The detail of relay.
The circuit of relay.


If you want a real isolation condition then you can connect the JD-Vcc and GND to another +5V power supply.

All what I want is to latch Relay 2 when a short pulse ( Positive Pulse of 3 volt) applied to IN1 Relay 1
Why not Relay 2 for IN2 or Relay 1 for IN1?
And do you really meant "latch"?
I ask that because it will cause relay to keep the active state when the pulse is gone, if you really want the latch function then you can use CD4013 to reach it.

And how is the frequency(pulse width) of trigger pulse?

P.S. I believe I need to invert the triggering pulse to negative , but I do not know how.
When you make sure what you really want then we can do the next step to design the circuit.
 

Thread Starter

arishy

Joined Apr 26, 2014
93
Wow thanks I believe my case is a simple one. ......I think so !!!
The source of the trigger pulse is

HC-SR501 Motion PIR Sensor

In this youtube HC-SR501 Motion PIR Sensor

You will get the exact nature of the pulse; which I hope will answer your question.

The way I am connected "NOW" to the PIR is using Normal 5 volt relay connected to a lamp.
The circuit works for a certain time ( adjustable to 300 sec) then automatically switch off.

I want the lamp to be ON "after" the pulse is gone, hence the need to the latching.
a momentary switch will be used to switch the lamp off.
 

Thread Starter

arishy

Joined Apr 26, 2014
93
As you mentioned early, I will need CD4013 to make the Latching. In a way I am relieved because I tried very hard to make the two relay module latch on it's own and I failed miserably.

So, according to your circuit, which I really appreciate; I will use the relay I have as described above together with CD4013, push switch , two npn transistors, and a couple of resistors/capacitors.

The output of this circuit will feed the TWO relay module that is connected to the lamp. You are saying IN1 or IN2. My understanding of this, is If I connect the output to IN1 Relay 1, Relay 2 will be LATCHED and this is the one I will connect the Lamp to. Is that correct ???

As for the switch it will be used to unlatch relay 2 Please confirm my understanding
 

ScottWang

Joined Aug 23, 2012
7,117
The output of this circuit will feed the TWO relay module that is connected to the lamp. You are saying IN1 or IN2. My understanding of this, is If I connect the output to IN1 Relay 1, Relay 2 will be LATCHED and this is the one I will connect the Lamp to. Is that correct ???
In my circuit that the output of C open collector is connected to the IN1 or IN2 in your relay module and that is the input of photocoupler(the negative side of LED).

As for the switch it will be used to unlatch relay 2 Please confirm my understanding
Yes, normally we called it "Reset" key, when you press it then the RS pin(4, 10) of CD4013 will get a high level to reset the Q1(Q2) output to low and R3 will loss the current, so the Q2 bjt will be Turn OFF, and the LED of photocoupler also became floating and no current flows through.

If you want to use two sets to control the latch circuit then you can use another D type F-F of CD4013 and it is connects the same with the one which already drew.
 

Thread Starter

arishy

Joined Apr 26, 2014
93
Thank you again for your comments. As I mentioned before , once motion is detected in the room the PIR will trigger your circuit to activate Relay 2 and KEEP the LAMP on after the PIR is gone. The switch will switch off the Lamp ( for good night sleep....I hope)

Appreciate your support in this matter. I am off to get the parts......
 

Thread Starter

arishy

Joined Apr 26, 2014
93
I am back with your circuit set to go. Due to things I DID it is not working. So, IF you have the time AND the patience to debug the circuit that will great.

If not; it is ok and I will do it the very slow way.
 

ScottWang

Joined Aug 23, 2012
7,117
I am back with your circuit set to go. Due to things I DID it is not working. So, IF you have the time AND the patience to debug the circuit that will great.

If not; it is ok and I will do it the very slow way.
The first thing is that you have to try it independently and the output of Q2 connects a resistor and LED, you can try some combinations as :
1. 330Ω and 2V/10mA LED
2. 180Ω and 2V/20mA LED
3. 220Ω and 3V/10mA LED
4. 120Ω and 3V/20mA LED
The positive pin of LED connected to +5V.

After you build the circuit then you should do some measurement(power on) as the input and output of Q1 and Q2, the input and output of D flip-flop and post their voltages, the input of Q1 should be input 0V(Gnd) and 3.3V to try, if you don't have other method then you can use a 3 pins switch, the pin 2 connected to the input, pin 1, 3 connected to 3.3V and Gnd.
 

Tonyr1084

Joined Sep 24, 2015
6,599
So here's what I'm getting: You enter the room, the light comes on. Day or night. You hit the button to go to sleep, the light goes out. You toss or turn in your bed and your IR detects the motion and turns the light on again. Or the cat comes into the room. Or the dog. But if you set the sensitivity low enough you might not find yourself being disturbed in the night. But I'm guessing the circuit, once operating the way you want, is going to be waking you up in the night.

Sorry to be the one finding problems with the solution, but I think this needs to be considered within your design as well. False triggers.
 

Tonyr1084

Joined Sep 24, 2015
6,599
My setup: I have a light switch that also controls the ceiling fan. It has a remote as well. I can turn the lights on and off at the door and can dim the lights. Bedside is where I keep the remote. I can turn the lights on and off from there as well as dim the lights. You only need hot and ground at the switch box. I mention that because I had to add a ground circuit for my switch. My home was built in 1964 and they used interrupt method for lights. That means they only have two wires, to either connect the neutral or to open the circuit (on or off). Big pain in the behind. I also had to switch the neutral and hot in the ceiling fixture so that the hot was being switched, not the neutral. A bit of wiring but not difficult to do. Just be sure to turn the breaker off to that circuit before you start messing with house wiring. I've had my share of shocking moments.
 

Thread Starter

arishy

Joined Apr 26, 2014
93
Thank you so much for given me the approach. I did some preliminary measurements. And it seems I have to start from the first stage.
And since I do not understand your design ( Trigger signal is from the emitter !!!) I will concentrate on this part.
By that I will take measurement with no signal and emitter to the ground I will disconnect the collector to pin 3 of the CD4013.
The only change I did I used 5.5k instead of 4.7k ( I will not lose your friendship over 800 ohm... I hope !!! just kidding)
Here we go:
power supply 4.99 v
Base through 5.5k to 4.99 v
Collector 0.0 v when emitter is grounded. Transistor is cutoff.
Constant signal of 2.96 v (external battery) , Collector 2.99V and power supply reads zero ma's

If that's OK, I will keep going.....
 

ScottWang

Joined Aug 23, 2012
7,117
Thank you so much for given me the approach. I did some preliminary measurements. And it seems I have to start from the first stage.
And since I do not understand your design ( Trigger signal is from the emitter !!!) I will concentrate on this part.
The first stage is the voltage level converter(0r shifter).
Sorry, I just found out the problem is on the D(data, pin 5) input, it should be connected to the +5V, otherwise it will never get a high level input and the output will stay on low level forever.

The C2, R2 will produce a low to high pulse to clear the Q1 to low(0V) during the power up and then R2 back to the low level.

CD4013 Latch And Reset Circuit-02_ScottWang.png
 

Thread Starter

arishy

Joined Apr 26, 2014
93
If you agree on the first stage, let us move to the fun one.

First wiring:
Pin 6 to 11 GND
Data pin 5 to +5 Volt
Floating 2, 12, 13
Pin 14 +5 Volt
Pin 3 will be getting the pulse from Q1 collector to initiate something !! on pulse rise.
Pin 4 <<produce a low to high pulse to clear the Q1 to low(0V) during the power up and then R2 back to the low level.>>
And Finally Pin 1 is the output to Q2

I will test this part and leave the "Finnaly" Q2 part till I get your OK after doing the measurements

I will be back.....
 

ScottWang

Joined Aug 23, 2012
7,117
Pin 3 will be getting the pulse from Q1 collector to initiate something !! on pulse rise.
If the voltage level of this simple circuit still can't trigger the ck1(pin 3 of D F-F) then I have to design another one maybe a little complicated, I hope you can learn all the theories and then you can use them to the other application someday.
 

eetech00

Joined Jun 8, 2013
2,805
The first stage is the voltage level converter(0r shifter).
Sorry, I just found out the problem is on the D(data, pin 5) input, it should be connected to the +5V, otherwise it will never get a high level input and the output will stay on low level forever.

The C2, R2 will produce a low to high pulse to clear the Q1 to low(0V) during the power up and then R2 back to the low level.

View attachment 153158
I don't think C2 is needed if the junction of sw1/C1 is pulled down with 100k resistor.
A reset pulse will then occur thru the closed PB on power up.

eT
 

ScottWang

Joined Aug 23, 2012
7,117
I don't think C2 is needed if the junction of sw1/C1 is pulled down with 100k resistor.
A reset pulse will then occur thru the closed PB on power up.

eT
Yes, that will works.
If you want the function as you said then you have to push the Sw1 after power on and you need to use the switch with Push/Latch function as this, and it could be mess when you want to use the device and then you have to check the status of switch each times, because the status of switch could be ON or OFF, but I just used the Push Switch and no need to check the status of switch, you need to press it only when you need to do the reset function, otherwise you don't have to care about the switch.
 
Top