OwenDuffy.net 


440Hz (A4, A440) reference oscillator

This article describes a simple but accurate source of a 440Hz square wave.

Design criteria

The 440Hz reference oscillator is a frequency reference for tuning musical instruments, it is the frequency of ISO standard concert pitch for A4 on a piano.

Key design criteria were:

  1. Accuracy of better than 0.1cents (58ppm, or 0.026Hz);
  2. symmetric square wave output;
  3. simple circuit;
  4. inexpensive;
  5. low current consumption;
  6. capable of battery operation

Design

The circuit uses an inexpensive 11MHz crystal to clock a Atmel AVR, ATTiny25, which divides the clock for a symmetric square wave output at nominally 440Hz. 

Implementation

Circuit

Fig 1: Circuit diagram

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 440Hz. The /KEY line is not used.

The output could be used to drive a speaker through a 500/8 transformer, or a PCB speaker such as the StarMicronics QMB-111PC.

Table 1: Parts list
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 11MHz crystal Element14, Futurlec.

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.

Fig 2: Output waveform

Fig 2 shows the output waveform with no load. The frequency error here is 0.08 cents. A competent tuner is unlikely to achieve better adjustment than 0.5 cents.

Programming

 
set PRG=usbasp
set PORT=usb
set OPTS=-B 10

rem program flash
avrdude %OPTS% -c %PRG% -P %PORT% -p t25 -U flash:w:440HzRef.hex

sleep 2

rem program fuses
avrdude %OPTS% -c %PRG% -P %PORT% -p t25 -U hfuse:w:0xDF:m -U lfuse:w:0xFF: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.

Warning

Make sure that the fuse bits are correct

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!

Links


© Copyright: Owen Duffy 1995, 2017. All rights reserved. Disclaimer.