A simple circuit to trigger relay for 30 seconds  - Page 1
Forum section: electronics / beginners

author: sairfan1
author_rank: Frequent Contributor
timestamp: September 13, 2018, 07:57:02 pm
content: I have been deveoped some small projects using mcu, but this time i want a low cost wihtout mcu solution with this thought it will help me to learn electronics. as I'm not good in totally electronics based solution so need help.I have a 12v 0.6A relay to lock a door, when i press a button it will activate the relay for 30 seconds and then it will release the relay again. I would like to have pot to increase or decrease little bit of time.I have a little idea that i would need some transistors to turn relay on probabally BD series, some diaod and may be capacitor to hold relay for some time, some other approach could be using 555 timer.Please advise whatever apprache you think is bettter.thanking you,

author: SeanB
author_rank: Super Contributor
timestamp: September 13, 2018, 08:06:45 pm
content: 30s is fine, just you will be using an electrolytic capacitor for timing, and thus it will be less than accurate. Otherwise a CMOS NAND gate as oscillator and a ripple counter, with the other 2 NAND gates making a RS flip flop, will do this well.

author: drussell
author_rank: Super Contributor
timestamp: September 13, 2018, 08:23:30 pm
content: This is one of the classic use cases for a 555 timer.That would be my suggestion for the most straightforward solution.

author: JS
author_rank: Frequent Contributor
timestamp: September 13, 2018, 10:13:37 pm
content: I'd porbably use an 8 pin uC... Sorry.JS

author: sairfan1
author_rank: Frequent Contributor
timestamp: September 13, 2018, 10:23:37 pm
content: why your praference would be uC, to save time? i believe using capacitor charge will be lowest cast but not sure how reliable it would be.

author: JS
author_rank: Frequent Contributor
timestamp: September 14, 2018, 02:17:40 am
content: uC, potentiomenter to set the time, one resistor, 2n3904, relay, switch. That's the parts count, add a PS of your convinience, whatever between 3.3V and 5V will do no problem, likely wider range. And you have the HW solved for good. Then you can tweak the design in code after the PCB is settled, the HW is settled and you still have flexibility if you messed in something. 30s is fine for a 555, but if you now need a 5H timer? Grab the uC project and change one parameter in the code or start from ground up because the 555 isn't practicall anymore?Don't get me wrong, I like analog design much more than digital, but there are times it doesn't make sense, a switch with a timer, something a DIP 8 uC with minimal external parts can do perfectly and much more flexible than the alternative seems better to me. Having a simple PCB with that hardware seems very useful to have in the drawer, it can solve many many problems using slightly different codes. If you leave space in the PCB for an optocoupler to add safe external control even more, and it will cost about the same than the 555 if not less.Some may have troubles programming the uC in which case the 555 could make sense but doesn't seem to be your case.JS

author: sairfan1
author_rank: Frequent Contributor
timestamp: September 14, 2018, 02:51:04 pm
content: @JS i agree with you, i can keep things simple by using uC, but as i said i have been worked a lot with uC based project, just wanted to do it without uC so that i get better understanding to pure electronics based solutions.

author: Zero999
author_rank: Super Contributor
timestamp: September 14, 2018, 03:23:31 pm
content: I'd use a MOSFET to switch the load, rather than a BJT.You want old school? How about a plain monostable multivibrator but made with a BJT and a MOSFET?To change the delay, vary R1. With it set to 2M, the delay will be 31s. To make it adjustable replace it with a 1M5 resistor, in series with a 1M potentiometer or a 1M8 resistor and a 470k pot. if just a bit of trimming is required.

author: Jwillis
author_rank: Super Contributor
timestamp: September 14, 2018, 07:07:50 pm
content: I haven't tested this yet but I think it should work.You'll have to experiment with the transistor and base resistor.I made a guess on that. The solenoid can be omitted and the transistor can used as the switch instead.Should be a couple hundred milliamps at pin 3 available.You can also use a Mosfet like a BUZ 11 instead if you like,just omit the base resistor.If there are mistakes made I'm sure someone will point them out.

author: KMoffett
author_rank: Regular Contributor
timestamp: September 14, 2018, 07:38:23 pm
content: I've used simple MOSFET/relay monostables.Ken

author: sairfan1
author_rank: Frequent Contributor
timestamp: September 14, 2018, 09:43:02 pm
content: thanks a lot, that would be great help for a lay man@Hero999 I was trying to understand circuit, what is transitor Q1 doingthanks

author: Zero999
author_rank: Super Contributor
timestamp: September 14, 2018, 10:18:26 pm
content: Quote from: Jwillis on September 14, 2018, 07:07:50 pmThat will work, but it's an astable circuit, which will switch the relay/load on and off periodically. I'm not sure if that's what the original poster wants, which I believe is a monostable or one shot, i.e. push a button, the relay turns on for a certain length of time, then off again.If can easily be modified for monostable operation.EDIT 1: I've just realised something: 4700μF is far too larger capacitor for the 555 timer. The energy stored in it can easily blow up the discharge pin, when the transistor turns on! Reduce the capacitor value to 470μF and increase the timing resistor value to compensate!EDIT 2: The 4700μF capacitor is only an issue in my monostable circuit. It's no problem in your astable circuit, as it discharges via a resistor.Quote from: KMoffett on September 14, 2018, 07:38:23 pmYes, that will work, just beware that it might shorten the life of the relay contacts a little, as they will not snap so sharply on, as the MOSFET will turn on very slowly, but it shouldn't be a problem if it's driving a solenoid directly. The time delay will also be heavily dependant on both the supply voltage and the MOSFET'd threshold, although that's a non-issue if the supply is tightly regulated and a potentiometer is used for the timing resistor.Also note, as drawn the MOSFET will turn on, when power is initially applied. If this is undesired, the capacitor could be moved in parallel with R1.You also might ask, why build the more complex circuit I posted, over the simpler one you posted? The advantages are: the delay is more predictable, less dependant on the supply voltage and completely independent of the MOSFET threshold voltage and the MOSFET turns on/off much faster. The delay also starts the moment the button is pressed, rather than released and has no bearing on hold long the button is held for, which might not be an advantage, just different. On the other hand it uses far more components, so could be considered to be overkill.

author: drussell
author_rank: Super Contributor
timestamp: September 14, 2018, 11:00:39 pm
content: Quote from: Hero999 on September 14, 2018, 10:18:26 pmIf the discharge current would be too high on a very-long duration set-up with a large capacitor, couldn't you put a low-value resistor between the capacitor and the discharge pin?I suppose I should look up the internal diagram of the 555 and re-acquaint myself with the circuitry, perhaps that won't work.

author: alsetalokin4017
author_rank: Super Contributor
timestamp: September 14, 2018, 11:43:15 pm
content: reasonable timing cap and resistor values can be chosen for 30 seconds on-timetrimpot can be used for timing resistor to provide adjustabilityIRF3205 works fine without heatsink for reasonable loads, probably would not need relay at all in OP's application

author: tpowell1830
author_rank: Frequent Contributor
timestamp: September 15, 2018, 02:29:44 am
content: Quote from: sairfan1 on September 13, 2018, 07:57:02 pmHow about a time delay relay?https://www.grainger.com/product/5WML9?cm_mmc=PPC:+Google+PLA&s_kwcid=AL!2966!3!166591437759!!!g!81032003277!&ef_id=WndOVQAAAeEQiKRE:20180915023141:s&gclid=CjwKCAjwuO3cBRAyEiwAzOxKsudbn6D80FcSmPijKLBuVOM6wKUg4OA_i7uHnkohev6O68Y2zop9MhoCq7YQAvD_BwE

author: vk6zgo
author_rank: Super Contributor
timestamp: September 15, 2018, 03:21:53 am
content: A big, fat electrolytic capacitor in parallel with the relay coil may do this job, although 30 seconds could be a bit long to achieve with readily available electrolytics.Of course, this also has a very short operate delay as well, which probably wouldn't be much ofa problem in your application.This was a widely used method of obtaining a delay back in the day.It is always a good idea to look at the K.I.S.S method before getting too deep into complex alternatives.

author: Richard Crowley
author_rank: Super Contributor
timestamp: September 15, 2018, 05:48:17 am
content: Consider:CD4541BYou may find this video helpful:https://youtu.be/DeMuNXZ5jLc

author: iMo
author_rank: Super Contributor
timestamp: September 15, 2018, 09:59:33 am
content: As a child I built the above 555 timer (set to around 5 secs) switching on a melody door-bell, with an interesting option - the whole stuffdid not draw any currentwhen idle.The 555 was not started by the "trigger Push Button" (in the above schematics) but a it was powered ON by a Push Buttonwired in parallel to the relay contacts(normally off).When the PB was pushed down momentarily, it shorted the relay contacts (normally off) and the 555 got powered, 555 switched the relay on, the relay's contacts shorted the PB, it started to count (555 wired as a monostable with T=5secs) and after 5 secs the 555 switched the relay off. That removed the power off the 555 and the whole system went idle and did not draw any current.

author: drussell
author_rank: Super Contributor
timestamp: September 15, 2018, 12:37:41 pm
content: Quote from: imo on September 15, 2018, 09:59:33 amThat is a perfectly cromulent way of doing a circuit for that particular application.

author: Zero999
author_rank: Super Contributor
timestamp: September 15, 2018, 12:50:52 pm
content: Quote from: drussell on September 14, 2018, 11:00:39 pmIt's only a problem for the monostable circuit. In the astable circuit, the capacitor is discharged via a resistor anyway. Post edited.Yes, a series resistor will help to reduce the power dissipation in the 555, but it's easier just to use a smaller capacitor and larger timing resistor.

author: sairfan1
author_rank: Frequent Contributor
timestamp: September 15, 2018, 03:14:44 pm
content: @Hero999 I want to know what is the roll of Q1 transistor in your circuit, thanks.

author: Zero999
author_rank: Super Contributor
timestamp: September 15, 2018, 09:08:35 pm
content: Quote from: sairfan1 on September 15, 2018, 03:14:44 pmPositive feedback.When power is first applied, C1 charges via the load, R5, D1 and Q1's base. R1 now keeps Q1 on, which holds M1's gate near 0V, via R3. The circuit will remain in this stable state until S1 is activated.When S1 is closed, it connects M1's gate to +V, turning it on. C1's positive plate is connected to 0V, via M1's drain, which now sits at 0V. C1's negative plate now sits at the power supply voltage, minus two voltage drops, below the negative rail, which will be around -11V, with a 12V supply. Q1 will be off because no current will be flowing through its base. With Q1 off, M1's gate will be held at +12V, via R2 and R3. The circuit will remain in this state, until Q1's base starts conducting. C1 will charge via R1. When the voltage on C1 reaches two diode drops above 0V, about 1V, Q1's base will start to conduct, which will turn it on. As Q1 turns on, it will connect M1's gate to 0V, thus turning it off. When M1 turns off, Q1 will start to turn on even more, this turning M1 off more, hence positive feedback. When M1 is off, C1 will charge via D1 and R5 again, returning the circuit back to the initial state.Because the current through Q1's base and D1 is so low, one diode drop can be considered to be 0.5V, rather than the usual 0.6V, hence why two diode drops is said to be 1V.If the power supply voltage is below 6V or so, D1 is not needed, as it protects Q1's base from negative voltages. The tiny leakage current through D1 will do no harm to Q1's base.If the load current is under 50mA or so, then R5 is not needed, as it protects Q1's base from the current spike when C1 charges, via the load.The circuit is fairly insensitive to supply voltage changes, because the threshold when the cycle ends is two diode drops which is small compared to the supply voltage. The single MOSFET circuit is much more sensitive because the MOSFET threshold, is much higher. The latching action of this circuit means the MOSFET turns on and off relatively quickly, compared to charging/discharging a huge capacitor via a large resistor, connected to the gate.The Wikipedia article describes a similar circuit, quite well. If you have any questions or want more schematics or drawings, just ask.https://en.wikipedia.org/wiki/Monostable