# Digital clock source

I'm currently on an adventure into digital electronics. I've built a bunch of logic, but to test it I need a clock source.

Is there a way I can “easily” construct a square-wave oscilator adjustable from 1 Hz to, say, 10 Hz?

Currently I have a big stack of 74HC00 chips, some LEDs and some resistors.

One of my old electronics books had an LED blinking circuit which (from memory) used a NAND gate as in inverter, and put a capacitor across it to slow it down. Those were 74LS00s though. So, TTL. I doubt my CMOS chips would enjoy the very slow rise time of a large capacitor.

I suppose the “standard” solution is to just build a one-transistor oscilator. But from what I've seen, transistor circuits are always an insanely complex network of dozens resistors and capacitors. I'd like something simpler if possible. (Besides, they're usually sinewave oscilators, not square wave.)

I guess maybe I could buy a Schmitt-trigger inverter and use that with a capacitor... It seems a shame to have to buy an entire batch of parts just for the clock. But I think I'm probably going to have to do that anyway. (At the very least, it seems an oscilator requires some kind of energy-storage device, and I currently have none.)

(The other alternative is a crystal — but I don't understand how those work, I suspect you still need lots of additional components, and I highly doubt anybody makes a 10 Hz crystal.)

• You should get a bag of capacitors for decoupling anyway. Commented Feb 1, 2020 at 13:29

My go to device for an adhoc clock is the hex Schmidt trigger device xx14, whether LS14, HC14, or AC14.

Ok, you've bought six in a pack, but the pack costs pennies, and you're not going to need a few extra inverters somewhere? ...as LED drivers? ... as input buffers?

The CMOS devices can go sub-Hz with big resistors, and with no explicit capacitor (only strays) and a <1k feedback resistor, the AC device can crank out many 10s of MHz. How's that for flexibility?

However, 50 EUR/USD/GBP will get you a 60MHz function generator on xBay, with a nasty user interface, but it's functional. I've got one, it works, 'nuff said.

• Given that Schmidt trigger buffers might also be useful for debouncing... this is probably what I'm going to go with. Commented Feb 2, 2020 at 9:14

For DIY projects, I would try to get a cheap function generator. If you insist on a onboard clock source for that frequency range, I believe the standard way is to use a 555 Timer IC. And yes, you need some energy storing device; capacitors are great for just that. I assume you will need capacitors for decoupling anyways – so get a set of different values.

• I thought the 555 was decades obsolete by now? (Although I have no idea what the replacement is supposed to be...) Commented Feb 1, 2020 at 9:19
• @MathematicalOrchid If it does the trick in an elegant manor, it is a good solution regardless of age. Commented Feb 1, 2020 at 9:23
• It's brilliant at what it does, but like most special purpose ICs the replacement is "a microcontroller" Commented Feb 1, 2020 at 13:28

This is a simple schematic found here, using only 74LS00 gates. The source says it works from 20 Hz to 1 MHz, but I'd try with 74HC00 and larger capacitors.

simulate this circuit – Schematic created using CircuitLab

It introduces the hysteresis through the capacitor. To understand the circuit, start with a HIGH at the input of NAND1 and a voltage of 0V over the capacitor. Then the capacitor will be charged through R2 ... The rest is left as an exercise for you. ;-)

Another suggestion for the clock at the very low frequency you want, especially for interactive experimentation and debugging, is to do it manually. Driving a pushbutton by hand at 1Hz will get tedious quickly, so arrange something like a microswitch against a toothed wheel, or a series of contacts like a pulse-dialling phone.

This gies you a system with variable clock rate that can easily be stopped at any time to debug it. Ideal in combination with a PDP11/70 style front panel.

(The crank was a feature on some minicomputers, but I can't now find a reference for this)

You should debounce it in order to ensure correct operation - so another capacitor across the output, a pullup resistor, and feed it through a schmitt trigger to clean it up.

• For debounce you could also use a NC/CO switch that feeds an RS flip-flop built from 2 NANDs. Commented Feb 1, 2020 at 19:45