Comparing Crystals using a Speaker

When you compare the frequencies of the crystals of two Arduino boards labelled as 16 MHz they might differ as much as 100 kHz from one another.
For this experiment try to find two Arduinos which differ less than 40 kHz.

When you upload these lines

const byte outpin  = 5; 

void setup() {
  TCCR0A = B00010010;
  TCCR0B = 1;

void loop() {}

to both of them they will produce a square wave of half the frequency of their respective crystal frequency.
If run both of them simultaneously (powered by the same USB device) and connect both pin-5 pins to the pins of a speaker you will hear a tone whose pitch equals the half difference of the crystal frequencies.

In case your crystal looks like this you can connect the metal case to ground using a wire or just touching it with your finger. This will lower the frequency by some 50 Hertz which is just 5 ppm. But the audible interference frequency produced by the speaker will also be shifted by 50 Hertz which will result in a considerably higher or lower tone.

contact: nji(at)