timer circuit with relay output

Thread Starter

pavo real

Joined Aug 2, 2017
10
As I expected, AnalogKid came up with a great circuit, cleaner than anything I could do. Nevertheless, just for my own experience, I decided to continue working and see what I could do on my own. Along the way I learned a lot about the CD4060 (no prior experience with it, but I'm glad I've gotten to know it now) and also a lot about LTspice (there were some snags in getting the CD4060 simulations working properly.)

I'm not sure that posting this here really adds anything to the conversation, since there's already a great solution on the table, but I'm proud that I was able to make it work, so I'm going to share it anyway!

The input stage would probably need to be adjusted based on the nature of the pulses, and the output stage could be varied any number of ways depending on relay specs, but those are the easy parts. Getting the timing, resetting, and latching behaviors working right were the fun & interesting parts.

View attachment 132570 View attachment 132571
Cool, nice to see this. I'm learning a lot from you guys. So, according to LTSpice this circuit does what it is supposed to do, correct? Thanks again.
 

ebeowulf17

Joined Aug 12, 2014
3,307
Cool, nice to see this. I'm learning a lot from you guys. So, according to LTSpice this circuit does what it is supposed to do, correct? Thanks again.
Yes, conceptually it should do what you want.

The timing values are all subject to tolerances in chosen components, and potentially also to specific part selection in terms of gates, buffers, inverters, etc. They don't necessarily all use the same threshold voltages. I have to admit I didn't give any specific thought to my inverter selection until just now. It's possible the R1 and C1 values would need to change in order to define the one-minute pulse spacing limit properly if the real world inverter thresholds didn't match those of the simulated ones.

The timing on the one hour timer is better defined as far as transition thresholds, but is still subject to part tolerances (+/-10% is not unusual with capacitors,) so you might consider adding a trim pot in order to fine tune the timings.

Conceptually, this circuit has a lot in common with AK's circuit, but I'd bet that his specific component selections are more well thought out than mine. I don't have the experience to choose wisely amongst the myriad options for logic components.

And of course, both circuits may still need modifications in the front end once we know the nature of the pulses we're sensing. I don't think it'll change the core functions of the circuit, but the pulse input may need additional parts.
 

AnalogKid

Joined Aug 1, 2013
12,174
just for my own experience, I decided to continue working and see what I could do on my own.
Reset switch?

Normal B-series CMOS gates have a single transition level that hovers around Vdd/2 (IIR, the spec is 45%-55%). Schmitt inputs have two transition levels, at 1/3Vdd and 2/3Vdd. To work out the input R-C time constant (and as a cross-check on the LTS CMOS model), you can simulate a CMOS gate input with an opamp configured as a comparator with hysteresis.

ak
 

ebeowulf17

Joined Aug 12, 2014
3,307
Reset switch?

Normal B-series CMOS gates have a single transition level that hovers around Vdd/2 (IIR, the spec is 45%-55%). Schmitt inputs have two transition levels, at 1/3Vdd and 2/3Vdd. To work out the input R-C time constant (and as a cross-check on the LTS CMOS model), you can simulate a CMOS gate input with an opamp configured as a comparator with hysteresis.

ak
I must confess that I was lazily allowing for the main power switch controlling the circuit to act as the reset function (another way that your first crack at this beats mine.) I think it would be a simple addition though: pull up resistor on reset line (maybe 100k?) near where it enters 4060, and then a momentary NC switch that breaks connection between q3/r3 junction and the new pull up. At 100k, I don't think it would impact any of the existing functions, but when you pressed the switch, that pull up would be the only thing left on the reset line.

Thanks for the explanation of the different transition levels. I knew such differences existed, but didn't really know what the standards were. Good stuff!
 

AnalogKid

Joined Aug 1, 2013
12,174
An MCU would be the best here by my opinion.
Best ... ?

There is nothing in post #1 that implies that the TS has a software development system, a programmer, knowledge of C++ or assembler, or any experience with microcontrollers. To me, all of that adds up to $$$ and months. Any of the schematics posted so far can be running on a solderless protoboard in 1 hour for less than $10..

ak
 

ebeowulf17

Joined Aug 12, 2014
3,307
Best ... ?

There is nothing in post #1 that implies that the TS has a software development system, a programmer, knowledge of C++ or assembler, or any experience with microcontrollers. To me, all of that adds up to $$$ and months. Any of the schematics posted so far can be running on a solderless protoboard in 1 hour for less than $10..

ak
I agree! "Best" is very context sensitive.

An mcu would probably be my choice here because I'm very comfortable with a variety of Arduino compatible boards and I'm much less comfortable with my logic circuit capabilities.

However, for anyone who isn't well versed in microcontrollers, this project is far too simple to "need" one... the only reason to make that leap would be if you were looking for an excuse to learn about them anyway.

As a side note, I did get a reset switch working (in simulation) on my circuit as described above. For me, being fairly new at the non-mcu side of things, this circuit was a really fun challenge and somewhat of an accomplishment.
 

ArakelTheDragon

Joined Nov 18, 2016
1,366
The best way normally is either an MCU which can generate different signals easily or an analog generator on which you control the frequency and duty cycle (maybe a functional generator will do). A functional generator is probaly the easiest way :D.
 

ebeowulf17

Joined Aug 12, 2014
3,307
The best way normally is either an MCU which can generate different signals easily or an analog generator on which you control the frequency and duty cycle (maybe a functional generator will do). A functional generator is probaly the easiest way :D.
Please enlighten us. How would you build a circuit to meet the thread starter's needs based on a function generator? I can't imagine how that would help, but I'd be happy to learn a new trick if I'm missing something.
 

ebeowulf17

Joined Aug 12, 2014
3,307
Id have to read the whole thread and I am too lasy! What wrong with using the square impulses from a functional generator.and.set the frequency?
Set the frequency of what?

Please read the thread before telling people what the best solution to their problem is. If you don't know what problem they're trying to solve, how can you possibly think you know what the best solution is?
 

ArakelTheDragon

Joined Nov 18, 2016
1,366
"After one hour of pulse(s) every minute, output a high to relay", if there is time with no pulse for longer than "1 minute" restart the timer?

In other words a functional generator, or at least the first part to generate a square signal, then a few triggers for a clock and you are ready?

What dont I understand?
 

ebeowulf17

Joined Aug 12, 2014
3,307
"After one hour of pulse(s) every minute, output a high to relay", if there is time with no pulse for longer than "1 minute" restart the timer?

In other words a functional generator, or at least the first part to generate a square signal, then a few triggers for a clock and you are ready?

What dont I understand?
The circuit needs to recognize and respond to pulses, not generate them.

If generating pulses provides a way to verify that the incoming pulses are frequent enough and have been running continuously for long enough, that's fine too. So far I'm still not understanding what this circuit would look like. And, even if it is possible to use a function generator as one of the elements in the timing system, it seems like it would be adding an unnecessary layer of complexity to the circuit.

How would the pulse stream from the function generator be used? How would the circuit be more accurate, more effective, simpler, or cheaper than the one AnalogKid came up with? In what way does the function generator improve things?

I would love to see a schematic or even a conceptual block diagram, because I don't understand what you're going for.
 

ArakelTheDragon

Joined Nov 18, 2016
1,366
Ok I admit my idea was wrong the first time! I intended only to generate the impulses with a functional generator :D.

The idea is like this: you have 6 tact triggers wired for a digital clock, but the impulse comes from a functional generator. Meaning the generator will give 1 impulse every minute and when the clock reaches "60" there will be a logical element which will output a signal to the relay and start it plus restart the triggers.

In order to make it as the thread starter wants, you will have to put a button on the "reset" pins of a second set of triggers wired as a digital clock, but this time the functional generator will give a "1Hz" signal and if the triggers reach "60sec" without an impulse to be given to their reset pins, they will have a logical element in order to reset the first set of triggers. This is 2-3 chips (2 with triggers, 1 with LM 317), the accuracy will depend on the triggers and functional generator, but given that there will be restarts at least once per day, it shouldnt be a problem.
 

philba

Joined Aug 17, 2017
959
So, harping on the microcontroller approach, an Arduino Nano goes for like $5 on ebay. $10 if you don't try at all. Download the arduino software (for free), plug the Nano into USB and you're off to the races. The beauty of this approach is that it's totally adaptable to changing requirements. Code for the pulse counter is very simple. While I cut my teeth on MSI logic (4000 and 74xx stuff), I'd much rather use software to solve a problem like this.
 

ArakelTheDragon

Joined Nov 18, 2016
1,366
So, harping on the microcontroller approach, an Arduino Nano goes for like $5 on ebay. $10 if you don't try at all. Download the arduino software (for free), plug the Nano into USB and you're off to the races. The beauty of this approach is that it's totally adaptable to changing requirements. Code for the pulse counter is very simple. While I cut my teeth on MSI logic (4000 and 74xx stuff), I'd much rather use software to solve a problem like this.
I havent been using arduino, I use PIC. It depends on the person, will he want to learn the MCU IDE and programming or is he better with wiring a few chips.

Unfortunately when I use the MCU I begin to forget and after I have problems when I want to make a circuit.
 

Johneap

Joined Aug 27, 2017
1
Cool, nice to see this. I'm learning a lot from you guys. So, according to LTSpice this circuit does what it is supposed to do, correct? Thanks again.
i came across a relay timer that i found useful in an application. it is a multi-functional time delay relay - using 5 amp max and has 20+ time modes with optional trigger.
It's worth checking out. IT can be found on amazon of via this link: http://timers.shop/
 
Top