Weird relay module driving - Page 1
Forum section: electronics / beginners

author: ReWoP
author_rank: Contributor
timestamp: January 04, 2019, 11:00:44 pm
content: Hi all, first i would like to say that i'm a electronics hobbyist with no formal education on this subject so please bare with meI have those ebay 5V relay module with 3 pins - VCC, GND and IN - and to latch the relay i just need to pull IN pin to ground.But the circuit that i intend to use to control it has a little quirk. I need to monitor a voltage source (about 9V) and i would like to drive the relay in the following manner:1-Ifthe voltage source = 0VThenrelayOFF2-Ifthe voltage source = 9VThenrelay stillOFF3-Ifthe voltage source drops from 9V to 0VThenrelayONThe voltage source always starts at 0V, after 'x' amount of time it jumps to 9V, after 'y' amount of time it goes back down to 0V and after 'z' amount of time the whole "system" resets and repeats again.I could use a microcontroller to implement this (like an Arduino) but i think its an overkill... I'm in the impression that this could be done with some transistor logic and also, maybe, with some OP AMP, but i can't get my head into it..Please help!Big thanks in advance!

author: soldar
author_rank: Super Contributor
timestamp: January 04, 2019, 11:19:37 pm
content: You want a falling edge (from 9 V to 0) to set a bistable? Then it stays set until when? It is never reset?

author: ReWoP
author_rank: Contributor
timestamp: January 04, 2019, 11:39:26 pm
content: Quote from: soldar on January 04, 2019, 11:19:37 pmThanks for the reply!The state should change (turn the relay ON) when the 9V is disconnected (voltage source is again 0V) and the relay should stay ON until reset (circuit voltage off then on).

author: soldar
author_rank: Super Contributor
timestamp: January 04, 2019, 11:55:21 pm
content: That should be easy to do with an R-S flip-flop latch which can easily be built with a couple NAND gates. When the circuit powers up it is reset and when the 9 volts disappear it is set.What voltage is the main circuit? The 9 volt will always be present when the main circuit powers up?

author: ReWoP
author_rank: Contributor
timestamp: January 05, 2019, 12:05:23 am
content: Quote from: soldar on January 04, 2019, 11:55:21 pmThe main circuit is 20v but since the relay is 5V ill use a step down converter to get the 5V to this "monitor circuit" and relay operation.When the circuit powers up the voltage source (the monitored voltage) is 0v.

author: pwlps
author_rank: Frequent Contributor
timestamp: January 05, 2019, 12:47:17 am
content: Maybe there is a simpler way but you can do it with two standard 74-family logic circuits: a 7474 D flip-flop with the clock input driven via a 7414 Schmitt inverter:http://www.ti.com/lit/ds/symlink/sn74hc74.pdfhttp://www.ti.com/lit/ds/symlink/sn74ahct1g14.pdfThe 7414 is needed to provide a fast enough clock edge (your 9V source won't necessary guarantee it, moreover it can have some oscillations when disconnecting). The D input of the 7474 should be connected to the supply voltage via a RC filter to guarantee that D stays low for a few microseconds during the circuit startup/reset when voltages can vary. The input of the 7414 inverter is driven by the 9V source via a voltage divider (to get 5V input), possibly adding a capacitor shunt to avoid any ringing when disconnecting if your 9V leads are long.

author: soldar
author_rank: Super Contributor
timestamp: January 05, 2019, 12:58:05 am
content: This circuit is a start. A flip flop made with two gates. The 100K resistor and 100 K capacitor keep the reset low during startup so the circuit initializes reset.The Set input will set the flip flop when driven low. If it is slow changing then it will need a schmit trigger.Since it starts low we need a differentiator so that S goes low with the transition and not the state of the 9 volts.I will try to complete it tomorrow. It is late here

author: pwlps
author_rank: Frequent Contributor
timestamp: January 05, 2019, 12:58:39 am
content: Quote from: soldar on January 04, 2019, 11:55:21 pmHe wants it to go on only when the voltage goes low a second time (not when it is low at startup) so I don't see yet how it could be made with a simple RS without edge-driven clock input. Interesting though...

author: soldar
author_rank: Super Contributor
timestamp: January 05, 2019, 01:01:09 am
content: Yes, it needs a differentiator (capacitor) and schmit trigger if slow moving.

author: pwlps
author_rank: Frequent Contributor
timestamp: January 05, 2019, 01:02:07 am
content: Quote from: soldar on January 05, 2019, 12:58:05 amah, I got it now, finally our solutions seem equivalent - but yours is sipmler I admit

author: soldar
author_rank: Super Contributor
timestamp: January 05, 2019, 01:05:18 am
content: Like this. You can use gates with schmitt trigger inputs to shape the input. Connect the 9 V through two gates.CD4093b - quad nand gate with Schmitt trigger inputshttp://www.ti.com/lit/ds/symlink/cd4093b.pdf

author: ReWoP
author_rank: Contributor
timestamp: January 05, 2019, 07:24:02 pm
content: Thanks you both for all the info!I don't thing than i have any nand gates IC, i thing ill have to order it and try that.But i found out that i have a over voltage and under voltage circuit board that operates a relay. I can program it to latch the relay if the monitored voltage is 0v, the problem with this board is that at startup the relay will latch because is 0v...Is there a way to turn on this board only after the 9v is present then the board will take care of the relay when it goes back to 0v.