Variable Timer for relay switching

Thread Starter

Buzzer25

Joined Apr 3, 2012
15
Hi,

I am trying to design a circuit that will switch a relay on/off repeatedly after a time period that the user can choose. I want to make the time periods variable depending on what the user wants e.g. 2 minutes on, 5 minutes off and repeating. Any suggestions?
 

AlbertHall

Joined Jun 4, 2014
12,619
Do you want the times to be set by twiddling a knob (analogue) or to be set digitally, perhaps in seconds, 120, 121, 122...
The first is relatively easy, the second is much harder.
 

Thread Starter

Buzzer25

Joined Apr 3, 2012
15
Hi Albert, I have tried doing this is a 555 already and it was not accurate enough. I think having to use such a large capacitor and the tolerances on parts made it difficult to get working. With my 2 mins on, 5 mins off i was getting anywhere between 20 seconds to 10 minutes on and even worse for the off time. I would like to be able to take this from a few seconds up to around an hour. I was thinking about a 32.768kHz crystal with 4060 but I am getting stuck on the logic side of things.
 

AlbertHall

Joined Jun 4, 2014
12,619
The problem with using the crystal is how do you set times from 2 seconds to 3600 seconds?
Using a small microcontroller with a display and a couple of buttons would make the hardware fairly simple, but the software needs writing - easy for an experienced person, but getting more difficult as experience is less.
 

Thread Starter

Buzzer25

Joined Apr 3, 2012
15
I dont really have much experience in terms of software writing. I was thinking about using either dip switches or headers and a range of AND gate or even 4020 (or similar) to try and divide down the time but the more I think about it, the confused I am getting myself.
 

AlbertHall

Joined Jun 4, 2014
12,619
If you had 4 cascaded '4017 counters with a 1Hz clock that would count up to 9999 seconds. The '4017 is a decade counter and has ten output pins, so for a count of 4, the '4' pin is high and so on. You could then use a 4 input AND gate to look for '0', '3', '0', '0' indicating 300 seconds or 5 minutes. You would need to duplicate this for ON/OFF time. This would eliminate the need to convert the desired time into binary when setting the time.
 

crutschow

Joined Mar 14, 2008
38,325
So you could use the 32.768kHz crystal with a '4060 to give you a 2Hz clock and feed that to four '4017 cascaded counters, as Albert suggested, to get a maximum count of 4999 seconds or 1.39 hours,
The '4017 outputs could go to an hour-minute-second (5-stage) thumbwheel decade switches followed by a 40-input AND gate to select the desired time.
The 40-input AND gate can be configured from five '4068 8-input NAND gates feeding one '4078 8-input OR/NOR gate.
 

Thread Starter

Buzzer25

Joined Apr 3, 2012
15
Hi Crutschow, thanks for the reply, that sounds like an interesting way for me to do, but I am not sure on how to put that logic together. I am still pretty new to the digital logic game and never gone above using normal 4081s really. Also could you suggest a thumbwheel switch to use?
 
Last edited:
Top