I need to create a circuit to generate a square wave with 50% duty at 32768 Hz +/- 5 Hz. The output of the circuit will drive an NPN transistor ( 0.2 A , 24VDC ).

The cost of the component is not a limit, I'm searching for the best way to have a reliable output.

What is the best way to do this? Crystal and inverter? A specific IC? I tried with a 555 IC, but it had very poor stability over time and over temperature changes.

  • 3
    \$\begingroup\$ Watch crystal. For the oscillator you'll find tons of circuits, but one way is a cheap MCU as long as it allows the LF clock to be fed to an output port pin which can drive the base current of your transistor. \$\endgroup\$
    – user16324
    Commented Sep 28, 2021 at 12:10
  • 5
    \$\begingroup\$ Asking for components to do a certain thing is Off topic. But I'll give you a hint: I challenge you to find a wristwatch or battery powered clock that does NOT use a 32.768 kHz timebase crystal. Buy or salvage such a crystal and build an oscillator with that. Done. \$\endgroup\$ Commented Sep 28, 2021 at 12:10
  • 1
    \$\begingroup\$ Have you tried a DS3231 ? \$\endgroup\$
    – Antonio51
    Commented Sep 28, 2021 at 12:59
  • 11
    \$\begingroup\$ If cost is no object, hydrogen maser and a divide-down. \$\endgroup\$
    – hobbs
    Commented Sep 28, 2021 at 14:54
  • 2
    \$\begingroup\$ What are your conditions on "precise?" Some systems care that the duty cycle is very close to 50%. Others care that the shape of the square wave is right (without any slow rise times). Others may care that after it counts out 500,000 seconds, it counted 500,000 seconds. As others have hinted, yee average watch is actually expected to keep better long term time than your stated requirements. They do an order of magnitude better. \$\endgroup\$
    – Cort Ammon
    Commented Sep 29, 2021 at 5:00

3 Answers 3


You have basically two choices- buy a crystal and make an oscillator or buy an oscillator. If you buy an oscillator it should meet the specifications on the datasheet and if those match or exceed your requirements you'll be okay. Typically such oscillators use 1.8V, 2.5V or 3.3V and sometimes 5V power supplies. The duty cycle might be 40% or 60% rather than 50.00% (many are rated 45-55%).

If you make an oscillator, it could be as simple as an unbuffered CMOS gate, a couple of resistors and a pair of NP0 load capacitors. Small tuning fork crystals such as 32.768kHz are easy to overdrive so there's a balance between an oscillator that starts reliably under all conditions and one that overdrives the crystal causing frequency drift and even failure. One of the resistors controls that, the other is not so critical and is only to bias the gate. The load capacitors are calculated from the crystal datasheet, as you can find many references on. The duty cycle, as with some types of oscillator, may also not be all that close to 50.0% if you use a 32.768kHz crystal (the most common kind).

If you actually require a duty cycle very close to 50.0% you can source a crystal of 65.536kHz, make an oscillator with that, and divide it with a flip-flop, which will be very close to 50.0% if the power supply is stable. You may also be able to find an oscillator in that frequency range.

Some oscillators use a crystal inside operating at the output frequency, some use a higher frequency crystal and a circuit to derive the output frequency (not necessarily a simple divider) and some use a MEMS resonator and some circuitry. The latter tend to be a bit less stable than a crystal but orders of magnitude better than a 555.

You should peruse the cornucopia of datasheets for oscillators and crystals and compare with your stated and unstated requirements.


Best way to get 32768 Hz 50% duty cycle drive

While you can certainly build or acquire a crystal oscillator, I'll offer a potentially very cheap solution based on the DS3231 RTC chip (not the DS3231M) which produces a 32768 Hz square wave clock output: enter image description here

  1. The Osc is good for +/-3.5 ppm over a wide range of temperatures
  2. You can allow for crystal aging or provide tuning to adjust to better than 1 ppm.

There are downsides too:

  1. You would need to use an MCU (and I2C) to initially set up the clock chip.
  2. You need BBU as the chip is reset on loss of power. If you already have an MCU that can initialize the chip then you don't need BBU of course.

A retail DS3231 RTC clock comes with onboard BBU and typically costs less than $10

Note: You can't use a DS3231M because the chip does not produce an accurate clock (though it is reasonably stable). The time values (which is what you'd typically be using the RTC for) is set by adding or missing 32k clock cycles to keep accurate time.


A few years ago I used a DS32kHz in a clock. It is still available in various packages such as DS32KHZS#T&R ... it may satisfy your requirement.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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