Simple Audio Frequency Meter

This tutorial explains how to use the Audio Frequency Meter Library for Arduino Zero boards. The code uses a method of the library to measure the frequency of a signal connented to A0 and amplified throug an electronic circuit, in order to get the frequency of a generic input signal. The range currently measured by the library spans from 60 to 1500 Hz and it can be narrowed by the setBandwidth() method. The library can be installed using the arduino library manager

Hardware Required

  • Arduino Zero Board

  • 10k ohm trimmer

  • 1x LMV358 or TLV2462

  • 2 100k ohm resistors

  • 2 47k ohm resistors

  • 100n farad capacitor

  • 3.5mm jack


ArduinoZeroAudioInput bb

In order to get the most dynamic range even from low level inputs, the circuit consist of a non-inverting amplifier that brings the amplitude of the signal to the full input voltage range supported by the ADC. Sampling at full resolution means a better accuracy.

The 10k trimpot allows to adjust the gain of the amplifier matching the signal level with the ADC input range. This adjustment should be made looking at the output on the Arduino Software (IDE) Serial Monitor: when the frequency reading is stable, the gain is properly set.

As an alternative, you may purchase the Electret microphone amplifier - MAX4466 with adjustable gain that was designed specifically for this purpose.


ArduinoZeroAudioInput schem



  Simple Frequency Meter for Arduino Zero

  Demonstrates how to sample an input signal and get back its frequency

  This example code is in the public domain

  created by Arturo Guadalupi <>

  10 Nov 2015


#include <AudioFrequencyMeter.h>

AudioFrequencyMeter meter;

void setup() {

  // put your setup code here, to run once:



  meter.setBandwidth(70.00, 1500);    // Ignore frequency out of this range

  meter.begin(A0, 45000);             // Intialize A0 at sample rate of 45kHz

void loop() {

  // put your main code here, to run repeatedly:

  float frequency = meter.getFrequency();

  if (frequency > 0)



    Serial.println(" Hz");