Docsity

Automatic Guitar Player - Project Report | ECE 395, Study Guides, Projects, Research of Electrical and Electronics Engineering

Partial preview of the text

Download Automatic Guitar Player - Project Report | ECE 395 and more Study Guides, Projects, Research Electrical and Electronics Engineering in PDF only on Docsity!

ECE 395 Project:

Automatic Guitar Player

Lucas Sturnfield

Mauricio Herrera

Spring 2008

Contents

1 Abstract

2 Introductions

3 Design Components

3.1 Fretting/Fingering Mechanism

3.1.1 Physical Structure

3.1.2 Position Determination

3.1.3 Reference State Configuration

3.1.4 Pictures

3.2 Motor/Actuator Control Systems

3.3 External MIDI Input System

3.4 PIC Microcontroller Control System

3.5 Strumming/Picking Mechanism

4 Conclusions

expected. These obstacles were usually overcome, but the ones that are still in evidence

are detailed in the sections of this report documenting the particular components.

3 Design Components

3.1 Fingering/Fretting Mechanism

This portion of the project was meant to mimic the chording of notes that occurs during a guitar’s

recital. There are many engineering components to this functionality. Our design took into account

the following as the major components:

A. Physical Structure

B. Position Determination

C. Reference State Configuration

D. Pictures

3.1.1 Physical Structure

The first mistake of our design was to build the structure from scrap materials, using the hand tools

available in the lab. Simply, it is near impossible to build a structure to meet our needs with essentially

no ability for reference alignment and out of materials that do not lend themselves to easily adjustment.

To begin our design process, we constructed a virtual model of the system we wanted to build, as seen

below:

This model was quickly proven to be unrealistic. The width of the neck of the guitar is

around 5cm. This means that the maximum girth of the center trolley (diagramed

above) would have to be 4.5cm, leaving 0.25cm on either side for the impact hammers

from its neighboring trolleys to have room to reach the strings. As you can see from the

following picture of our original trolley design, it is quite hard to hand build a trolley to

these specifications when using only components acquired from the lab.

This prompted a fundamental redesign of our

approach to the physical structure. Since the

solenoids were the deciding factor on how big their

support trolleys had to be, and since we were

limited to only the solenoids that we had available,

we redesigned our system to eliminate the need for

trolleys.

This redesign is our current approach to the

physical structure. Rather than having a separate

trolley for each string with each individually

transversing a parallel path to their respective

strings via a screw drive system, we moved to a

lever arm system, as shown below:

The idea behind this system is that a coupler on the screw drive will connect the motor’s

positioning functionality with the impact hammer’s fingering functionality. As the

motor turns, this coupler follows the screw drive, bring the attached lever arm with it.

The encoder would trigger each time a spoke on the fly wheel passes. Since our

flywheels were designed with 6 spokes, this means that 6 trigger signals correspond to

one complete revolution of the screw rod. Since there are 20 threads per inch, this

means that the rod would have to revolve 20 times for a linear distance of 1”.

Otherwise stated, it is understood that 120 trigger signals means the lever arm has

moved 1 inch.

3.1.3 Reference Position Determination

It is vital that the initial position of the lever arm be known to the control system. To

accomplish this, we mounted a trigger switch on the ends of the guide rail system. We

also placed a bump pin on the tops of the lever arms. The placement of the pin and the

switch was done in such a way that as the motor was spinning backwards, driving the

coupler toward it, the pin would hit the switch before the coupler crashed into the motor.

Our control system used this as a configuration process. It runs the each motor

backwards until that string system’s switch is triggered, then runs the motor forward

until the switch is no longer triggered. In this way, we are able to set the precise starting

position of the system.

3.1.3 Pictures

The following are pictures detailing what the physical structure currently looks like.

3.2 Fingering/Fretting Mechanism

since its inputs can be mapped to a piano keyboard, it made for easy translation between

musical notes and data input. The MIDI protocol is also quite simple and allowed us

more than enough data to control what we would want with our robotic player.

On the next page you will find a MIDI look-up table which translates a key/note pressed

on a keyboard to a MIDI note number that is passed via the standard MIDI DIN 5/180°

connector cable. The following diagram is a mapping of all the notes for the first four

five frets on a guitar in standard tuning.

E ||--F--|F#/Gb|--G--|G#/Ab| *-A--|--

B ||--C--|C#/Db|--D--|D#/Eb| *-E--|--

G ||G#/Ab|--A--|A#/Bb|--B--| *----|--

D ||D#/Eb|--E--|--F--|F#/Gb| *-G--|--

A ||A#/Bb|--B--|--C--|C#/Db| *-D--|--

E ||--F--|F#/Gb|--G--|G#/Ab| *-A--|--

Musical Note to MIDI Note Number Mappings

The following table is a simplification of the previous two diagrams, combining the

MIDI Note numbers with the notes of interest for the first five frets of the guitar:

|| || || || || || || ||

_/ _____________/ ___________________/

1=status command bits channel

byte 001 = note on (add +1)-->0000 = ch.

000 = note off 0001 = ch.2 etc.

The next 3 bits denote ‘note on’ or ‘note off’ commands, thus enabling playing or

turning off a note. MIDI also allows for sending data to more than one device via the 4

channel # bits. Since we are only using one device, only the first channel would be

used.

  • 2 byte of data (for note on/off command)

___ ___ ___ ___ ___ ___ ___ ___

|| || || || || || || ||

_____________________________________/

note

___ ___ ___ ___ ___ ___ ___ ___

|| || || || || || || ||

_____________________________________/

velocity

The next two bytes of data, each denoted by a ‘0’ in the most significant bit, send

information about the note to be played and the ‘velocity’. For most applications of

MIDI velocity is used as control for a tremolo/vibrato like effect, but technically it’s

open to whatever functionality it is given in code. For our purposes, we only need the

first two bytes of data, so the third can be safely ignored.

Below is the basic circuit required to take translate a MIDI input controller into a serial

data input that a PIC can use:

For our project we used a Motorolla MOC5008 opto-isolator.

3.4 PIC Microcontroller Control System

We chose to use a PIC16F877A microcontroller for our project mainly because they

were readily available at the Electronics Shop, but their versatility and range of

applications also proved to be more than what we needed for this project. We used

MPLAB-IDE also mainly because it was readily available on all the computers in the

lab, and it also proved to be a very practical since we could write our code and load it

onto our PICs using the same program. We chose to use the PIC-C compiler because of

our familiarity with the C programming language and because it allowed us more

flexibility as our project evolved through the various development stages.

The goal of the project was to have an independent PIC for each string that would keep

track of moving the arm assembly for only that arm as well as any motor/solenoid

controls and associated inputs (encoder, calibration switch). A master PIC would be

used to receive global On/Off/Reset controls as well as the MIDI controller inputs and

delegate destinations to the other slaved PICs via I2C. The block diagram on the next

page shows the overall logic flow diagram.

Our code breaks down the project into various functioning blocks. On system startup

(On button press) a calibration is performed where each arm is moved towards their

starting position. Upon reaching the toggle switch as described in section 3.1.2 above,

the system initializes each arm position. A separate module within the code takes care

of keeping track of the current arm position (determined by whether this initializing

toggle switch is hit, thereafter by adding or subtracting encoder pulse inputs depending

on the motor direction). The master PIC constantly updates each individual PIC with

We were able to have printed circuit boards made for our individual arm

microcontrollers, as shown in the picture below:

Please refer to the Eagle board schematic in our documentation files for full parts and

specs. Below is the breadboarded prototype for our MIDI input and master control PIC:

3.5 Strumming/Picking Mechanism

We were unable to begin the design of this portion of the project during the Spring 2008

semester. Currently our solution is to manually strum the strings when a note is to be

played.

4 Conclusions

This was a fun project to work on, but it requires more precision than the round-about

construction approach we took thus far. Basically, the continuation of this project will

require that the physical structure be machined in metal. Also, our controls code had to

be redone because the first set of code written didn’t work as intended. We also found

that we required more torque than we had initially anticipated to move our trolley arms.

There also seems to be some sort of logic miscommunication as the motors ‘stutter’ as

they move through subsequent encoder pulses. A more efficient working motor/encoder

system may need to be evaluated in future revisions.