OwenDuffy.net |
|
This article describes a simple but accurate source of a 1kHz square wave. |
The 1kHz reference oscillator is a handy utility for calibration and frequency measurement by beating with an SSB receiver.
Key design criteria were:
The square wave output is rich in odd harmonics, and is well suited to quick calibration checks of CRO timebases, multimeter frequency counters etc.
The circuit uses a common 4MHz crystal to clock a Atmel AVR, ATTiny25, which divides the clock for a symmetric square wave output at nominally 1kHz.
The heart of the reference is an Atmel AVR MCU, an ATTiny25. It uses a crystal oscillator for the clock, and divides the clock down to 1kHz. The /KEY line can be used to key the 1kHz output, tie it to ground for continuous output.
The output could be used to drive a speaker through a 500/8 transformer, or a PCB speaker such as the StarMicronics QMB-111PC.
Part | Value | Comment |
C1 | 0.001µF | |
C2 | 15pF | |
C3 | 15pF | |
C4 | 0.1µF | |
C5 | 10µF | |
D1 | 1n751 | |
IC1 | ATTiny25 or equivalent (45, 85) | programmed as below |
R1 | 470 | |
X1 | 4MHz crystal |
Without trimming the crystal, the prototype oscillator runs at 1000.05Hz.
The circuit is so simple as to be suited to building on a piece of Veroboard in just minutes.
Frequency accuracy could be improved by padding the crystal with a trimmer capacitor, but the gains are small as temperature stability will not be much better than 50ppm.
For battery operation, the chip will work from 1.8V to 5.5V, so two or three alkaline cells (nominally 3.0/4.5V total) or three NiCd/NiMh cells (nominally 2.4/3.6V total) can be connected across the Zener diode D1.
set PRG=usbasp set PORT=usb set OPTS=-B 10 rem program flash avrdude %OPTS% -c %PRG% -P %PORT% -p t25 -U flash:w:1kHzRef.hex sleep 2 rem program fuses avrdude %OPTS% -c %PRG% -P %PORT% -p t25 -U hfuse:w:0xDF:m -U lfuse:w:0x7D:m |
Above is a batch file for programming the flash and fuses using AVRDUDE. The code should also run in ATTiny45 and ATTiny85. After the fuses have been set correctly, comment out the last lines.
Programming fuses can have unintended outcomes. The ATTiny25 MUST have a working clock oscillator to program it in ISP mode. If fuse changes prevent the clock oscillator running, it may be recoverable with a High Voltage Serial Programmer (such as an AVRDragon), but may not be recoverable with the more common ISP programmers. Be careful!
Once programmed, the fuse bits do not need to be reprogrammed, they are not affected by flash erasure during the normal flash reprogramming cycle. It is better not to keep reprogramming the fuses, it only risks a mistake!
Version | Date | Description |
1.01 | 29/08/2012 | Initial. |
1.02 | ||
1.03 | ||
1.04 | ||
1.05 |
© Copyright: Owen Duffy 1995, 2021. All rights reserved. Disclaimer.