Main Menu

Secondary Menu

Guitar Tuner With an Arduino

Pitch is everywhere, but what exactly is it? This website will document the steps to create your very own Arduino guitar tuner.

Step 1: Lets Talk Theory, "Understanding Pitch"

Pitch, which is often thought of as how high or low a sound is, can be defined as the human perception of frequency. It is clear that humans can not detect frequency with the naked ear, however, our natural idea of pitch can get us most of the way there. Pitches are denoted by the seven letters A,B,C,D,E,F,G and A which is one octave above the initial A with a frequency of 2A. If we look at the keys of a piano we see a repetition of those same musical notes. Each set of eight notes is known as an octave and each note can be flat (lower) or sharp (higher) than the ideal pitch frequency. Lets take a look at rather small frequencies between 50 and 0.

Starting with C the frequencies are, C0 = 16.35, D0 = 18.35, E0 = 20.60, F0 = 21.83, G0 = 24.50 A0 = 27.50, B0 = 30.87 all in HZ. We define a pitch as any multiple of the zero frequency i.e. A*N where N is any real number greater than 0. That means that 55.00 HZ, 110 HZ, 220 Hz, ... are all considered musically A. The same goes for the remaining G through B. Using these repeating domains allows us to convert any input frequency (in Hertz) to it's corresponding pitch.

We were not given this natural ability to perfectly detect pitch or frequency, but with technology and our understanding of signals, this can be done. This demonstration will outline how AC/DC achieved a means to detect the pitch of a guitar string through frequency analysis.

Step 2: Lets Talk More Theory, "Frequency Retrieval From Circuit"

This image indicates the frequency layout for any note the guitar signal might produce. These ranges allow the user to tell if the note being played is sharp or flat, and this is displayed in a later video.

Step 3: Building the Amplifying Circuit

How exactly do we get frequency from a raw input sine wave? We'll get into how the Arduino handles the conversion later, for now, lets build the input circuit. The input is taken directly from the audio jack which intern receives the signal through the audio cable from the inductive pickups located on the guitar. We need to collect the signal and then amplify it, after that the raw voltage value is inputted into the board as an analog input to be processed.

1) Lets begin by building the op-amp circuit. Take the time to gather all the components listed below.

(1x) 10uF Capacitor (amazon)

(1x) 100nF Capacitor (amazon)

(x1) TL082CP Op Amp (amazon)

(x1) 1/4 inch Mono Audio Jack (amazon)

(x1) 220 ohm resistor (radioshack)

(x1) 22k ohm resistor (radioshack)

(x3) 100k ohm resistor (radioshack)

(x1) toggle switch (amazon)

(x2) 9V batteries and snaps to power the amplifier

(x1) 2.1mm DC barrel jack (male, center +)

(x1) lots of wire/jumpers

(x1) bread board/ prototyping board

NOTE: The Op Amp circuit takes the sound waves and increases the amplitude, so that the Arduino can read it easily. The waveform without it would not be in the detectable range of the Arduino of 0 to 5V. It then sends the signal into the Arduino to be sampled, which then samples the frequency of the sound waves, and records it on the serial port so the user can see.

Step 4: Design and Construction of LCD Circuit

We need some way to out put the processed data from the arduino, for this Guide we will be using the following schematic to output with the 16x2 LCD display. For this you will use the same arduino connected to the op-amp circuit as well as;

(x1) 10 kOhm potentiometer for the LCD back-light

(x1) large value resistor (for power to the LCD) we used 22 kOhm.

more wires...

and that's it. This is pretty simple, just connect the wires in the same way that they are shown in the schematic.

NOTE: We used a 10 kOhm potentiometer as a variable resistor to adjust the gain of the op amp. The gain is the amplitude of the output voltage divided by the amplitude of the input voltage.

Step 5: Full Pitch Detection Circuit

This video shows the full circuit put together, walks through the schematic and parts list, and goes over important parts of the code.

Step 6: Lets Code This Thing!

//Free for use and modification //Written by: Noah St. Pierre and Ethan Gibson //Credit for frequency detection code to: //https://github.com/akellyirl/Arduino-Guitar-Tuner // include the library code: #include