Close
0%
0%

Click Clack Clock

Lots of relays and diodes

Similar projects worth following
I found 150 SPST NC relays on sale for $10, and 1000 diodes for $6, so I decided to make a clock. That's about all I know so far.

I'm a sucker for surplus electronic crap.  When I recently saw a one-day sale at Electronic Goldmine with 150 relays for $10, I couldn't resist.  Being SPST normally closed, they're not the best for building logic, but I figured I could make them work.  FDH400 diodes were also on sale 500/$3, so I grabbed 1k of those just in case.

I figure since the relays are somewhat contact-deficient, it's fair to use diodes, too.  Besides, the relays have built-in catch diodes, so short of performing surgery on each one, I'm going to end up with diodes in there anyway.

The basic building block I'm going to use is an inverter made with one relay:

When A is high (the relays have 5V 500-Ohm coils), Y is low, and vice-versa.  It's trivial to add a diode-OR gate to this to make a NOR gate:

This is equivalent to the usual NOR gate:

When either of the A or B inputs is high, the output is low.  Given the NOR, an RS latch is easy to build:

This is similar to the usual latch circuit:

But, there's one important difference.  With the NC relay version, at power-up, the relays won't settle into a stable state.  Instead, they'll just buzz, since the contacts will try to energize both coils at once.  This is a case of metastability, but with relays it doesn't just mess up your timing, it fries your components.  To avoid these problems, each latch in the system will need a reset diode (D17 above) that will ensure it assumes the correct (stable) state at power-up.  The common RESET line will be driven from a relay delayed with an RC circuit.

The next step is to make a clockable flip-flop.  I've chosen the classic two-stage topology:

I chose this topology because it can be done with only four relays. The diagram below shows seven relays, but three of them (at the bottom) are for the clock signal, and those get amortized over all the circuits in the same clock domain.  And, if you have an inverted version of the clock signal available (say from a previous counter stage), you only need two of those.  It's a normal two-stage flip-flop arrangement, with the inputs to each stage gated by opposite phases of the clock signal:

In the diagram, I've oriented the OR-diodes horizontally, and the AND-diodes vertically.  Since the AND gates need to pull down the high level inputs, resistors are used in the signal lines.  These resistors will have the same nominal resistance as the relay coils (499 Ohms) and the circuit will use a 10V supply instead of 5.  You usually see an inverter used to create Dbar from D at the input to make this a D flip-flop.  But, if you are just going to use them in Johnson (twisted-ring) counters, like I am, there's no need for this extra gate.  The Q and Qbar signals can feed the next stage's D and Dbar directly:

It's a modulo-10 counter perfect for the ones digit on hours, minutes, or seconds.  It needs 10 more NOR gates for decoding, but those could drive Nixies directly, or 7-segment displays through a diode ROM.

This isn't the fanciest relay logic you can make (unlike some of @Yann Guidon / YGDES highly optimized designs), but it should work first-try, and is easy to wrap my head around.

  • It's hierarchy all the way down

    Ted Yapo04/06/2018 at 16:49 0 comments

    I spent a little time today to get a full simulation of one digit going.  The box of relays arrived yesterday, but I had to be elsewhere today, so simulation will have to do for now.  The counter is made from D-flip flops like this one:

    As a two-stage flip-flop, it needs D and Dbar input, and also CLOCK and CLOCKbar as described in the project details.  The X{2,3,4,5} components are the relay models.  I made a mistake in a previous log that would prevent sequential logic from simulating correctly: the voltage controlled switch should have been across the resistor to simulate the proper delays.  Here's the corrected model:

    With this, the flip-flop works as intended.

    Using the flip-flops, I made a 5-stage Johnson counter which counts modulo-10:

    The five flip-flops are in the middle row.  On the bottom are four relays for the power-on reset and the clock drivers.  At the top are 10 NOR gates to decode the counter states into (10) 1-hot outputs.  These could drive Nixie's directly, or feed to diode ROMs for driving 7-segment displays.

    The nor gates look like this:

    where X1 is one of the relays.

    The states of the Johnson counter at the Q outputs look like this:

    You can see that the counter has 10 states, but they're not much use in this form, so they have to be decoded.  That's where the NOR gates come in.  The outputs of the NOR gates look like this:

    It's a little difficult to parse, but each of the 10 outputs goes high for one clock cycle in turn.  This circuit is basically a CD4017 IC made from relays!

    I haven't decided what the display will be yet, although I'm considering making my own stepper-motor-like displays that use coils and magnets to rotate wheels with symbols on them.  Think of a 6-wheel slot machine that tells time instead of stealing your paycheck.

    This would keep the clock more electro-mechanical, which is kind of what I'm shooting for.

    If I do this, I won't need the NOR gates for decoding at all.  A stepper-type display could be driven from the clock phases directly.  The counters would only be needed to divide the clocks for the next stage.  A big benefit of this design is that the seconds one digit doesn't need a counter at all, so the clock lifetime should be extended.

  • Simulating Relays

    Ted Yapo04/03/2018 at 17:37 4 comments

    My relays aren't here yet, and I'm bummed out about it, so I decided to simulate one so I could design some of the more analog parts of the clock, like the power-on reset circuit.

    This is what I came up with.  The coil resistance is specified by the manufacturer, as are the pull-in and drop-out voltages (modeled here as a threshold and hysteresis value).  What they don't tell you is the coil inductance.  I guessed at a value based on the pull-in and dropout times and the voltage thresholds.  With a 180m inductor, the switch in this model has similar timing to the published relay specs.

    To get a normally-closed output, I reversed the connections to the voltage-controlled switch component and used a negative threshold voltage.  This whole circuit can be encapsulated in an LTspice symbol, shown here switching an LED:

    When the input is high, the switch is off, and vice versa:

    Which isn't really that impressive, I guess, but that's not really why I made the model.

    Slightly more interesting is the power-on reset circuit:

    The supply starts at 0V and comes up to 10V at 100ms.  R2 charges C1 slowly, delaying the opening of the relay contacts.  With these values, the delay is about 350ms:

    You can see the linear ramp (bottom; green) and the LED current (top; blue).  The LED here represents the reset line for all the flip-flops.  They'll be held in reset for those initial 350ms, ensuring they start in a known and stable state.

    Is this a perfect simulation?  Probably not - some values will need to be tweaked when I move to the real hardware, but I can get a qualitative feel for how things will work.

    Oh, and here's another one, an RC relaxation oscillator:

    It's the same thing you might see made with a Schmitt-trigger inverter, and relies on the hysteresis of the relay to switch on an off, charging and discharging the capacitor.  Here's the output:

    The bottom trace (blue) is the voltage on the capacitor charging and discharging, with the output shown in the top trace in red. It oscillates at about 3Hz with these component values.  Is it stable enough to keep time?  Absolutely not.  Probably not, anyway.

  • Relay Lifetime: 7 days - 190 years

    Ted Yapo03/30/2018 at 04:53 3 comments

    The SE1B05AXJ relays I will be using have a rated lifetime of 6x10^5 actuations at the rated load (500 mA), or 10^8 at 10 uA.  Since the coils are 5V/500 Ohm, they consume 10 mA.  This implies a maximum fan-out of 50 for the logic gates, which is an interesting side note, but doesn't help with the lifetime calculations.

    Assuming worst case load, 6x10^5 is the number of seconds in 7 days.  That isn't a very long lifetime for a clock.  Using the 10^8 figure (which is unrealistic), the figure is 3 years.  Still not great, but I could presumably swap in fresh relays.

    What if I just built an HH:MM version? Then, the 6x10^5 actuations turns into 416 days, and the 10^8 into 190 years. The truth is somewhere in between, but this sounds much better.

    I think for now, I'll build an HH:MM version.  I can add a seconds stage later.

View all 3 project logs

Enjoy this project?

Share

Discussions

Bharbour wrote 11/11/2021 at 04:13 point

That is an odd configuration for an SPST relay, have never seen one with NC contacts only. That might be why 150 of them sold for $10 though.

  Are you sure? yes | no

Ted Yapo wrote 11/12/2021 at 00:33 point

yep, it's the stupidest relay contact configuration, but cheap is cheap.

  Are you sure? yes | no

Yann Guidon / YGDES wrote 03/29/2018 at 15:03 point

5 relays for a DFF ? use the hysteretic effect to reduce to 2 :-)

  Are you sure? yes | no

Ted Yapo wrote 03/29/2018 at 15:27 point

...and that just based on the project image :-)

4 relays, but they're SPST and normally closed, so, you know, the absolute worst ones you can buy.

  Are you sure? yes | no

Yann Guidon / YGDES wrote 08/04/2018 at 02:42 point

Yeah, next time you'll get rid of the coils and build a clock only with the diodes...

oh wait...

:-P

  Are you sure? yes | no

Yann Guidon / YGDES wrote 03/29/2018 at 15:01 point

"That's about all I know so far."
I know where it's going ;-)

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates