Mar 23, 2010 - 25 Comments - Interactive systems, Music -

Look, ma, no wiimote!

(UPDATE: 2 new features, with videos, at the end of the post)

I thought I could improve my previous design, so I ordered some toys from Sparkfun:

– An Arduino Pro Mini

– A pair of 2mW Xbees with chip antenna

– An Xbee explorer regulated

– An Xbee shield and an Ethernet Shield

– A FTDI breakout

– … and some other glue accesories.

I had several objetives in mind. The first one was to  improve the design so I wouln’t have to depend on the Wiimote (and its external cabling). Second, I didn’t want to depend on Bluetooth, due to its (supposed) limited range. Third, since I’m very new in the microcontroller business, I wanted to learn how to wirelessly connect Arduinos. I also wanted to do something that in the end could be very open and very easy to use with any platform. Finally, I wanted to have fun! Then I considered this idea:

Replace Mac with any ethernet-equipped computer you want

This way you could interface with a wide variety of hardware computers and sofware. Of course, you could link to the computer via a serial link, but I considered the OSC option much more interesting.

1. The Transmitter circuit(s). I had to put together 3 blocks: Arduino Pro Mini+Xbee+Xbee explorer, the nunchuck guts and a power stage. This last block was necessary because the Nunchuck needs to be powered by 3.3 volts, but the Pro Mini I bought supplies 5 volts (it can be fed with 5 to 12 volts). There’s a version of the Pro Mini which works at 3.3 volts, but at the half of the speed (8MHz, in contrast to 16MHz of the 5V version). It might have been a good idea to have used the 3.3V version but I wanted the maximum speed possible. However I have to admit that I’m not sure if that extra power is really necessary for this application… anyway, I used a 3.3V regulator with the corresponding decoupling capacitors, a 10nF on the input and 10uF on output, as suggested in the datasheet:

Power stage diagram

Power stage diagram

And this is how it looks:

Power stage, embellished

I cut the Nunchuck cable releasing the 5 smaller cables inside. The green cable is the SDA (data) line, and the yellow one is the SCL (clock). These must be connected to inputs 4 and 5 of the Arduino Pro Mini, because the I2C protocol uses these specific ports (see the Wire library documentation). This is how the Nunchuck should be wired. You can safely ignore and cut the black cable:

Wired guts

Wired Guts

The Arduino pro mini can be fed directly from the batery into its RAW port. For easier debugging, I soldered some male headers to the Arduino, and female headers to the Xbee explorer.

FTDI+Arduino

This way I could easily connect the Arduino to the FTDI breakout for programming (as shown in previous picture) and to the Xbee explorer for testing the circuit. The pinouts of all the components fit perfectly with this setup.

2. Installing the Transmitter. I had some troubles with the orientation of the Nunchuck I previously used, and I also wanted to increase the visual impact of the design, so I re-created the back cover of my guitar:

Back cover

Back cover

I cut it from a transparend DVD box. Then I measured very carefully (ok, not so much) every block I had to put inside, and drilled the necessary holes for the plastic bolts which would hold the circuit boards:

Ready to go inside the guitar

Same from this side

I was worried that the microcontroller could touch a potentiometer inside the guitar and cause a short, so I made a small cover for it out of a plastic folder:

Arduino, undercover

I just connected a 9V battery to the regulator and finally closed the thing. This is how it looks:

Hey! I can see through your blouse!

And you are hot, baby!

The whole thing.

Pretty neat, huh? For the curious, it’s a Vampire Red Schecter 006 Deluxe. It’s an expensive, but very good quality guitar, and the only electric I own, so I’ve been very careful with it.

3. The receiver. The receiver is basically a Duemilanova with a Xbee shield on top of an Ethernet shield:

The receiver

The problem with it is that the Xbee shield uses the ICSP connector for power (and maybe something else), so when I sandwich the Ethernet shield in-between, the Xbee loses those pins. That’s the explanation of those ugly green cables:

Ugly cables

At this point, the USB cable is just for powering the Duemilanova, because all data is sent to the computer through the Ethernet port, in OSC form. Now the software part.

4. Program the Xbees. This was the most painful step, not because it’s hard, but because there’s no “definite guide” to do it. There are some things that depend upon the application, and there are some others which I think each person has to learn in the way. The steps for doing this are beyond the scope of this post, however, there are a few good tutorials in the Net. I personally used information from the Ladyada tutorial, (though it’s better if you have the Xbee adapter kit from Adafruit Industries) and specially this “How-to: Setting up XBee ZNet 2.5 (Series 2) modules“, by caimaver@yahoo.com. Also, this document is useful to understand the AT commands that can be used with the Xbee. In any case, it’s a good idea to install the X-CTU utility, and also the latest Xbee firmware. The problem with the X-CTU program is that it only runs on Windows, so take that into account (it can also be run in a virtual Windows installation, using VirtualBox, or other virtualization programs). Some Xbee parameters can be programmed using a terminal program, but some others not. In my case, I programmed the Receiver as a “ZNET 2.5 COORDINATOR AT”, and the Transmitter as a “ZNET 2.5 ROUTER/END DEVICE AT”. I used a baud rate of 57600, used a different Pan ID than the default and labeled the nodes with some string.

5. Code for the Transmitter. Well, I started with the nunchuck guts from my previous design, so I didn’t need to buy a new accelerometer. Also, I wanted to give a try to the I2C protocol which is used in the Wiimote-to-Nunchuck connection and is supported by the Arduino. For that, I checked the nunchuck_funcs.h library written by Tod E. Kurt. I also used his WiiChuck adapter, which can also be found in Sparkfun. That way I could debug the Transmitter code in the Duemilanova before uploading it to the Pro Mini with the Nunchuck soldered to it. Download the code from here. It transmits data from accelerometer, two continuous controllers and two push buttons (which I am not currently using), when it detects a change in the input, polling at intervals of 1 millisecond, and sends the data through the serial link formatted like this:

acc xxx xxx xxx
cca xxx
ccb xxx
bta x
btb x

Where acc is the accelerometer data, cca and ccb the continuous controllers and bta and btb the push buttond.

6. Code for the Receiver. The receiver uses the Ethernet library, the excellent Recotana ArdOSC library and the Messenger library, by Thomas Ouellet Fredericks (for parsing serial input).  Download the code from here. You’ll notice that both, the receiver and the transmitter code are pretty simple. The receiver parses the serial input and generates OSC messages according to this address space:

/guit/acc , fff
/guit/cca , f
/guit/ccb , f
/guit/bta , f
/guit/btb , f

I think the addresing could be improved, specially the data types.

That’s all. I’ll post some video soon (I hope) Done! Here you can see how the guitar controlling Pure Data:

UPDATE:

I added a ribbon controller to increase the interaction possibilities. It’s a SoftPot connected to the unused potentiometer input of the Nunchuck:

I had unstable readings from the SoftPot, but I’m not sure if it’s due to the SofPot or to the Nunchuck. For now, I’m correcting that behavior within PureData.

I also implemented a very simple auto power-off mechanism. It’s very similar to those found in guitars and basses with active pickups. I simply replaced the original mono jack in the guitar with a stereo one, and wired it like this:

Auto power-off.

This way, when I connect a standard mono guitar cable, the battery gets connected powering up the internal circuit. Just in case you don’t believe me, you can see it working here:

I hope you enjoyed it.

Thanks for reading!

JP

25 Responses to Look, ma, no wiimote!

  1. Belén

    Hijo, para entender eso, creo que hay que ser ingeniero electrónico. Se ve que ha sido un arduo, creativo y muy inteligente trabajo. Yo de verdad te felicito y te reitero mi convencimiento de que tu eres capaz de cualquier cosa. Un abrazo con toda mi admiración. Te amo

    23 Mar 2010 - Reply
  2. Justin

    Hey dude, k guay!

    reminds me a bit of a project I did for a course when I was doing the Masters 🙂
    (our hardware setup was a lot more “cutre” though…)

    http://www.youtube.com/watch?v=RPHAXM7az1Q

    24 Mar 2010 - Reply
  3. POLLO

    Hijo tu mamá tiene toda la razón, que pasa si se le cae a uno la guitarra… hace el mismo ruido que una de Woodstock o la puedes modular durante la caida___???

    24 Mar 2010 - Reply
  4. Alex

    Hijo la verdad es un descreste, me lleva en la buena cuando salga la juanpa’s stratocaster.

    Un abrazo

    24 Mar 2010 - Reply
  5. Pin

    Hermosito, me encanta lo dedicado e inteligente que eres.
    Un nerd bonito.
    Vas a ver que esto es de publicación!!
    Bisous, mon petit jolie!

    25 Mar 2010 - Reply
  6. Guitar controller update. « JP's blog

    […] in case you are interested, I added a pair of new features to my design. Take a look at them HERE. I think they are the last ones. I really have to dedicate to my master thesis right […]

    27 Mar 2010 - Reply
  7. Poncho

    Ni Clapton ni el mismísimo Santana soñarían con semejantes sonidos.
    Felicitaciones, sobrino. Rerere-bacano.
    Un abrazo, Poncho

    29 Mar 2010 - Reply
  8. Wilmer

    Que vaina tan sollada… Tiene pa conectarle MP3?

    29 Mar 2010 - Reply
  9. JP

    No, pero podria ponersele una entrada para radio-transistor de vigilante.

    29 Mar 2010 - Reply
  10. Camarón

    No me jordás! Esto está buenísimo hermano. Un verdadero crack…

    23 Apr 2010 - Reply
  11. Embedding an accelerometer and XBee in a guitar - Hack a Day

    […] Carrascal] hacked his guitar by adding motion control while removing the need for wires. He’s using a dual-Arduino system with an Mini Pro inside the guitar and a Duemilanova for […]

    28 May 2010 - Reply
  12. Embedding an accelerometer and XBee in a guitar | Hacking Blog - hack game - hack window - hack cellphone - hack iphone - Like it - Share our Passion

    […] Carrascal] hacked his guitar by adding motion control while removing the need for wires. He’s using a dual-Arduino system with an Mini Pro inside the guitar and a Duemilanova for […]

    28 May 2010 - Reply
  13. Lunalacerta

    Really cool mod – could you upload some videos of the ribbon controller doing some kind of musical performance too?

    29 May 2010 - Reply
  14. Verline Urioste

    Does anyone have any knowledge with the Philips MC235B Flat Wall Mountable Micro Shelf System I was thinking about obtaining it and just wasn’t certain if its the best 1 to acquire.

    11 Jul 2010 - Reply
  15. Jon

    Nice mod with interesting possibilities.

    What is the s/w your running on the laptop?

    6 Feb 2011 - Reply
    • JP

      It’s Pure Data (www.puredata.info).
      Thanks for reading!

      JP

      7 Feb 2011 -
  16. Richard Seymour

    I was really excited to google and see this as I was having some similar ideas. Really cool stuff and now I have something to go off of.

    I’m not an EE person (materials science actually) but I am aiming to use the accelerometer through the arduino to just work as a digital potentiometer in a volume, fuzz or envelope filter circuit. Then have that all built into the guitar.

    Your setup is certainly more flexible… 🙂 But I would always need a computer to use it live.

    Excellent work and good luck with your thesis if you aren’t done already.

    4 Mar 2011 - Reply
    • JP

      Hello!
      Thanks for the comment!
      I’ve actually been thinking about that. Two possibilities come to my mind: The first one whould require to install a stereo jack and to use a stereo cable. The extra cable would be used to send serial data. You would have to receive those data with another Arduino and then generate the control signals outside. The other option might be to use the same audio cable, but using frequency multiplexing to send control data. I’m not quite sure if it would work in practice, but in theory it does.
      If I ever try any of these, I’ll let you know.
      See you!

      JP

      8 Mar 2011 -
    • Richard Seymour

      Hi!

      I have all of the parts now… I am using two arduino FIO boards. The current plan, thanks to some input from a guitar player friend is:

      – Put the gutted nunchuck in a gibson type guitar, with the joystick in the pickup switch area (I just use the bridge pickup on the guitar in question)
      – send that data to a pedal over xbee
      – the pedal acts as an expression pedal (like a Roland ev 5) using an LED taped to a photocell as a variable resistor. The tilt of the guitar controlling the brightness of the LED.

      There are some other tweaks, but that is the main idea. Part two will be sending out the joystick and tilt info out via midi, I have a USB midi breakout cable to cannibalize for that.

      Thank you so much for your inspiration! I’m glad I checked back on this post, since I had missed your reply. I checked because I needed to see what library you used for arduino to arduino communication.

      Right now I have the nunchuck sending data wirelessly, so I pretty much just need to send the tilt info to the other arduino running a modified ‘dimmer’ example sketch! 🙂

      25 Mar 2011 -
    • JP

      Great!
      It would be nice if you publish the details of your project somewhere. I’d really like to check it out.
      I’m planning to improve my system soon too, so keep tuned.

      Bye!

      JP

      4 Apr 2011 -
  17. Wireless Guitar Controller « Digi XBee

    […] Read JP’s full documentation along with more photos and videos here […]

    5 Jun 2012 - Reply
  18. Música (y arte) de Geeks: “Parchando” en Puredata

    […] a dispositivos via MIDI, OSC (Open Source Control), USB, serial, etc. Es posible, por ejemplo, crear un controlador con un Arduino y usarlo para generar sonidos en Puredata, controlar Puredata con un teclado, con […]

    23 Nov 2012 - Reply
  19. Digi XBee Gallery » On-Board Wireless Guitar Controller

    […] Read JP’s full documentation along with more photos and videos here […]

    21 Jun 2016 - Reply
  20. BestJann

    I have noticed you don’t monetize your site, don’t waste your traffic,
    you can earn extra cash every month because you’ve got
    hi quality content. If you want to know how to make extra bucks, search for: Ercannou’s essential adsense alternative

    15 May 2018 - Reply
  21. BestArletha

    I have noticed you don’t monetize your site, don’t waste your traffic, you can earn extra cash every month.
    You can use the best adsense alternative for any type of website (they approve all
    websites), for more details simply search in gooogle: boorfe’s tips monetize your website

    6 Sep 2018 - Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.