Remote Controlled Wiitar
(→Hall Effect Sensor Circuit)
(→Hall Effect Sensor Circuit)
Revision as of 02:51, 18 March 2010
- Nathan Hirsch - Mechanical Engineering - Class of 2010
- George Randolph - Mechanical Engineering - Class of 2010
The goal of our project was to create a system that allows a user to use a remote control to play a guitar. The Remote Controlled Wiitar uses a Nintendo Wii Remote to control an array of solenoids and a motor that are capable of playing several different chords on a guitar.
Our design consisted of two major components. The solenoid bridge, which was responsible for depressing strings on the neck of the guitar, and the strumming bridge, which was responsible for strumming the strings of the guitar.
The solenoid bridge was constructed out of wood. Its table shape was designed to allow the neck of the guitar to fit under it, with enough clearance for several solenoids to be attached to the underside of the bridge.
Brackets made of eighth inch aluminum sheet metal were fashioned to mount the solenoids on the bridge. The brackets also included holes where elastic cable was attached. The elastic cable retracted the solenoids when they were not powered.
The solenoids were originally attached to bridge using nuts and bolts. Though this worked, it was difficult to attach the solenoids precisely enough to accurately depress the guitar strings. In the final design, Velcro was used instead of nuts and bolts. This allowed for more precise mounting of the solenoids on the solenoid bridge and facilitated easy reconfiguration of the solenoids into different chord shapes. A second solenoid bridge was added in the final design to allow additional notes to be fretted near the body of the guitar.
The strumming bridge was also constructed out of wood. Two 2x4 legs were cut and connected at the top by a strip of plywood. The strumming bridge was designed to allow the body of the guitar to fit underneath, with enough clearance for a strumming arm to sweep across the strings.
The motor was attached at the center of the top of the strumming bridge using nuts and bolts. A thin plywood strip that served as a strummer was attached to the shaft of the motor using a set screw. The circular motion of the motor caused the strummer to be closer to the guitar strings in the center than the guitar strings on the outside. For this reason, a rotational spring was attached to one side of the strummer which deflected as it swept across the springs resulting in an even strum.
A hall effect sensor was mounted about six inches from the motor on the strumming bridge. A magnet was attached to the strummer that aligned with the hall effect sensor when the strummer was parallel to the ground. When these components were aligned, the hall effect sensor sent signals to the PIC, providing feedback on the position of the strummer.
The circuity used to control the Wiitar is relatively simple. The figure to the right shows the basic concept of our project. The Wiimote communicates with a laptop via Bluetooth. Whenever a user shakes the Wiimote or presses a button on the Wiimote, a signal is sent to the computer. The computer then sends a message to the PIC via RS 232. The PIC takes those signals and outputs voltages to control the solenoids or strum the guitar, depending on the signal from the Wiimote.
Fortunately, not very many electrical components are required to build the necessary circuitry to control the Wiitar. The parts that are needed can all be found in the mechatronics lab.
- PIC 32 microcontroller
- 100 Ω, 1 KΩ resistors and a 10 KΩ potentiometer
- 0.1 uF capacitor
- LM311N voltage comparator
- L293D H-Bridge
- Hall Effect Sensor
- NPN Darlington Pair Transistors
- Computer with Bluetooth
The motor that drive the strummer is operated by the PIC. The circuit to the right gives pin-outs and shows how to connect the motor to the PIC. Three pins on the PIC are used. A direction pin, an enable pin and a pin for PWM. The following table shows how they are related
The H-Bridge we used to drive the motor was an L293D. It's data sheet can be found here
Hall Effect Sensor Circuit
We used a hall effect sensor to monitor the position of the strummer. The concept behind a hall effect sensor is simple: it's a device that senses a change in magnetic fields. So, if a magnet is waved across the sensor, it outputs varying voltages. We put a pill magnet on one end of the strummer bar so when the motor spun, the hall effect sensor could detect the bar's rotation. The hall effect sensor basically acted like an ultra-low encoder, but worked for our purposes. The hall effect sensor was an A2340LUA-T which is stocked in the mechatronics lab. Its data sheet can be found here.
The graphic at the right illustrates the circuit we used to hook up the hall sensor. There is an LED and 1 KΩ in the hall sensor portion of the circuit. This is just used as feedback. When a magnet is in the vicinity of the sensor, the light will turn on. If that doesn't happen, then the circuit is wired incorrectly.
The circuit outputs HI when the hall sensor is engaged and LOW when not. However, a hall effect sensor is an analog device. We needed it to output either high or low and not voltages in between. To solve this problem, we used a LM2907-8 voltage comparator. This chip is basically a really fancy op-amp. It's data sheet can be downloaded here.
We used the comparator to compare the voltage coming from the hall sensor against some variable threshold which we set. The inverting input of the comparator was connected to the output of the hall sensor and the noninverting input was connected to a 10 KΩ potentiometer. By playing with the resistance of the potentiometer, we were able to set the comparator to the correct sensitivity level. A pull up resistor was connected to the output so that the comparator had sensible outputs. That is, we wanted the comparator to output HI when the LED was on (and thus when the magnet was near the hall sensor) and not the other way around.
Results and Reflections
When we first envisioned the Remote Controlled Wiitar, we wanted to create a system that could play many different chords and songs very easily. We originally wanted an array of eighteen solenoids (one for each string on the first three frets) that would allow us to play dozens of chords and thousands of songs. Our final project had only six solenoids and could play a grand total of three chords.
Despite a creating a system that was simpler than intended, our project was very successful. At the beginning of the quarter, we had limited knowledge of electronic circuitry, no knowledge of microcontrollers, and almost no experience programming in C. Using knowledge that we gained throughout the quarter, we were able to design and build a system that was fun for anyone to use and could control a guitar using a Wii Remote.
There are many things that we could have done to improve our project. Perhaps the largest problem we encountered was the fact that the smallest solenoids available to us were too large to fit more than a couple solenoids per fret on the guitar. This was the main reason for the simplification of the solenoid array from eighteen solenoids to only six. To fix this problem, we could have positioned the solenoids away from the neck of the guitar and used a system of levers to push the guitar strings. This would have allowed us to depress more strings and enabled us to play more chords.
Another improvement would be made to the strummer. We wanted to be able to strum the strings up and down, but our final system could only strum down (from the lowest string to the highest). This was primarily an issue of feedback. We decided early in our project that we did not need the resolution of an encoder to control the strumming bar, so we opted for a hall effect sensor instead. We quickly realized that there was significant overshoot when using the feedback from the hall effect sensor that prevented us from being able to strum the strings in both directions. Had we used an encoder, we would have had better control over the position of the strummer and we would have been able to strum both up and down.
There was also talk of adding a "player piano" mode to our system. This mode would have had the PIC automatically play a song using timed strums and chord changes without input from a Wii Remote. Due to a number of other issues we were having with our project, we did not have time to add the player piano mode. This would have been a great addition to the system that could have really demonstrated its capabilities.
Over the course of building our Wiitar, we burnt out one PIC. We noticed that when the PIC was powered on it was getting very hot, even when it was completely disconnected from the rest of our circuit. We could not find the cause of this, but we suspect that something on the PIC board was shorting. When a new PIC was placed into the circuit, the system returned to functioning properly.
Despite having little experience in electronic design or programming, most of our issues were a result of mechanical problems. The underlying circuitry and code functioned exactly as originally planned. Coding entirely in C, we were able to receive signals from a Wii Remote on a computer, relay those signals to our PIC using RS232 communication, and have the PIC depress appropriate guitar strings and strum a guitar. Learning how to do all of this and applying it to our project was our greatest success.