Final Design Paper by wpr1947


									                           Final Design Paper

                         Automatic Guitar Tuner
                           Grove City College
                          ELEE 401 EE Design
                           December 15, 2004

Nathan Dietrich - Nick Marangoni - Josh Michulka - Dan Moch - Greg Sinsley
Table of Contents
Abstract                      3
Introduction                  4
System Overview               6
Guitar & Pickup              11
Data Acquisition Board       13
Processing Software          15
User Interface               18
Control System               19
Manufacturability            22
Health and Safety            24
Sustainability               25
Environment                  26
Future Work                  27
Conclusions                  28
Appendix A                   29
Appendix B                   33

As the integration of electrical and computer technologies continues to grow, the focus on
electrical control systems and digitally manipulated data becomes increasingly important.
For this reason, investigations in signal analysis and digital processing constitute a
considerable foundation for development in today’s solution driven environment. It is
the proposition of this project that these key aspects of electrical engineering can be
applied specifically to the task of tuning a guitar. Due to the absence of intrinsic tuning
capabilities, the guitar provides a perfect opportunity for design modification, specifically
through the implementation of digital analysis and microprocessor-based controls.

Though a common task, tuning a guitar is actually quite difficult. The goal of this project
is to find an efficient and accurate way to automatically and simultaneously tune all six
strings of a guitar to within a tolerance of 10 cents of each note (anything outside this
accuracy range would sound noticeably out of tune). Automatic tuning is accomplished
using A/D conversion, digital signal processing, and digital control systems. A
composite analog signal, produced by the guitars pickup, is converted to a digital signal
and then digitally processed by the Automatic Guitar Tuner (AGT). The processed
digital signal with then generate a motor control signal which in turn (no pun intended)
make the necessary tuning adjustments. This paper provides a comprehensive overview
of this tuning system, its capabilities, and the strategies for its implementation. Each
stage of the system is considered in detail and discussed within the context of its role in
the overall automatic tuning system.

Tuning a guitar can be a tedious and time consuming process. Moreover, once the guitar
has been correctly tuned, there is no guarantee that the strings of any guitar (regardless of
its quality) will remain in tune for any length of time. Many musicians have found that,
for any number of reasons, their guitars must be retuned repeatedly within a relatively
short period of time. For this reason, the automatic guitar tuner offers a quick and easy
solution to guitar tuning.

The idea for automatically tuning a guitar was brought on by a desire to apply aspects of
electrical engineering that utilize digital signal processing to solve real world problems.
Due to the complexity of the system, a general and more specific view of each
component will be presented.

From a high-level system view, the guitar tuner has one objective: simultaneously tune all
six strings of a guitar automatically. This objective is satisfied if the tuning device can
adjust each string of the guitar to be within ten cents of its nominal value. Ten cents
represents 10 one-hundredths of a full step (a full step being the next note), is a
reasonable limit considering that anything outside of this range would be audibly out of

If the AGT is viewed from this high-level, it consists only of the guitar and the automatic
tuning device. The AGT is design to work with any electric or acoustic/electric guitar.
This allows the guitar and pickup to be independent of the AGT. Therefore, it is an
objective of this project to make the automatic guitar tuner scalable to any guitar. The
AGT only requires a guitar with an electrical pickup (any pickup) that can be used to
capture the signal produced by strumming the guitar strings. Controllable tuning pegs
(the guitar’s machine heads), used by a guitar player to manually adjust the tuning, are
standard on all guitars. The automatic tuning system will not in any way interfere with
the user’s ability to manually adjust tuning. The rest is the responsibility of the AGT.
From this point, the tuner implementation flows rather logically.

Within the tuner itself, the project is broken down into three general objectives:
    capture a signal from the guitar and send it to the tuner.
    manipulate and interpret the signal within the tuner.
    produce control signals that the control system will use to tune the guitar.

The first objective is straightforward and is satisfied when the tuning system has received
a signal that it can ―interpret‖. This means that the analog waveform sent from the guitar
must be correctly converted into a digital form and filtered into clean signals. Frequency
readings will be obtained from these filtered signals and compared against properly tuned
values. This is a major focus of both the project and this paper. The constraint is that the
strings cannot be more than one half-step (50 cents) above or below its nominal value.

Secondly, the manipulation and interpretation objective has succeeded if the tuner can
produce correct control signals. This accomplishment demonstrates that the tuner has

correctly interpreted the signal that it was given. The control signals will contain
information concerning the adjustments that must be physically made to the guitar strings
to bring them in tune.

Finally, the control phase is completed if the controlling devices (motors) are able to
physically tune the system. Again, the tuner has physically tuned the guitar when it has
brought the strings into within 10 cents of the desired note. Satisfying this objective
involves both motors and control systems that will drive these motors based upon the
information received from the generated control signals. Also note that the user should
be allowed to decide when to begin tuning, stop tuning, and possibly even adjust to
different types of tuning (this will be discussed later).

The purpose of this project is to satisfy these objectives as efficiently and cost effectively
as possible. As promised, this project presents an excellent example of digital processing
and digital controls. The challenge is to tie engineering theory and design into a
workable and useable product that can tune a guitar. Because this group has found no
automatic tuning systems on the market that adjust according to frequency (there is a
tuning system that adjusts based upon string tension values), this project idea signifies a
genuinely new application of engineered technology.

Initially, the tuner will most likely be implemented on a computer / data acquisition board
combination. The AGT is being developed with the intention of eventually being an
embedded system. As far as the control system is concerned, the team seeks to make this
mechanical device as unobtrusive as possible. The motors that will actually tune the
strings will be connected to the head of the guitar. This will cause the least amount of
damage to the guitar. The objective is to find the smallest and lightest motors that have a
high enough gearing to turn the strings. Although there is not necessarily any interest in
a fully embedded system, this will be the final goal.

  System Overview
  Moving from a high level overview, the AGT is divided into several subsystems. These
  include the guitar and pickup, the data acquisition board, a personal computer which
  houses the AGT’s software, and the control and motor systems. Below, Figure 1
  displays the first-level system block diagram outlining each of these systems.

           Motor        Control
         Actuation      System
On neck of                        Control Signals
  Guitar                          (Digital)

                                                       Motor Control
                                                    Information (Digital)

                                                 DSP/CPU                    Processing       User
                                             Communication (Digital)
                                                                             Software      Interface

                                            Representation of
                                            Composite Signal
Guitar                                                                        Personal Computer

         Composite Signal

              Figure 1: First-Level Overview--Block Diagram of Entire System.

  Guitar & Pickup

  The AGT has been specifically developed using a Rogue Herringbone Dreadnought
  Acoustic-Electric guitar. This guitar was selected on the basis of price, acoustic quality,
  and pickup features. A pickup is a device which is used to convert string vibrations into
  an analog voltage signal. Using a guitar with a built-in pickup allows the AGT to be
  easily scaled to any acoustic-electric guitar, and potentially to any stringed instrument.
  The guitar and pickup are treated as independent variables, meaning that changing the
  guitar will have no affect on the AGT system. The only requirement is that the guitar
  actually has a pickup so that an electronic representation of the sound created by the
  guitar (an analog signal) can be sent to the AGT’s data acquisition board. The AGT does,
  however, require a guitar’s strings to have a tuning that is within one half-step of the

standard nominal values. If time permits, the AGT will also be designed to accommodate
more diverse tunings for more novel musical applications.

Data Acquisition Board

The data acquisition board is the developmental utility on which the AGT will be
implemented. In general, data acquisition boards are used to facilitate communication
into and out of the personal computer. The analog composite signal from the guitar’s
pickup will be input to the data acquisition board. This analog signal will go through the
data acquisition board’s D/A converter and will then be transmitted digitally to the PC.
The PC will process the digital signal and, in return, send control signals back to the data
acquisition board. The data acquisition board will then be responsible for the output of
digital control signals to the control system. Requirements and details concerning the
data acquisition board are covered in the body of this document.

PC Software

The PC is basically being used by the AGT as a software storage device. By way of the
data acquisition board, a digital representation of the analog sound wave can be brought
into the computer. This will be accomplished in real time using Window’s Real-Time
Target. The computer, will then perform digital processing on this signal which will
include filtering and frequency analysis. This entire process will be controlled by a user
through an interface. A more detailed diagram of this PC-based software unit is shown in
Figure 2.

 Figure 2: Close-up of PC Software System and Connection to Data Acquisition Board

Processing Software

The processing software’s role in the AGT system will be to take the digital signal from
the data acquisition board (which will be a digitally sampled version of the original guitar

signal) and use it to produce a digital motor control signal which will be passed back to
the data acquisition board. The processing software accomplishes this through two
subsystems, the digital signal processing system and the control signal generation system.
The purpose of the digital signal processing system is to take the digital signal from the
data acquisition board, perform digital filtering on that signal, then use the filtered signal
to determine the frequency of each string. Using this frequency information, the control
signal generation system will then determine the appropriate action that the motor must
take in order to tune the string (what direction to turn and how far to turn). It then sends a
digital signal to the data acquisition board, telling it what control signals it must output to
the stepper motor controllers.

User Interface

The User Interface will be visible on the screen of the PC and will allow the user to start
and stop the tuning process. Although the specifics of this interface, such as the exact
layout and the environment that it will be programmed in, are currently not known, this
component will simply act as the AGT’s interface with the user. Visible on the interface
will be a block for each string of the guitar along with indicators providing information
about tuning. Therefore, from the interface, the user will be able to tell whether a string
is sharp or flat, the accuracy with which the AGT was able to tune the note, and perhaps
signal and frequency response plots. In the event that the AGT is moved to a more
embedded design, the interface’s start and stop capabilities will be traded for a simple
manual pushbutton. A rough layout of this interface is shown in Figure 3.

                    Figure 3: User Interface Features and Capabilities.

Control System

The AGT will use stepper motors in order to physically tune the strings of a guitar. The
advantages of using stepper motors are their small size, weight, ease of implementation,
and precise position control. The motors will be controlled via stepper motor drivers.
These drivers are simply small integrated circuits that will output a series of pulses on
each of four motor leads in order to drive the motor in a specified direction. These pulses
will be controlled by signals that have been created in the control signal generation
software and transmitted via the data acquisition board. A single stepper motor is
controlled using four different square waves. The drivers accept signals for clock,
direction, and step size. The driver then outputs the proper wave forms to the motor.

The motor drivers that will be used in the AGT are the Motorola SAA1042. This is a 16-
pin dual in-line plastic packaged IC. This driver was chosen due to its small size, driving
capabilities, and simplicity. Also, an external clock will be used to drive the chips. A
simple diagram of the entire control system is shown below in Figure 4.

Figure 4: Overview of Control System, Motor Drivers and Motors

Guitar & Pickup
All of the various guitars which exist today can be broken down into two categories:
acoustic and electric. An acoustic guitar is the old-fashioned kind of guitar that comes to
mind when one thinks of folk music. No electronic equipment exists on an acoustic
guitar to amplify the guitar’s sound, only the guitar’s shape is used to this end – hence the
name ―acoustic.‖ An electric guitar is the kind of guitar brought to mind by rock music.
The electric guitar’s smaller, solid body necessitates the use of electronic equipment to
amplify the sound output. For professional musicians who play acoustic guitars to large
crowds (i.e. – stadiums), which requires that even an acoustic guitar use electronic
amplification, a hybrid type of guitar exists called, quite appropriately, an
acoustic/electric guitar. Since the AGT uses these electronic components to assist in
tuning the guitar, an electric or acoustic/electric guitar is required for compatibility with
the AGT.

The specific electronic component that is absolutely required for compatibility with the
AGT is a pickup. The pickup is the device on an electric or acoustic/electric guitar which
is responsible for turning the vibrations of the six strings into an electric signal. After
this conversion takes place, the pickup sends the signal over a ¼‖ cable to the AGT’s data
acquisition board.

Accuracy is very important, especially for a professional musician who very likely has
near-perfect ears. The AGT has been designed to tune the guitar quite accurately. Before
specific measurements of the AGT’s accuracy can be discussed, a certain level of
knowledge must be understood regarding the measurements themselves. An octave of
any note is double the frequency of that note. Any note is separated from its nearest
neighbor by what is called a half-step, or 50 cents. A half-step is equal to 1/12 of an
octave. Since the frequency range of an octave increases as frequency increases, a
frequency measurement of a half step is not constant, but can be determined by the
                                         f hs  f * 21 / 12 ,
where f hs represents the half-step frequency range and f represents the fundamental
frequency (i.e. – the frequency of the string). With this in mind, the constraints placed
upon the AGT in terms of how accurately it must tune the guitar can be discussed. When
the AGT completes its tuning procedure, each of the guitar string should be tuned to
within 5-10 cents (1/10 of a half-step on a log scale).

In order for the AGT to be able to properly distinguish the six individual strings on the
guitar, some minimum standard must exist for how accurately the guitar is tuned to start
with. The AGT has been designed to accurately tune a guitar provided that each string
starts tuned to within one half-step of the string’s target fundamental frequency. The
fundamental frequencies of each string as well as the corresponding half-step filtering
windows are shown below in Table 1.

                       Table 1: Band-pass windows for each string.
                                  Low      Target
                       Note                            High (Hz)
                                  (Hz)      (Hz)
                         e       311.13    329.63       349.23
                         b       233.08    246.94       261.62
                         g         185       196        207.66
                         d       138.59    146.83       155.56
                         a       103.83      110        116.54
                        E         77.78     82.41        87.31

The combination of notes to which the individual strings is tuned is called the guitar’s
―tuning.‖ To ―tune‖ the guitar is to modify the tension of the strings so that each string
plays the desired note. Since a standard tuning exists which almost all guitars adhere to,
the AGT unit will be initially designed to tune the guitar to this standard tuning. If time
permits, the AGT may be generalized to accommodate more novel tuning schemes as

Data Acquisition Board
The automatic guitar tuner is being developed in order to be implemented on an
embedded system. However, as with many embedded systems, they must first be
designed in larger developmental systems. These larger developmental environments
give the creators flexibility and speed during the design and testing phases of the project.

The data acquisition board is ideally suited for the development of electrical engineering
systems. It is able to test and retest systems in a short amount of time while still using
real-time data. For this reason, a data acquisition board has been chosen to develop the

Although the final AGT will undoubtedly be an embedded system, it has been decided
that making the AGT and embedded system is beyond the scope of this senior electrical
engineering design project. This decision was made mostly due to the overhead
introduced in implementing an embedded system. Also, the AGT is focused on digital
signal processing and digital control systems, neither of which depend on an embedded
system. Consequently, it is the goal of the AGT team to develop a working AGT system
on the data acquisition board as a proof of concept. This decision does not alter the
validity of the AGT. As fully digital system, the AGT will be able to be easily scaled
into an embedded system.

In this particular application, the data acquisition board is being used in conjunction with
a personal computer as a digital signal processor and system input and output device.
The AGT receives a composite analog signal from the guitar’s pickup. The AGT also has
six digital outputs which control the motor system. The data acquisition board is capable
of I/O at high rates in real-time attributable to its onboard digital signal processors.
These inputs and outputs may be seen in the data acquisition board block diagram (Figure

                    Data Acquisition Board

                                                                        Motor Control
  Digital                                                               Information (Digital)
                                              Digital Signal            DSP/CPU
                                              Processing                Communication (Digital)

   Composite              Analog to
   Analog                 Digital                                       Representation of
                                                                        Composite Signal
   Input                  Converter                                     (Digital)

        Figure 5: Third-Level System Block Diagram of Data Acquisition Block

The data acquisition board itself actually works by sampling the composite analog signal
at fixed time intervals. The exact sampling interval corresponds to the sampling
frequency of the board itself. What the data acquisition board is able to produce is
essentially a table of values that correspond to the value of the composite signal at each
sampled point in time. It is this signal—the digital representation of the analog
composite signal, that is actually sent to the PC’s processing software system.

Therefore, the data acquisition board is also a communication device between the
systems I/O and the personal computer. This communication is accomplished through an
operating system facility called Windows Real-Time Target. The Windows Real-Time
Target interface allows information to communicate (in real-time) with the Windows
operating system (in this case XP). Using Windows Real Time-Target is a huge
advantage in the development of the AGT. It allows software running on the PC
(MATLAB), which is easily changed, to be executed quickly using the analog real-time
signal input.

This subsystem is the heart of the entire automatic tuning process and must meet the
following criterion:

        Sampling rate must meet or exceed the minimum tolerance discovered in first
         semester’s lab.
        There must be at least 1 analog input (composite guitar pickup signal).
        There must be 12 digital outputs (2 for each motor).
        The board must be compatible with Windows Real-Time Target and
        Must use a PCI interface with the personal computer.
        The board must sustain many years of use for future Grove City College

Processing Software

 Strum Signal
 from DAB                                                                  Motor control
                       DSP                           Control               signals to DAB
                       Software 6x                   Software 6x           6x

                             Figure 6: Software block diagram.

The processing software subsection performs all processing necessary to tune the guitar.
This is accomplished through two subsystem, the DSP software subsystem and the
control software subsystem. The DSP software’s purpose is to determine the frequency of
each string. The control software subsystem uses frequency information to determine
what signals must be sent to the motor controllers, via the data acquisition board, in order
to tune the strings.

Filtering Software

After the data acquisition board converts a signal from the guitar from an analog format
to a digital format, it is passed on to the DSP software. The data will be in the form of a
table of values of the signal at discrete moments in time. The purpose of the filtering
software is to take a noisy signal and to convert it to a ―useful‖ form. For the purposes of
this project, useful means that the signal will be comprised of a sinusoid of a certain
expected frequency (this frequency should be within 10 cents of the strings nominal
value). There may also be some noise in addition to this signal. The SEED lab will
determine how much smaller the amplitudes of the noise signals must be in order for the
filter to be deemed effective.

The specifications for the AGT say that it must be able to tune a note that is within 50
cents (one half step, see guitar section) of its target note. That means that the ideal filter
should be able to pass the band of frequencies 50 cents above and below the target
frequency and filter out any signals outside of that band. This, of course, cannot be
perfectly achieved in reality, but the ideal system will come as close as possible to
realizing this.

The filters for this project will be implemented in a digital form. Digital was chosen over
analog due to several of its advantages. First, digital filters are compact. An analog
system would require six large breadboard circuits. A digital system can be entirely
contained on a chip. Digital filters are also easier to debug. Modifying an analog system
requires swapping components in and out of a breadboard, which can require a great deal
of work, especially if the circuits are very complex. Worse yet, making changes to a
breadboard circuit can be quite expensive if new components are needed. The final
advantage of a digital filter is that it gives the user many more options than an analog
filter. MATLAB has a huge collection of built in filters. It also lets the programmer build

custom filters. To achieve such flexibility using analog methods would require large
hardware purchases.

The final system will not involve a single filter, but rather six filters in parallel. Each
filter will deal with a specific string. By using the six filters in parallel, it should be
possible to obtain a signal which is the composite of the fundamental signal from each
guitar string, with most of the noise removed. Sixth order Butterworth filters will be used
for this filtering. These filters were chosen for several reasons. In lab experiments,
Butterworth filters did an excellent job of realizing a single sinusoid from a strum signal.
Also Butterworth filters are very easily implemented in MATLAB. Sixth order filters
were chosen because they are the lowest order filter that obtained good results. Using
lower order filters is desirable because lower order processors use less memory and can
be computed faster.

The signals obtained by filtering each string should be nearly sinusoidal. Because of this,
the frequency of each string can be determined by counting zero crossings. For each
string, the number of high to low transitions in a certain window will be counted. This is
the number of periods in the window. This number is then divided by the size of the
window to determine the frequency.

The zero crossing method will be verified by performing a fast Fourier transform (FFT)
on the strum signal. This will yield the spectrum of the strum. In the spectrum there
should be six distinct peaks corresponding to the fundamental frequencies of each string.
These frequencies should match those found using the zero crossing method. If these
values do not match, then there is a problem with either the filtering or the zero crossing
counting. Poor filtering will not eliminate all the noise, which could interfere with finding
the correct frequency. The zero crossing method is simply an estimation; if the window
that the crossings are counted in is too small, then it may not be a good estimation. If it
turns out that there are problems with the zero crossing method that cannot be overcome,
then the frequency may have to be determined by using a FFT in the final design. This is
undesirable because the FFT will require significantly more processing power than the
zero crossing method, and because it will require the purchase of an additional toolbox
for MATLAB’s Realtime Windows Target.

Control Software

The control software uses the frequency information found by the DSP subsystem to
generate control signals to be sent to the stepper motor controllers via the data acquisition
board. If the DSP software is unable to determine the frequency of a string (this will most
likely be caused by the string not being plucked) the control software will take no action.

The stepper motor controllers have inputs for clock, clockwise or counterclockwise, and
full step or half step. For this project, the full step or half step input will be tied low so
that the motor always full steps. For each rise in the clock signal, the stepper motor
controller will generate the necessary signals to move the motor one step.

The first thing that must be determined is what direction the motor must be turned. The
frequency of each string, as determined by the DSP subsystem, will be compared with the
desired frequency of the string. If the frequency is too low, the string must be tightened,
and if it is too high the string must be loosened. The output on the data acquisition board
corresponding the clockwise or counter clockwise input will be set according to what
direction the string must be turned.

Two possible solutions exist for the clock input. The simplest solution would be to have
the input connected to a tri-state buffer, which is connected to a function generator, which
will supply the clock pulse. When the motor does not need to spin, the buffer will simply
be set to a high impedance state by the data acquisition board, and the motor will not
receive any clock pulses. Two problems exist with this method. One problem is that there
is no way of controlling the speed of the motor because the function generator clock
frequency will always be constant. The other problem is that when there is no clock pulse
to the driver, the driver will still output a voltage to the motor, which could potentially
cause the motor to heat up. A much better solution would be to allow the data acquisition
board to supply the motor drivers with a clock pulse. That solution will be discussed

The clock input will determine how fast the motor will turn (the frequency of the clock
signal) and how far the motor will turn (the number of clock pulses delivered to the
motor). It seems that the control can be implemented by simple proportional control. If
the string is very out of tune, a high frequency clock signal will be sent to the motor to
make it turn quickly. If the string is less out of tune, a lower frequency will be sent to the
motor to make it turn slowly. Elementary control theory can be used to determine the
relation between the frequency error and the motor speed necessary to obtain the correct
transient response (rise time, overshoot, settling time, etc) and steady-state response (the
deviation between the final value and the desired value). Ideally the system should
quickly reach the desired frequency but not overshoot the desired frequency by too much.

In the unlikely event that proportional control is not adequate (i.e. there is too much
overshoot, the system is too slow, or there is too much steady-state error) then
proportional or integral control may also be implemented. These control methods look
not only at the error, but the rate in change of the error (derivative) and the total error
integrated over time (integral). Because these methods would require additional
processing overhead, they will only be implemented if necessary.

It is desirable for the system to approximate real-time as closely as possible. Therefore as
the motors are turning at the set speed, the DSP software should be calculating the new
frequency of the string. Once this new frequency is found the motor speed can be
adjusted accordingly. This is not truly real-time, of course, because it takes the computer
a certain amount of time to calculate the frequency of the string, but it is the closest to
real-time control that can be implemented on a computer.

User Interface
This year’s AGT SEED Team is in the process of designing a proof-of-concept solution
to the problem of automatically tuning a guitar. A proof-of-concept solution is one in
which the final solution is not one which is completely ready to be marketed and sold to
customers. This allows for the designers to focus on solving the main problem – in this
case, tuning a guitar – instead of dealing with peripheral issues such as ergonomics, ease-
of-use, a fully integrated system, etc. Because the AGT is being designed for this SEED
Project as a proof-of-concept design, not every condition that the user will be required to
submit to in order to use the AGT is ideal. The main issue in this case is that the final
solution will most likely not be a fully integrated system. As such, the user will need to
use the AGT system in conjunction with a PC. However, the use of a PC will allow for
the user interface to be more interactive than would be possible with a fully integrated
system. This makes the design of user interface software something to be desired, both
for the purpose of experimentation and to maximize ease-of-use to the end user.

This user interface software is only in the very early stages of development. In fact, at
this point, only a very basic diagram exists for how the user interface might look on the
PC. This diagram is shown in the Overview Section in Figure 3. Graphics will be
included to show both the accuracy of each string’s tuning (for the end user), and the
frequency analysis of the composite input signal (for analysis and testing of the AGT). A
signal itself may also be displayed to the end user. In the case that the AGT SEED Team
is able to scale the final AGT design down to an embedded system, the user interface
software will be abandoned in favor of simple manual controls.

Control System

The AGT design implements stepper motors in order to turn the gears on the head of the
guitar, and thus tune the strings. The advantages of stepper motors include their small
size, precision, and ease of implementation. Small, lightweight motors will allow for a
non-invasive application. By mounting the motors at the head of the guitar, all of the
acoustic properties of the instrument will be left intact. The disadvantage of stepper
motors is that they draw current even when the shaft is not turning. This means that if the
motor is stopped, it needs to be disconnected from the power supply or it will overheat in
a matter of minutes.

The AGT group tested two different sized motors, one was 20mm in diameter and the
other was 26mm in diameter. Both motors operate on 5 volts and each has 4 leads. The
primary difference between the two motors is step size. The 26mm motor has 48 steps
per revolution (7.5 degrees per step) with a holding torque rated at 10.6oz-in. The 20mm
motor has 20 steps per revolution (18 degrees per step) and a holding torque rated at
11.3oz-in. The 20mm motor has a size advantage as well as marginally higher torque.
The obvious disadvantage of the 20mm motor is its lack of precision. However, this
problem may be mitigated by the implementation of large gear ratios.

The motors will tune the strings by directly interfacing with the gears at the top of the
guitar. This will be accomplished via the installation of open gears at the head of the
guitar, thus giving the AGT direct access to those gears. Each stepper motor will then be
outfitted with a gear and then interfaced with the gear at the head of the guitar. If this
gear ratio is large enough, then a step size of 18 degrees will be acceptable. It is expected
that the gear ratio will be greater than 10:1, which means that an 18 degree step would
turn the shaft over which the guitar string is wound less than 1.8 degrees. This presents a
very manageable situation.

Motor Drivers

The motors will be controlled via stepper motor drivers. A stepper motor driver is an
integrated circuit that accepts three digital signals that describe the desired motion of the
stepper motor. The driver will then output four digital waveforms, one for each lead of
the stepper motor. These waveforms are all of the same frequency, but each is shifted in
time. Thus each lead of the stepper motor has a different waveform.

The input signals include a clock signal that controls the angular speed of the motor, a
full/half step signal which determines the precision of the motor, and a directional signal
which determines whether the motor is to turn clockwise or counterclockwise. The
frequency of the clock signal is directly proportional to the angular speed of the shaft.
For example, if the clock frequency is set at 200Hz and then raised to 400Hz, the speed
of the motor will double. The full/half step signal will be hardwired to full step mode, as
discussed in the section on motors. The data acquisition board will provide one

directional and one enable signal for each motor. The directional signals will tell each
motor to turn clockwise or counter clockwise, depending on whether the string is sharp or

The enable function may be implemented in one of two ways. The first possibility is to
use an external function generator to generate a clock signal, and then pass that clock
signal through six tri-state buffers that are in parallel. This would then allow the enable
signal to be implemented via the tri-state buffer. Once a particular string is tuned, the tri-
state buffer will be set to a HI-Z state and effectively disconnect the clock signal from
that motor driver. The motor driver will then hold the motor in that position until the
clock signal resumes. The advantage of this method lies in its simplicity. It would be
very easy to set an output low or high while the string is being tuned, then simply toggle
it once the string is in tune. The primary disadvantages to this are that each motor will be
turned at the same rate and that more hardware is needed (i.e. a function generator and
tri-state buffers).

The second implementation of the enable function is to generate the clock signal for each
motor via the data acquisition board. This would involve generating six different clock
signals, one for each motor. When the string is in tune, the clock signal would then be set
low, thus stopping the motor. The advantages of this method is that less hardware is
required and each motor can be operated at a different speed. The disadvantage of this
would be more complicated code would have to be written in order to generate and
maintain six clock signals while also running code to analyze the output of the pickup.

              Figure 7: Pinout of Motorola SAA1042V stepper motor driver

The stepper motor driver that will be used in the AGT design will most likely be the
Motorola SAA1042V. These stepper motor drivers come in a 16-pin dual inline plastic
(DIP) package, as shown above. One of the key benefits of this particular chip is that it
has inputs that are compatible with MOS and TTL voltage levels. This particular driver
is capable of outputting a total current of 500mA. The largest motor that has been tested

for the AGT design has a current draw of about 430mA under full load. If larger motors
are required, the design may require another driver with more current output or some
external amplification circuitry. The maximum clock frequency for this chip is 50kHz.
This will be more than fast enough for the AGT design. Although formal experiments
have not yet allowed the team to determine the ideal clock frequency for the control
system, it is believed that a clock rate of about 1kHz should be very sufficient.

Stepper motors are very easy to control when paired with stepper motor drivers. All the
control software needs to produce is a directional signal and implement an on/off
function in order to drive the stepper motor. This setup allows for a very intuitive control
system design. Rather than generating four cryptic waveforms for each motor, while also
maintaining precise timing in order to maximize stepper motor performance, the design
only requires two self-explanatory signals.

The AGT system represents a fully digital solution to the task of tuning a guitar, this
group is aware of the potential that this system has for actual fabrication. If, in the future,
the AGT were to be produced and manufactured, some considerations would have to be
taken into account. The opportunity for scalability involved with a digital system is
remarkable, and the possibilities are quite diverse. The processors needed for this project
would not have to be very large at all. Obviously, no matter how small the digital
components of the system were able to get, however, a large device for motors would
need to be included. To actually be able to manufacture this product, the motors would
have to be removable from the guitar. Therefore, some sort of mechanical device that
was able to latch on to the head of the guitar would have to be built. Right now, this
group is not exactly sure how something like that should look. However, all parts
included in this device would be standard parts. For instance, a mechanism to grab the
machine head of the guitar would be of primary importance. There are parts available
that would be able to fit directly onto the guitar already – it would be sort of like a socket
wrench or even one of those devices they sell on TV to fit over any size bolt. Also,
depending on the guitar that is being used, the distance between machine heads would be
different. Therefore, the clamping mechanism would have to allow for sliding. To
accommodate this, the motors could be designed to run along some sort of track.

A final design which maximizes manufacturability is that system which minimizes, or
even completely eliminates, the use of a PC. This means that all of the DSP hardware
would be scaled down into a completely embedded system. This embedded system
would only require manual start and stop buttons, and perhaps a display to tell how
successful the tuning process was. This box could simply be made of plastic, and would
included all the circuitry and processors needed for the entire tuning system. A sample
system is shown below in Figure 8.

Figure 8: Prototype of What Manufactured AGT Might Look Like

Health & Safety
Fortunately for us, very little could go wrong while tuning a guitar. The only thing that
could possibly happen is over tightening a string and having it pop off, acting like a
sharp, deadly metal whip, gouging into the eye of a user, or worse, a completely innocent
bystander. However, this rarely happens. Nonetheless, to avoid this unfortunate
circumstance, the AGT is best designed with a maximum range for how far it will tune a
string. If this range is exceeded, an error condition will be entered and the tuning process
will be halted for that string. This is practically applied as follows: given that each string
can be no more than one-half step out of tune, the AGT will have a safety built in to
ensure that the motors will not continue to turn past a certain amount. With this safety
check in operation, there is little danger or no danger presented to the user by the tuning
system that has been presented in this paper.

The actual tuning process – from the digital sampling of the composite guitar signal, to
the filtering of this signal, to the generation of control signals – is completely controlled
by software. This software will never become bad, run down, or wear out. This is part of
the beauty of software. The life of this system will be completely dependant upon the life
of the hardware components. The actual circuitry – the integrated circuits, the wires, and
the motors – all represent components of this tuning system that can wear down and
break. Fortunately, the bulk of the tuning hardware, contained within the tuning box
(consult previous figure) is made up of pre-fabricated digital devices. Therefore, these
components have undergone intense testing, have safeguards in place to deal with heat
(i.e. – heat sinks), and can maintain operation for quite an extended period of time. The
AGT’s tuning box will be analogous to any other tuning device on the market; and these
devices last for a long time. The machine-head attachments, since they are able to slide
back and forth to accommodate guitars of differing sizes, will also be able to slide out
and unplug, allowing for replacement in the case of individual damage. The same will be
true for the motors, which will be removable.

The difficulty with the motors is, in the event of failure, whether it is the motor itself that
has gone bad, or the motor driver, which is just an integrated circuit chip. In either case,
a trained technician would be able to make this distinction and would also be qualified in
replacing a motor driver. Any user, as stated above, should be able to replace a motor.

Again, this device would use standard hardware and motors. No dangerous materials
whatsoever would be included in this product. In fact, because of the actual size of the
devices, little waste at all would be created. The power supply would most likely be a
standard 9V battery. The environmental issues involved in the disposal of a single
battery are all but negligible. Furthermore, processes are already in place in many areas –
either privately run or under the jurisdiction of local governments – which assist a local
resident in disposing of a battery in an environmentally safe manner; thus, this concern
can be ignored in the design of the AGT itself. Therefore, no environmental concerns
come in to play for this device.

Future Work
Future work for the AGT team has been integrated throughout this document. However
Figure 9 contains a Gantt chart of specific dates and deadlines.

Figure 9: AGT Gantt chart.

Once again, this system design paper is for an automatic guitar tuning system. Very
simply, it is a design outline of a fully automated, fully digital tuning system. As this
paper has shown, the automatic guitar tuning system is a complicated and involved
system consisting of many components and subcomponents. Each of these components
has been described within the context of its specific role in the overall tuning system.

Specifically, an outline of the group’s strategy for obtaining an analog signal using the
guitar’s pickup was discussed. Details of the data acquisition board as a link between the
analog world and digital world were explained. This paper fully addressed issues
concerning signal processing, filtering, and control signal generation, as well as
application of control signal information to actual motor control. Precise tolerances were
set forth and outlined clearly so that both the reader and this project team could
understand more clearly the nature of this project and the implications of its design. With
this information provided as a basic system design overview, it is clear that the
propositions set forth by this work are both feasible and realistic.

There is much work left for this project team to do. Specifically, the research that has
already been conducted will be used as a basis for the lab experimentation that is yet to
take place. Through lab experiments that have been accomplished already, the
foundation for implementation has been laid. This group is looking forward to next

Appendix A
This appendix contains the MATLAB M-File which implements the AGT.
%SEED Project--AGT
%Nathan Dietrich
%Nick Marangoni
%Josh Michulka
%Dan Moch
%Greg Sinsley
%This program will input a data structure of a signal from SigLab, pass
%it through 6 separate bandpass filter systems, plot each sinusoid
%and find its frequency
%Input data structure from SigLab and plot the same diagram that can be
%seen in the SigLab window
channel = 1;
%Define the values for the order of the filter, Rp in dB, each of the 6
%frequency values and the mathematical expression for one half-step in
%either direction
%Create transfer functions for all 6 filters

WnELow=factor*[ELow*StepDown ELow*StepUp];
[el2,el1] = butter(filterOrder,WnELow);

WnA=factor*[A*StepDown A*StepUp];
[a2,a1] = butter(filterOrder,WnA);

WnD=factor*[D*StepDown D*StepUp];
[d2,d1] = butter(filterOrder,WnD);

WnG=factor*[G*StepDown G*StepUp];
[g2,g1] = butter(filterOrder,WnG);

WnB=factor*[B*StepDown B*StepUp];
[b2,b1] = butter(filterOrder,WnB);

WnEHigh=factor*[EHigh*StepDown EHigh*StepUp];
[eh2,eh1] = butter(filterOrder,WnEHigh);
%Process the Low E String:
%calculate the pass band, plot the filtered signal, find the zero
%crossings, and display the frequency


valuesELowOut = ELowOut.signals.values - slide;

bypassELow = round(0.2.*length(ELowOut.signals.values));
for z=bypassELow:length(valuesELowOut)
    if (valuesELowOut(z) < 0 & valuesELowOut(z-1) > 0)
    elseif (valuesELowOut(z) > 0 & valuesELowOut(z-1) < 0)
if (freqELow < ELow*StepDown | freqELow > ELow*StepUp)
%Process the A String: Define the transfer function for the filter,
%calculate the pass band, plot the filtered signal, find the zero
%crossings, and display the frequency


valuesAOut = AOut.signals.values - slide;
for z=2:length(valuesAOut)
    if (valuesAOut(z) < 0 & valuesAOut(z-1) > 0)
    elseif (valuesAOut(z) > 0 & valuesAOut(z-1) < 0)
if (freqA < A*StepDown | freqA > A*StepUp)
%Process the D String: Define the transfer function for the filter,
%calculate the pass band, plot the filtered signal, find the zero
%crossings, and display the frequency


valuesDOut = DOut.signals.values - slide;

for z=2:length(valuesDOut)
    if (valuesDOut(z) < 0 & valuesDOut(z-1) > 0)
    elseif (valuesDOut(z) > 0 & valuesDOut(z-1) < 0)
if (freqD < D*StepDown | freqD > D*StepUp)
%Process the G String: Define the transfer function for the filter,
%calculate the pass band, plot the filtered signal, find the zero
%crossings, and display the frequency


valuesGOut = GOut.signals.values - slide;
for z=2:length(valuesGOut)
    if (valuesGOut(z) < 0 & valuesGOut(z-1) > 0)
    elseif (valuesGOut(z) > 0 & valuesGOut(z-1) < 0)
if (freqG < G*StepDown | freqG > G*StepUp)
%Process the B String: Define the transfer function for the filter,
%calculate the pass band, plot the filtered signal, find the zero
%crossings, and display the frequency


valuesBOut = BOut.signals.values - slide;
for z=2:length(valuesBOut)
    if (valuesBOut(z) < 0 & valuesBOut(z-1) > 0)
    elseif (valuesBOut(z) > 0 & valuesBOut(z-1) < 0)
if (freqB < B*StepDown | freqB > B*StepUp)
%Process the High E String: Define the transfer function for the filter,
%calculate the pass band, plot the filtered signal, find the zero
%crossings, and display the frequency



valuesEHighOut = EHighOut.signals.values - slide;
for z=2:length(valuesEHighOut)
    if (valuesEHighOut(z) < 0 & valuesEHighOut(z-1) > 0)
    elseif (valuesEHighOut(z) > 0 & valuesEHighOut(z-1) < 0)
if (freqEHigh < EHigh*StepDown | freqEHigh > EHigh*StepUp)

Appendix B
Appendix B contains a Simulink model showing six discrete bandpass filters.


To top