Multifunctional Metronome

by Martin Clausen (mc AT rotgradpsi DOT de)

This is a electronic digital metronome, frequency meter and reference signal generator made with an AT89C2051. In contrast to many other designs it runs from only 3 volts at a very low current to ensure a long battery lifetime.

Table of contents:

Features

Usage

Depending on the switch pressed at power up, the device can enter different operation modes.

Metronome

This mode is entered if no switch is pressed during power up. Via the two switches the frequency can be decreased or increased. The frequency is displayed in beats per minute.

Frequency Meter

This mode is entered if the switch at P3.3 is pressed during power up. Via the other switch the user can enter the metronome mode. The frequency is displayed in Hertz. The input from the microphone is filtered by a bandpass with a center frequency of about 440 Hz. However, instruments with an intense overtone spectrum like a violin can not be tuned with this method.

Reference Frequency Generator

This mode is entered if the switch at P3.2 is pressed during power up. Via the two switches the frequency can be decreased or increased. The frequency is displayed in Hertz.

Principle of Operation

Metronome

T0 is set to mode 2. The reload value is chosen to give a 4KHz clock at 12MHz crystal frequency. The interrupts IE0 and IE1 are enabled as level triggered.
In the main loop the MCU is placed at most time in idle mode. Each overflow of T0 waks the MCU up. In case a software counter, which is clocked by the 4KHz from the overflow of T0, reaches zero, the amp is switched on for 150µs to produce a click.
If a switch is pressed, it will cause an interrupt. The new reload values for the software counter are fetched from a table and the display is updated as well.

Frequency Meter

First of all the microphone preamp is powered on. Then timer 0 is set to mode 1 as a counter and timer 1 is set to operate as a 2^13 timer. the interrupt for T1 is enabled.
Timer 1 is cascaded with a software counter to give a clock of 1Hz. During most of the time the MCU is placed in idle mode. After each second of counting the timer driven by the preamp is stopped, read and its value displayed.

Reference Frequency Generator

Since the frequency is relatively high and has to be produced with a good accuracy, the timing is done with two delay loop. The values for both loops are read from a table. The values for the display are calculated and displays with the same program part as for the frequency meter.

Parts

Download of Program and Circuit

The part description in schematics is read as follows:
part type + value in exponential form + package description + subpart number in package
for example: C1040805,1 means Capacitor, 100nF, package SMD 0805, first subpart in package

Disclaimer: No warranty at all!
Copyright by Martin Clausen, Germany.
Contact the author: mc AT rotgradpsi DOT de
Impressum