Allegedly a TTL clock (build log) - Page 1
Forum section: electronics / projects

author: harnon
author_rank: Regular Contributor
timestamp: March 11, 2019, 01:17:54 pm
content: Hi all,I'm building a TTL clock as a gift. The basic idea is to have LEDs to represent the "hands" of the clock. One set of LEDs will show 5 minute intervals and another the hours. Aesthetics is quite important so I'm putting a lot of thought into that as well.At this stage I'm trying to get the circuit right and would appreciate any feedback as this old school TTL stuff is fun, but a bit overwhelming for a newbie - lots of traps for young players.The basic idea is to divide down a 32768 Hz oscillator to count out 5 minute and one hour intervals using using 74HC4040 and 74HC161 chips. Later I have 74HC238s in 3-to-8 configuration to drive the LEDs (via transistors which are on one external boards connected via J1 to J12). There are debounced momentary switches to skip forward 1 hour or 5 minutes per press.Lots of questions, sorry...1) I don't even know what I'm doing with the crystal, is this even a circuit? I copied the circuit from another TTL clock design I saw, but is there anywhere that explains how to properly wire one of these up?2) I was thinking replacing some logic gates with diode logic gates (for aesthetic reasons) are there any advantages/disadvantages vs the TTL chips?3) I was thinking battery powered, but read in a few places that these TTL chips can be quite power hungry. I'll check when I breadboard, but is this kind of thing likely to require a wall wart?4) Do I need diodes before the momentary switches, i.e. to prevent current flowing back into U6A / U1E from SW1 when it is pressed?The next step for me once I'm happy with the schematic is to buy some components and bread board it up. Thanks!

author: mc6800
author_rank: Contributor
timestamp: March 12, 2019, 10:16:18 am
content: I'm not convinced that the clock will oscillate.AIUI, the idea with CMOS oscillators is that you bias an inverter into its "linear" region with a feedback element such as a resistor. The crystal + capacitors then "nudges" the circuit to oscillate at the desired clock frequency. At one point Intel had an excellent App note explaining this, but as I can't locate it, here is one from Maxim:https://www.maximintegrated.com/en/app-notes/index.mvp/id/21541) It looks like the feedback from the output pin is missing.<pedant on> 74HC isn't TTL, it is CMOS. TTL is plain old 74/74LS etc. 74HCT is also CMOS, but with I/O levels better suited to interfacing with "old" TTL<pedant off>2) Diode gates work, but require one diode per input, plus one resistor. You need to choose a suitable output resistor for the speed of input/output, based on the capacitive loading of the output. You also lose 0.3-0.6V of noise immunity. For example say the input to a diode "or" is 2.9V, the output might only pull up to 2.3-2.6V (as the diode will have a voltage loss) - meaning that the next input is more prone to responding to "glitches". Given that you can get single gates in ICs these days, I'm not sure if diode gates are as useful as once they were.3) TTL is relatively power hungry (although 74LS is less so than 74 for example), CMOS isn't (except at high speeds - 32KHz isn't). The power hungry items are the displays. For example, I have a fancy wall clock with 12 x 7-segment displays for time etc. It draws about 20mA with no display, and 120mA when the displays are litIf you haven't already, I would suggest reading a copy of "The Art of Electronics".

author: mc6800
author_rank: Contributor
timestamp: March 12, 2019, 10:46:26 am
content: Found a link to the Intel App note on oscillators (155):https://www.eevblog.com/forum/beginners/microcontroller-oscillator/

author: harnon
author_rank: Regular Contributor
timestamp: March 12, 2019, 11:27:57 am
content: Hey thanks for the reply. Funnily enough I have a copy of the Art of Electronics about 30cm from my hand. Just didn't think to look up something in a bookI'll read through those app notes. Also, I did say "allegedly" a TTL clock so I think I'm covered CMOS wiseI'd be using the diode gates purely for the aesthetics of a bunch of them lined up in rows but as I'm planning a pretty weirdly routed board, noise immunity might be a thing. The whole clock is going to be mounted on a 300 year old oak base so I don't want to waste the timber with a shoddy looking PCB!My display will literally be 3 LEDs at a time so hopefully power consumption will be ok. I guess I'll breadboard it and see before I commit to a power supply. Debugging it is going to be interesting as I only have a multimeter lol. Might have to re-purpose an Arduino Due to record the signals.

author: klunkerbus
author_rank: Unknown
timestamp: March 12, 2019, 11:33:47 am
content: I only glanced at the schematic, but I happened to notice that the output of the spare AND gate at U2B is tied to ground. There shouldn't be any connection made to that spare output. With all the inputs tied high, that gate will be attempting to drive the output high.

author: harnon
author_rank: Regular Contributor
timestamp: March 12, 2019, 12:06:10 pm
content: Oh yeah, good spotting. Thanks!

author: harnon
author_rank: Regular Contributor
timestamp: March 14, 2019, 08:06:27 am
content: I've ordered parts to breadboard the circuit up... (plus an extra breadboard). Let's see how this goes

author: harnon
author_rank: Regular Contributor
timestamp: April 22, 2019, 08:05:46 am
content: Well I've made a fair bit of progress on this clock, although a lot slower than I'd have liked!I now have the minutes "hands" "working" on my breadboard, although I have some issue when running it with a fast clock for testing purposes. After about 2s (the equivalent of 1-2 hours in real time) the outputs lock up and don't change anymore, even though I can see the input clock is still running. I'm currently troubleshooting this bit before I wire up the hours LEDs. I'm now using UDN2981As to drive the outputs courtesy of digsys' garage Grand Sale.In getting this far I've released magic smoke from a breadboard power supply, bricked an FPGA dev board (overwrote the flash config while trying to set it up as a clock signal, hopefully I can fix it later), worked out the current mode on my multimeter always measures 0.000, finally got around to building an ATX-based PSU, and built my own four channel logic analyser (see attached picture for the schematic). This custom logic analyser was in response to a $6 Salae clone being an absolute PITA, crashing, locking up, and at times giving obviously incorrect outputs.I've just started a 3-4 hour test tonight to see how good the time keeping is and whether it locks up if I run the clock at 32kHz.

author: harnon
author_rank: Regular Contributor
timestamp: April 25, 2019, 01:27:29 am
content: I've changed the title because this is now a build log!I finished bread boarding and it all works as expected. I still need to test a few more circuit components such as the 123 monostable I'm using to debounce the buttons and the oscillator circuitry. Meanwhile I've finished routing the PCBs which were a real challenge due to the 24 LED lines.I've also planned the final layout. My Dad is very keen on furniture making and is going to help build up the backing for the clock. We are looking at a couple of lengths of 300 year old French Oak. I'm also thinking about some brass inlay but not sure yet if that will make it into the final design.

author: David Hess
author_rank: Super Contributor
timestamp: April 25, 2019, 09:57:44 pm
content: Quote from: harnon on March 11, 2019, 01:17:54 pmIt is missing the connection from the gate output to the two resistors. 32kHz crystals have special drive requirements which may not be suitable for TTL.QuoteTTL would usually use wired-or logic with multiple open collector outputs tied together instead of diodes.QuoteLEDs draw a lot of power also so forget battery power if you use them.If I wanted to make a cool clock and limit the power, I would useinjection logicusing discrete transistors.

author: Cliff Matthews
author_rank: Unknown
timestamp: April 26, 2019, 12:16:53 am
content: I'd add granularity with a 9-bit R2R off U7 and a LM3914 in dot-mode. Adjust input trimmer so the dot moves each ~36 sec (some may protest, but IMO it's permissible to toss-in another vintage era chip).

author: harnon
author_rank: Regular Contributor
timestamp: April 26, 2019, 01:35:57 am
content: Thanks for the replies! The schematic in the first post is a bit out of date, I haven't uploaded a new one yet.Quote from: David Hess on April 25, 2019, 09:57:44 pmYes, I'm still a bit nervous about the clock signal and its one of the things I need to test. The circuit changed a little from the schematic above following the earlier feedback. As a fallback I'm thinking about just throwing on an RTC with a 32kHz output pin (i.e. DS3231?) if things don't go well, although I haven't read any datasheets yet so I don't know how workable this is. I've seen another post on here talking about PCB considerations so it might need some adjustments to the PCB if I go this route.Quote from: David Hess on April 25, 2019, 09:57:44 pmI've given up on the idea of running from battery but my feeling is (as I'm not using particularly high power LEDs) that the 74HCs will draw far more current than the LEDs. I can't do any current measurements at the minute due to a faulty multimeter - I'm waiting on a new one to ship. Similarly I decided not to use diodes and most of these type logic gates I'm using 74HC chips. I did breadboard up some diode AND gates but found it wasn't very reliable.Quote from: David Hess on April 25, 2019, 09:57:44 pmQuote from: Cliff Matthews on April 26, 2019, 12:16:53 amInteresting ideas and some new things to read up onI'm fairly set on the TTL approach for this project but I'll definitely add these to the list of things to try in future projects

author: David Hess
author_rank: Super Contributor
timestamp: April 26, 2019, 03:33:53 am
content: Quote from: harnon on April 26, 2019, 01:35:57 am74L (low power) gates were commonly used for crystal oscillators but 32 kHz is a different matter. A single transistor oscillator is feasible. HC logic can be used although HCU (unbuffered) may be necessary or more reliable. 32 kHz crystals are kind of weird.QuoteHC (HCMOS) will draw very little power because of the low operating frequencies involved. HCMOS or CMOS would be suitable for a battery powered design.Note that HCMOS (HC) does not have TTL compatible inputs. There is a variation with asymmetrical gate voltages called HCT or HCMOS TTL compatible. It is only required when interfacing to TTL levels but otherwise performs identically to HC.

author: harnon
author_rank: Regular Contributor
timestamp: April 27, 2019, 02:02:14 am
content: Thanks again. Yeah I got corrected earlier on re HC not being TTL, hence why its "allegedly" a TTL clockI'm learning (slowly).Here is an early layout of the timber base that my Dad is building up for me. (EDIT: Its upside down)

author: Sapper
author_rank: Newbie
timestamp: April 27, 2019, 08:17:14 am
content: Maybe I'm missing something or my observation has been rectified in the latest schematic but on the second 4040 producing the 5min output the text states bits 2,3,5 & 8 but the schematic shows Q1,Q2,Q5 & Q8 outputs going to the 74LS21 and gate. To me this lloks like you are feeding bits 1 & 2 rather than 2 & 3.

author: harnon
author_rank: Regular Contributor
timestamp: April 27, 2019, 09:36:45 am
content: Oh wow I think you might be right. I must have looked at that 20 times and not noticed.

author: harnon
author_rank: Regular Contributor
timestamp: May 06, 2019, 01:10:32 pm
content: I finished the breadboarding about a week ago and the oscillator circuit and debouncing worked fine. I was using a 74HC123 to debounce but in the end I found a relatively large capacitor to ground did just as good a job.I managed to steal a DMM to measure current from work (my old DMM only ever measures 0 current), and the breadboard circuit uses about 23mA - much lower than I'd thought but in line with what Mr. Hess said previouslyI ordered the PCBs and received them today. There is a large main board and twelve "digits" of the clock dial. I reflowed a test digit and it worked absolutely perfectly. The LEDs are quite visible even under the lights. They're going to be facing towards the timber back so I got Mrs Harnon to hold our daughter's toy hammer for the right ambience. This is the "hour hand" lit up.I then tried reflowing the main board. There were some immediate issues. I've reflowed boards up to about 5x10cm just using a cheap $30 electrical skillet. So far I've done it by feel but I also happened to get a newin the mail today which has temperature measurement. The larger board really struggled to get up to temperature and reflowed inconsistently. Some parts were not reflowed while others on the edge were reflowed. Looking at it a bit closer showed that the centre of the board wasn't touching the skillet. I haven't had a whole lot of luck using sand on the skillet in the past but I gave it a go. Unfortunately the board (after a long period of time) only got up to 220C. If I had a hot air rework gun I think it would only take a gentle wave, but unfortunately I don't.When I took the board out of the skillet with some needle nose pliers it also chipped the solder mask, enough that the board is a write off for this project. So a few issues to work out, but making progress.I'm going to take some blank boards over to "my carpenter" to help mock up the timber base and check it looks like we think it will when the bits are physically laid out.

author: harnon
author_rank: Regular Contributor
timestamp: March 28, 2020, 09:34:33 am
content: Raising this build log from the dead!! I'm stuck at home at the minute with more free time than I'm used to, so I've been able to finally pick up this project.Since I last posted (months ago!) I managed to build the main board using my cheapo reflow technique and a dodgy hot air gun from eBay. It took a couple of goes because there were solder bridges on the SC74 surface mount components that were a little difficult to fix.The next big issue was then cleaning the board, because it has a nice black matt finish that really shows up the flux. I was able to use the fume hood at work and tried some cleaning techniques on a board with solder bridges. It was very difficult to remove the marks left by acetone, but a copious mix of ethanol / IPA / deionised water, scrubbing with a toothbrush and dabbing dry with kim wipes seemed to do the trick.My Dad finished the carpentry and you can see the built up clock in the images below.I wasn't game to plug the board in until I had a power supply with current limit built in as I was too scared I'd blow the board up. I received one just the other day and now the clock is sitting beside me disassembled and ticking slowly away.I'm not 100% happy with the way the digits are connected to the main board. I've built a bunch of dupont connectors and have cables running from the main board to the digits, but the connections aren't very good and might need some hot glue to stay there. It works, but I think might be really flaky. I think I'll also get some clear perspex laser cut for the back so that the cables can't be pulled by little hands.

author: Renate
author_rank: Super Contributor
timestamp: March 29, 2020, 01:57:32 pm
content: It's pretty late to mention this, but...U5 is not necessary.Just shift everything on U7 down 3 taps.