The idea behind this little experiment (and another one that I have in mind) is to include the physical world into the guitar effects chain: usually these effects simply act to an explicit interaction, the foot movement on a pedal, but why not include the guitar movements? This first experiment, in particular, uses an accelerometer to variate the output of a Wah pedal, depending on the inclination of the neck of the guitar itself.
Collect the informations
The first part of the circuit is all about getting data from the accelerometer and sending them to drive the effect. The accelerometer (a triple-axis model) is connected to a Telosb platform through a small prototipying board; the internal software (TinyOS, of course) samples the three ADCs (one for each axis) by mediating 10 consequent samples, packs the three 2-byte values into a packet and sends them through the radio. This operation is performed about 20 times per second. No radio power management is done here (I don’t really care about batteries to last only a few hours or days).
A second Telosb receives the radio packets. Now, the natural follow-up would be for the Telosb itself to drive a digital pot (through I2C, for example), but from this point of view the MSP430, the Telosb microcontroller, sucks A LOT: it has two multi-purpose hardware ports (called USART), each of them has a UART and a SPI interface, and one of them has also a I2C interface. One SPI is not connected in the board, while the other SPI and the I2C are already used by the radio, in the same port that has one UART (the other UART goes to a FTDI chip that sends data through the USB port). This means that driving the hardware port and communicating with the radio means having to share the resources and manage them so that only one is active at a time. I have to say that I was quite scared by this, first of all because TinyOS is not easy to be used to develop applications, and secondly because I am sending so many packets through the radio that I don’t know if timing was enough to start and stop each interface every time.
Thus, I decided to use an Arduino with an USB Host shield: in this way, the Telosb simply takes the radio packets and routes them to the usual USB serial port; the Arduino receives the data, unpackets the three accelerometer values, uses them in a moving average (to avoid too sudden movements) and puts the current value to a digital pot. In the end, I am using only one of the three axes (the X axis), and discarding the other two.
I decided to use a wah pedal as the best effect to be driven by these movements, and I decided to use this schematic, with a couple of modifications; the interesting thing about this circuit is that an inductor, usually the essential part of a wah, is not needed: it just needs a transistor and several resistors and capacitors. The modifications are the two resistors R4 and R10, and the electrolytic capacitor and the diode on the power line on top (C1 and D1).
There are two different power supplies: 9V are provided by a battery, while the Arduino is powered separately and provides the 5V needed by the digital pot; this is done to avoid introducing noise to the effect, because the Arduino is also powering the Telosb radio.
The first tests have been made with a sketch on Processing showing a 3D box moving according to the accelerometer values; I have published several videos showing all these tests, with Arduino first and with the Telosb later. The final circuit is shown here (for some reasons the video is quite accelerated, I have no idea why but I think it involves the fact that all these videos are without an audio track, and Youtube does something wrong when loading them…), and I have added a brief video showing the result down here. The audio quality is quite low, I have recorded it with a microphone and not with an acquisition device, but for now it will suffice.
I am not completely satisfied with the final result: trying a guitar effect on a breadboard is quite hard, because any movement of the wires introduces some noise, and it probably also lowers the effect of having capacitors in the circuit. I would try to move the circuit at least on a prototipying board, then lower the sampling timing again, from 50 ms to maybe 25-30 ms and see if the rest of the circuit is able to cope with it; also removing the Arduino and allowing the sink to directly drive the pot would lower the latency, but again the MSP430 makes it quite difficult (and I don’t have radio devices for the Arduinos, like for example the XBee shields). Bluetooth could be a solution to use a single platform (I already have a bluetooth shield for Arduino, and the USB Host supports some dongles). Also the moving average window could be reduced, to allow the effect to act quicker.
I think I will try also using a membrane like these instead of the accelerometer, to link the wah gain to the position of the left hand on the guitar neck (the membrane would be in the back of the neck), thus to the pitch of the music (higher pitch in general means the hand is nearer to the body of the guitar, lower pitch means the hand is farther away)… will see.