Touch Controlled Digital Clock

Many years ago I built a digital clock that worked really well but the design could have been better, being way too complicated for what it was. So I decided to revisit the project but this time using a different approach, and this is the result. The original clock unbelievably had 13 DIL ICs but the new one has only 7. Having said that, the old clock still functions perfectly after 20 years and for anyone who's interested, the details can be found here. It used the crystal and timing chip from an analogue clock purchased from Poundland which at the time (before I had the internet) I thought was a cool idea, but since then I see that I wasn't the only one who had adopted it. It seems to work though so I've used a simpler version of it here (the doner clock was 2 from Asda). This new clock design still uses the tried and trusted 4026 counter/display driver IC, but instead of using mechanical switches with 'anti bounce' circuitry for the time setting function, I've used low cost touch switches which of course don't suffer from contact bounce as they have no contacts! As well as circuit design convenience, this addition also negates the need for cabinet protrusions as the sensors work through glass or Perspex, enabling a more streamlined look to be achieved. They sit directly below the hours and minutes digits respectively, making them easy to locate. The schematic of the main clock is shown below (the touch buttons and timer circuit are on a separate sub assembly described later)

Click here for PDF schematic

Things to know about the 4026 counter/display driver IC:

1) CLOCK - When a
positive going pulse is applied to the clock input (pin 1), the counter will advance by 1 and keep advancing by 1 with each successive pulse until a count of 9 is reached on which it resets back to 0 where it started and then the cycle repeats

2) RESET - The counter can be cleared back to zero before it reaches 9 by applying a 'HIGH' to the reset pin (pin 15). Counting is inhibited if the reset pin is held constantly 'HIGH'

3) CARRY OUT - Upon reset, the carry out pin (pin 5) will go 'HIGH', either naturally when a count of 9 is reached or if the counter is reset before reaching 9. The carry out signal can be used to clock the input of the next counter in the chain and so on

Principle of operation:

This is a 24 hour clock so we require that both minutes and seconds count to 59 before resetting back to zero on the 60th count and that hours count to 23 before resetting back to zero on the 24th count
. This is achieved by using 'AND' gates to monitor the display segment outputs that go 'HIGH' when the counters reach 60 (for mins/secs) and 24 (for hrs). When the right conditions are met, the output of the AND gate will go 'HIGH' and this pulse is used to reset the counters back to zero. The monitored segments are:

For MINUTES & SECONDS - e, f and g on the most significant digit. These digits will only go 'HIGH' together when a count of 60 is reached but never below this number

For HOURS - g on the most significant digit and f and g on the least sigificant digit. These digits will only go 'HIGH' together when a count of 24 is reached but never below this number

Because just 3 display segments are monitored at each stage of the clock (hrs, mins & secs), a 4073 3 input AND gate is used. Logic gates generally treat 5 volts as a '1' or 'HIGH' but in practice they will trigger at around 3 volts or even less. Being able to trigger at a lower voltage is actually quite essential for this circuit to function, as a monitored segment will only ever produce the voltage that's across the LED, which in the case of a Red LED is about 2 volts. This circuit shouldn't really work but in practice it does, but even so, a diode was added in the common cathode rail to lift the levels up a bit more. If this concerns anyone then Blue or White LEDs could be used instead of Red as they have a forward voltage drop of about 3 volts

Setting the hours, minutes and seconds:

The method of setting the time is the same as that employed on my binary clock project, except here I'm using touch switches. It operates by first setting the hours by applying a 'HIGH' level pulse to the clock input of the hours counter, but because this input is also driven from the AND gate output that resets the minutes, the minutes will also be cleared back to zero. The same logic is applied for setting the minutes. A 'HIGH' level pulse is applied to the clock input of the minutes counter, but because this input is also driven from the AND gate output that resets the seconds, the seconds will also be cleared back to zero. I think this time setting solution is not only simple from the design perspective, but is also easy to use in practice – first set the hours (which will also zero the minutes), then set the minutes to the current time (which will also zero the seconds) and when the minutes on the reference clock change, touch the minutes set button one more time and on its release the seconds will start from zero

The hours and minutes ‘SET’ pulses are derived from two touch switch modules which can be purchased very cheaply from eBay. They have three connections, +5V, ground and output. The output of each touch switch is fed through a diode so that when they are inactive, their ‘LOW’ state doesn’t ground any reset pulses coming from the AND gate outputs. Most of the time the AND gate outputs will be low, only going momentarily high when producing a reset pulse. To prevent this ‘LOW’ state shorting the output from the touch switches to ground (when operated), the AND gate outputs are fed through two 10K resistors. It’s worth noting that the ‘HIGH’ level of these touch switches isn’t actually 5 volts, it’s more like 4 volts and after being passed through the output diodes it drops even further, but as stated earlier the 4026 seems fine with lower voltage levels

1Hz clock pulse generator:

There are various ways of obtaining a 1 second pulse but the approach used here is nice and simple. It uses the PCB from a low cost analogue clock that contains a quartz crystal and divider IC. These all seem to be pretty much the same no matter what clock they come from (apart from maybe the shape) but they do need to be modified first to make them suitable for our needs. As they are designed to run from a 1.5 volt battery, the 5 volt supply used for the rest of the clock has to be stepped down. This is achieved using two silicon diodes in series placed across the supply rail of the clock PCB and fed via a series resistor to limit the current. The forward voltage across the two diodes is about 1.4 volts which is close enough. 'Out of the box' these little boards produce positive and negative going pulses when measured across the output terminals. The pulses are staggered, so although there is a 1 second (1Hz) interval between the positive and negative peaks, the interval between each posive peak and each negative peak is 2 seconds (2Hz). Because the two output terminals are not referenced to ground, they can simply be connected together through two 10K resistors to make this the output. If this output is now referenced to ground, the pulses will then all be positive going with a 1 second duration. They will still be too low in amplitude to be of any use so a transistor is added to increase the output level to 5 volts suitable for clocking logic circuits. The schematic is shown below

Just out of interest the output from the 'chip on board' divider IC is shown below to illustrate what the pulses actually look like


Unmodified output
Combined output Amplified output

The Electronics:

The main counter and display circuit is built on a 9cm x 15cm matrix board with turned pin DIL
sockets being used for the ICs and displays. I don't think there is a dedicated socket for 7 segment LED displays but 24 pin DIL types work fine, though they will have some holes left over. I didn't take a photo of the underside of the board as it might put people off building this project but suffice it to say there are many connections that need to be hand wired and it's not for the feint hearted! The two touch switches and the electronics for the 1Hz pulse generator are on a separate sub assembly which plugs into the main board using headers (I just find it convenient having everything plugable). Drawing an exact wiring diagram for the whole clock would be quite daunting, but as the physical layout of the components closely mirrors the schematic anyway (the display pinouts are drawn in their actual positions) I just printed out the diagram in reverse and used it as a guide. It helps to use a pen to highlight each wire as you go to indicate that it's been fitted. Putting on some good music and pouring a glass of Red helps as well. Below are a couple of reference diagrams that show component placement and fixed wiring but not the interconnections. Note that each IC has a decoupling capacitor from the supply pin down to ground but on the schematic these are shown separately for neatness

The main clock matrix board (without sub assembly)

The touch control and clock pulse sub assembly

The Enclosure:

The enclosure is about as easy as it gets when it comes to construction. It’s basically two A5 sized acrylic sheets of 3mm thickness (available laser pre-cut from eBay) separated by four stand-off pillars with the circuit board sandwiched in-between. The rear sheet is solid Black and the front (window) sheet is translucent Black. Although very simple, it does look pretty cool. It is a fingerprint magnet though! The pillars that separate the front and rear are round in profile, have M4 internal threads and are 30mm long (12mm M4 socket head bolts are used). The mounting pillars for the circuit board (which are mounted on the rear panel) are hexagonal in profile, have M3 internal threads and are 12mm long (6mm M3 socket head bolts are used). 12mm is important as it allows the touch switches to be positioned at just the right working distance behind the front window (a nice bonus is that they light up when touched). On the rear there is a 2.1mm DC power socket for the 5V 200mA supply


The finished clock (my camera didn't render the display too well... it's actually red!)