2
\$\begingroup\$

I am trying to design a timer for a 220V AC appliance (a coffee grinder); my goal is to learn about analog circuit design, I know how do this easily with an Arduino or equivalent.

I am starting from a current transformer that detects when the grinder is running, and a relay that can open the grinder power supply.

This is what I am trying to achieve:

  1. When someone starts the grinder, the circuit starts counting down from 10s
  2. After 10s, the relay stops the grinder
  3. 3s after that, the circuit goes back to the initial state
  4. If the user stops the grinder, the circuit must come back to its initial state (I haven't even attempted this last requirement below)

Here is the circuit I came up with, using the parts I have around:

schematic diagram

  • The CT generates 5.5V across the burden resistor, at 50Hz, with a duty cycle of 5% (roughly 1ms pulses)
  • The power supply on the right is 5V DC
  • The first 555 timer is triggered by the CT, and expires after about 10s
  • The second timer is supposed to start after the first one goes off, and when on it will open the NC relay so that the grinder is disabled for 3s.

As you can see I have tried to get fancy with the 555 reset pins, but the circuit as shown doesn't work:

  • the circuit from timer 1/OUT to timer 2/RST is trying to make sure that timer 2 is disabled until timer 1 is triggered (so that the grinder can be started at all). The 10uF capacitor was an attempt to keep timer 2 enabled for a short time after timer 1 goes off, until timer 2's output goes high; unfortunately the 555 OUT sinks current and drains the capacitor right away.
  • the circuit from timer 2/OUT to timer 1/RST prevents the 10s to start while timer 2 is in its 3s shutdown time. OUT and RST are connected on timer 2 so that timer 2 keeps itself auto-enabled as long as its output is high.

The simulation is here on falstad.com. Any suggestion welcome :)

Edit: I do understand the 555 is obsolete and not the right part for the job; if I were to implement this, I would obviously use an IC. I am simply trying to get better at manipulating signals using simple analog components: changing a low into a high, boosting a current or a voltage, delaying...

Edit 2: The flyback diode across the relay has been omitted above.

Edit 3: Here is a better diagram, and some changes based on the answer below that at least make the circuit work in my simulator:

schematic diagram

C7 is making sure that the T2 555 is in reset while the circuit powers up. After that, it should only ever trigger from C6 when T1's output goes low.

M2 keeps T1 in reset, as long as T2's output is high.

\$\endgroup\$
  • 1
    \$\begingroup\$ Hm, the 555 doesn't look like any suitable solution to your problems. 3s is too long for the 555, the fact that you need to concatenate two: What you want to do is way easier with a small, cheap, robust, lower power micrcontroller \$\endgroup\$ – Marcus Müller Apr 22 at 20:11
  • 1
    \$\begingroup\$ Does this answer your question? Is the NE555 the IC I need, and if not, what do I replace it with? \$\endgroup\$ – Marcus Müller Apr 22 at 20:11
  • 1
    \$\begingroup\$ It's fine that you want to learn analog circuit design, but analog design also means not trying to use components that make your life hard: e.g. where would you get the 1.8 mF capacitor from with a reasonable size and better than +- 20% tolerance? Really, what you describe is a discrete state control problem; that's very literally the domain of digital logic, not analog circuitry :) \$\endgroup\$ – Marcus Müller Apr 22 at 20:15
  • \$\begingroup\$ I got the 1.8mF on my desk, a basic electrolytic. I don’t care if it leaks as long as the time is repeatable... and in my tests it is. \$\endgroup\$ – Franck Apr 22 at 20:31
  • \$\begingroup\$ If your goal is to learn, why even use a 555 timer? You can make a Monostable Multivibrator Circuit with a pair of BJTs. \$\endgroup\$ – Kurt E. Clothier Apr 22 at 21:54
2
\$\begingroup\$

It's been a while since I worked with a 555 timer, but I'll try to make sense of this. It's hard to understand everything going on because the circuit is arranged very poorly, there are no part numbers or reference designation on anything, and the unusual (I assume simulation) parts are not labeled. Here are a couple of primary reasons why what you have will not work as is:

  1. Timer 1 Output --> Timer 2 Trigger: This can work, but keep in mind that timer 2 will be triggered whenever timer 1 is low. So you have to make sure it doesn't trigger right away. Also, when the timer 2 pulse is done, timer 1 is still low so it will just trigger it again.
  2. The reset shenanigans will not work. There's too much dependency on startup times (how long it takes the internal circuitry to power up, signal rise times, etc). Plus, if timer 2 output is connected to its own reset, then when timer 2 output is low, it will never come out of reset to be triggered.

Here are a few things that need to be fixed:

  1. Get rid of all of the reset trickery. It's unnecessary anyway.
  2. Timer 2 should not be allowed to turn on until after timer 1 has pulsed.
  3. Timer 2 output high should prevent timer 1 from pulsing again by turning off the appliance.

Additional Information

Normally, I would end my answer here, but I had a bit of time and curiosity got the better of me. Before I go over a working example, let me be clear on a few things.

  1. I wouldn't call this an "analog circuit." At best, it's mixed signal. The only thing remotely analog is the circuitry inside the 555 timer and the timer constant for the pulse. Everything else is strictly digital logic. People are free to argue.
  2. Saying you can do something easily with "Arduino" doesn't hold much weight around here. Better to just say you'd use a small embedded microcontroller. That would still require a few external transistors for driving currents, but I'd estimate this is a 100 lines of code or less kind of problem.
  3. There are other logical ways to solve this problem such as using the CT pulse to clock a 9+ bit counter. When the 9th bit goes high, that signifies about 511 pulses have been clocked. At 50 Hz, that's 10 seconds. Use this output to drive some relay with a charged capacitor supplying the additional 3 second duration.
  4. The circuit I'm presenting is not exactly "good" but it does work in a simulation. The real world might be a bit different...

Revised Circuit - Simulated Appliance Power

I'm using LTSpice for my simulations. I don't have models for relays so I'm simulating all of that using transistors and voltage controlled switches. Here's the appliance power circuit.

Appliance Power Simulation

  1. The "start" button is simulating you pushing a button to start the appliance. It will turn on M1 (NFET) which turns on M3 (PFET) which turns on the switch S1. This power is then fed back into the M1 gate so the power stays on.
  2. The section around M4 is a normally closed relay in line with the appliance power. We'll use the M4 gate to turn this thing off later, but for now, it's always on.
  3. The CT source generates the 50 Hz pulse at 5.5V when the appliance is powered on. This turns on M2 which acts as the active low trigger pulse for timer 1.
  4. Vcc is a modeled source with a bit of initial rise time. All of the .model stuff is to add custom parameters to the transistors and switch parts.

Here are the resulting power and trigger waveforms.

Appliance Power Waveforms

You should see that as soon as "start" goes high, the "power" also turns on, and the CT pulses start immediately. The "start" is timed to pulse twice, but that's not important right now.

Dual 555 Timers

The initial 555 timers are pretty straight forward. Timer 1 is setup to give a 110ms pulse, and timer 2 gives a 55ms pulse. These times are arbitrary - just doing something reasonable for the simulation. Whenever timer 1 output is low, timer 2 is triggered.

Dual 555 timer circuit

The voltage divider at at the timer 2 output is just so the outputs have different levels in the waveform - easier to see what's happening. As you might expect, timer 2 is instantly triggered, and then again whenever the timer 1 pulse is over. We'll fix that next, but for now, here's the waveform.

555 Timer waveform

Controlling Timer 2 Power

Remember that transistor controlled voltage switch from the beginning to keep the appliance powered on from the start pulse? We can use that again here. Timer 1 output can turn on M5 (NFET) which turns on M6 (PFET) to switch power to timer 2. That way, timer 2 is off until timer 1 pulses. Then, this power signal can feed back into the M5 gate to keep it on. A diode is used to prevent that power from screwing with the timer 1 output. I use another divider to monitor the power line (power2) so the waveform is easier to see.

Switched timer power

Controlling the Appliance Power

Now, we can use the timer 2 output to turn off the appliance by feeding it's output into the base of the M4 NFET (see the first picture), but we have a new problem: timer 2 stays on FOREVER because timer 1 is always low because the appliance is kept off. Bummer.

bad waveform

Final Adjustments - Timer 2 Power

To fix this, we can adjust how timer 2 is powered. Rather than feeding it's power line back into the M5 gate, we can use a capacitor at the gate to keep it on for so long. The value of the capacitor will determine how long timer 2 is powered after the timer 1 pulse is over. I'm using 6uF (C6) which gives us just slightly less on time than the 55ms pulse from timer 2 (timer 2 looses power a few ms before its pulse would end).

Some things to keep in mind - if the value is too big, timer 2 will end, but its pulse but stay on until the cap discharges anyway. Also, it will take some time for the timer 1 output to charge it up. Setting the time constant to be less than the total pulse time of timer 2 will set the actual time of the timer 2 output pulse. I won't get into the details of how to calculate the capacitor value. If you want to learn, check out this excellent RC time constant tutorial. There are also lots of related questions here on stack exchange.

Here is our final, complete circuit and the resulting waveform.

Dual triggered timers

Dual triggered timer waveform

So here's what's happening:

  1. Pressing "Start" turns on the appliance, which starts the 50 Hz pulse.
  2. Timer 1 is triggered by the first pulse and creates a 110ms output pulse.
  3. Timer 2 is powered when the timer 1 output pulse turns its power switch on.
  4. Timer 1 pulse ends, triggering a 55ms pulse from timer 2.
  5. The timer 2 high output turns the appliance off, stopping the timer 1 trigger pulse.
  6. Timer 2 looses power once capacitor C6 discharges and its power switch turns off.
  7. Some time in the future, "start" is pressed again, and the cycle repeats.

Real World Gotchas

  1. The trigger for timer 1 is a 50 Hz pulse, and timer 1 is on for 10 seconds. It's plausible that before the timer 2 output rises high enough to turn the appliance off, timer 1 is triggered again which will mess with the timer 2 power control. To fix this, we can kill power to timer 1 with the timer 2 output, much like we are doing with the appliance. Here also might be a reason to control the timer 1 reset from the timer 2 pulse.
  2. The 10 and 3 second timers require very large capacitors. Capacitors don't charge or discharge immediately, and can require large currents to fully charge. This can easily brown out your 5 volt regulator or other small battery supply, making the whole circuit act like it's drunk.
  3. You are using low-voltage circuitry to control a VAC appliance. This can be very dangerous, and requires care. Use caution. You also need some isolation between the AC relay and the control circuit.
  4. Learn what a flyback diode is, and why you need one with your relays (and sometimes transistors).
| improve this answer | |
\$\endgroup\$
  • 1
    \$\begingroup\$ Thank you for your extensive reply! It will take me a while to digest this. Already the problem with connecting a 555's OUT with its RESET pin is obvious now you pointed it out, I erroneously thought of the output pin as disconnected/floating when the timer is off. \$\endgroup\$ – Franck Apr 24 at 13:53
  • \$\begingroup\$ On Arduinos... I am aware that they are being snubbed in many circles... but I have $2.5 3.3V pro minis, the programming interface and the IDE figured out, and they have the GPIOS, clock and interrupts I would need. So this being a one-off project I am not sure what I would gain switching to a different IC, even if the ATMega328 is overkill for the job at hand? \$\endgroup\$ – Franck Apr 24 at 14:04
  • \$\begingroup\$ I am well aware of gotchas 3 & 4, I will mention it in my question, thanks! \$\endgroup\$ – Franck Apr 24 at 14:05
  • \$\begingroup\$ @Franck It was a fun project to figure out. Regarding Arduino, it's more so that users commonly think they know a lot more than they actually do - such as the fact that Arduino is not a microcontroller, but a development environment. Different versions use different chips. The original one used the mega328 (maybe even mega168), but others and variants use attiny, atsam, and so on. Other vendors also offer "arduino compliant" boards that jump through hoops to get the arduino libraries to work with their chips. For one-off projects, do use what you have and are comfortable with. \$\endgroup\$ – Kurt E. Clothier Apr 24 at 15:48
  • \$\begingroup\$ @Franck much of my circuit relies on using MOSFETs as a switch, both high side and low side. If you don't understand those parts, you need to look into that, and especially "logic level gates" so the FET acts like a low-ohm resistor when the gate voltage is above a threshold. There's a bit more to it than that, but it's a good starting place. \$\endgroup\$ – Kurt E. Clothier Apr 24 at 15:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.