What if you could turn any conductive surface into an instrument? Like, say...a mug of water? Best of all, it's cheap; you'll only need $1 worth of extra electrical components (not including the Arduino).

For this project, my friend Harvest and I combined Disney's Touché touch-sensing system with Arduino, and then used ChucK to generate music based on the input. Rain falls gently in the background, and when the user approaches, they can trigger notes on a whole-note scale by touching the mug. Touching the water directly results in some lovely raindrop-inspired, high-pitched notes. Finally, touching the water while also touching a grounded surface will trigger a thunderclap!

Some thank-you's are in order:

  • Disney's original Touché paper
  • madshobye's Touche for Arduino Instructable
  • madlabdk's github project, which implements a more human-readable, less efficient encoding for the data, which we used, because it made it easy to feed the data into ChucK
  • The makers of ChucK, because it's an awesome programming language for synthesizing music (OK, I'm biased, it's from my school)


You will find this Instructable much easier to follow if you have a basic understanding of circuits. Additionally, if you want to edit the musical behavior, you'll have to use the ChucK language.

Common problems, things to watch out for, etc:

Make sure your laptop is properly grounded when you do this (e.g. plug it into a wall). Otherwise you'll get some weird readings. Additionally, you may have to alter some of the values in the springshowers.ck file in order for this to work for your personal setup. We used a plain ceramic mug.


A .zip download of all code is available at the next step, but here's the github repo if you want to download the code from there as well.

More projects:
 Check out my blog at bonnie-eisenman.tumblr.com to see what I'm up to.

Step 1: Materials and Setup


You will need one each of the following:

Resistors: 10k, 1M, 3,3k

Capacitors: 100pf, 10nf

Diode: 1N4148

Coil / inductor: 10mH

We purchased these from Mouser. This sample shopping cart contains enough materials for 3 such projects. It comes out to  about $1.11 per project for all of these components, not including shipping!

Additionally, you will need an Arduino, breadboard, jumper wires, and an alligator clip -- all of which should be pretty standard. 


Install ChucK and the Arduino IDE. Then download the mug-music-master.zip file from this step, which contains all necessary code.


See attached image for the circuit image, taken from this Instructable, which includes instructions on how to setup the circuit.

You'll want to set up the circuit on a breadboard, and connect an alligator clip to the end where the "object" should be. We then dunked the free end of the alligator clip into a mug filled with water, and plugged the Arduino into our USB port.

<p>do you have more photos of the circuit? </p><p>TY!</p>
<p>Hi bonnie, as of now, we are trying your experiment but we dont have the 10mH.could we just alter or modify the circuit without using the inductor?how?we need your help.also for the chuck software,there were so many serial port displayed in the console and we dont know how to display the functional one.thank you</p>
<p>That's an awesome project. I'm a beginner in electronic, also i can't find all those compounds at low price (or without shipping costs too high).</p><p>Do you think i can replace the coil and the 100pF by something else ? What will happen if i take a 10MF capacitor instead of a 100pF one for example ?</p><p>Please excuse me for thoses stupid questions, thank's for your answers !</p>
<p>Hi, </p><p>is it possible to get a more detailed picture of the circuit?</p><p>I have tried to build this but keep getting an arpeggio playing over and over regardless of whether I am touching the mug or not? Any ideas?</p><p>Thanks</p>
<p>Update. there is actually a provision for that in the chuck file. just search for</p><p>// Loitering reading</p><p> if (val &lt; 28)</p><p>and replace it with a value that suits your setup. i am using 35 and no more screeching. thanks again to the author for a very configurable code. Cant thank you enough :)</p>
<p>Rohan, you're welcome! Glad you managed to debug it and got it working :)</p>
<p>i think the sound is due to the change from the maxPos from 1 in air to 30~35 in the water mug. I fixed it by putting a threshold depending on the stable maxPos Value in water. I think it might vary at times, so be sure to see the difference on the serial monitor. The if condition helped me solve it. hope it works for you too.<br></p><p>///Code for threshold </p><p>if (maxPos &gt; 35){</p><p> Serial.print(maxPos, DEC);</p><p> Serial.print(&quot; &quot;);</p><p> Serial.println(maxVal, DEC);</p><p>} else { Serial.println( &quot;UnderThreshold&quot;);}</p><p> delay(200);</p><p>}</p>
<p>I'll try to post a more detailed picture soon (it's unassembled at the moment).</p><p>In general, you can debug by viewing the Arduino serial output directly in the Arduino IDE. It should spit out a stream of lines with two numbers per line; the first number is the one that's usually interesting and it's what this sketch uses. It should remain constant when you're not touching the mug.</p><p>If it isn't remaining constant: something's wrong with your circuit and/or setup. Is your laptop plugged in to a grounded outlet? Is the mug on a non-conductive surface? Did you double-check to make sure that nothing's touching that shouldn't be in your circuit, like an alligator clip that's touching a wire? (I've made all these mistakes, haha.)</p><p>If the number IS remaining constant: congrats, it's working! You probably just need to mess with the numbers in the sketch. Try loading up simplest.ck and experimenting from there.</p>
<p>firstly thanks for this awesome project... i seem to have the same problem and i have checked everything multiple times. the arpeggio just won't go! :(</p>
<p>Thanks again for this instructable.</p><p>great!</p><p>Although I'm not able to control a distortion that occurs some times (especially when I touch the cup-side out), has a fantastic sound.</p>
<p>Hi, </p><p>Great project !</p><p>I'm using a Human Body Touch Sensor Module bought on DX for 2.53$ as a shortcut, just to test the idea and then decide about the circuit.</p><p>Anyway, it works but in addition to the very nice Chuck sounds I'm getting bad noise from time to time.</p><p>Can you tell what is the expected range of values for curVal (and later for maxVal, maxPos) ?</p><p>Thanks !</p><p>Avi </p>
<p>This is what we got (can hear the bad sound interrupting....):<br>https://www.dropbox.com/s/1ukw4xajnqgcyqi/2014-12-14%2018.50.52.3gp?dl=0</p>
<p>Hi<br>Is it possible to replace the ChucK with Processing ?</p>
<p>how to setting COM in chuck??</p><p>why not can sir?</p>
<p>can someone (who has made the circuit) post the different arduino serial output in different cases so that i can stimulate it without the circuit or maybe some other sircuit </p>
<p>Hello there, I loved the final result you get, I have built the circuit and connected to the arduino, just to confirm it was built right, I looked into the SerialMonitor and can see the data being sent over the serial port. </p><p>The problem I'm having is with the Chuck program, I have tried both methods you describe in the last step of the instructable, but can't get it to work... my COM port is 12, so I enter it as '12' and as 'COM12' but neither seem to work... both in CMD screen and miniAudicle I do get the list of ports available but don't know how to select my port. At the CMD screen I get COM1, COM2 and COM12 as options 0, 1 and 2, so I press 2 and there's no response, same goes for miniAudicle, I can see the same option in the Console monitor, can't write in the console screen, and don't seem to send as argument either... what am I missing? I have made sure the port is not reserved by arduino IDE or any other program, hope you can help...</p>
<p>Hi nick, you have to **launch** it with the right arguments. So run it once to figure out which port number you need, then remove the shred and run it again with the right arguments. (I think.) So in miniAudicle, try launching it with 2 as the argument to begin with.</p><p>Make sure you do NOT have the Serial Monitor in Arduino IDE open when you're doing this! </p><p>Hope that helps. :)</p>
<p>Thanks for your reply, for some reason when I attempt to remove the shred it prompts me an error (see pic), I hit 'Abort' and the VirtualMachine remains open with the shred loaded and can't add any shred after that...</p><p>I then close miniAudicle and try again as you suggest above, entering now #3 (as I added another device (phone in diag mode) just to make sure #2 as not being confused with COM2); I get the conditions in the pic shown below (please let me know if this is how it should look like) but the Arduino doesn't seem to communicate as the TX LED is not blinking (it should blink right?), I'm running in XP by the way...</p>
<p>Gah, I'm sorry you're having issues with it. This is very strange. </p><p>As for the Arduino, I believe it should always be communicating? As you said, you checked in the Serial monitor, so that's probably fine. </p><p>Try running the example lines.ck sketch (included in miniaudicle) to see if you can read from Serial input at all. I've pasted it below, but it should also be accessible from miniaudicle.</p><p>SerialIO.list() @=&gt; string list[];</p><p>for(int i; i &lt; list.cap(); i++)</p><p>{</p><p> chout &lt;= i &lt;= &quot;: &quot; &lt;= list[i] &lt;= IO.newline();</p><p>}</p><p>// parse first argument as device number</p><p>0 =&gt; int device;</p><p>if(me.args()) me.arg(0) =&gt; Std.atoi =&gt; device;</p><p>if(device &gt;= list.cap())</p><p>{</p><p>cherr &lt;= &quot;serial device #&quot; &lt;= device &lt;= &quot; not available\n&quot;;</p><p> me.exit(); </p><p>}</p><p>SerialIO cereal;</p><p>if(!cereal.open(device, SerialIO.B9600, SerialIO.ASCII))</p><p>{</p><p>chout &lt;= &quot;unable to open serial device '&quot; &lt;= list[device] &lt;= &quot;'\n&quot;;</p><p>me.exit();</p><p>}</p><p>while(true)</p><p>{</p><p> cereal.onLine() =&gt; now;</p><p> cereal.getLine() =&gt; string line;</p><p> if(line$Object != null)</p><p> chout &lt;= &quot;line: &quot; &lt;= line &lt;= IO.newline();</p><p>}</p>
<p>is it possible to put speaker in the circuit? can someone show where to put it there.</p><p>So it can have its own speaker wihout the laptop/pc</p>
<p>You would need to run Chuck somewhere else, then, or eliminate it entirely and do the music generation some other way. The music generation is entirely done on a computer. (Could you run it on a Raspberry Pi? Maybe, but I'm not sure if Chuck can be installed on Linux/Raspbian/etc.)</p>
i don't see a speaker in the circuit. where is the sound coming from?
<p>From the laptop/computer that the Arduino is plugged into and has chuck installed</p>
<blockquote><a href="http://www.mouser.com/ProjectManager/ProjectDetail.aspx?AccessID=137af1ece6" rel="nofollow">This sample shopping cart</a> contains enough materials for 10 such projects<br><br><br>It should be noted that the shopping cart linked to has enough parts for 3 such projects, not 10. Still cheap.</blockquote>
<p>is it okay to use Arduino Uno R3? :)<br>or what Arduino shall we use?</p>
<p>Yup, that should work! Most Arduinos shouldn't have any problems with this.</p>
<p>its beautiful work and a nice tunes</p>
<p>wow! pretty cool man</p>
<p>This is terrific! I've been trying to think of a way to incorporate an Arduino into a local non-profit I volunteer with (www.bensencore.com) where we teach kids little home projects they can do using electronics, or things around the house. Right now we have a Makey Makey that we make a fruit piano with, and this might pair with it nicely, so I'm going to tackle this next weekend, since we do have some older kids come through who are already experienced with small electronics. </p>
<p>Thanks, and this sounds like a great project for them, then! Would love to hear if it works out. If you don't have some of the parts around (especially the inductors -- though you can make your own by coiling wire) you can always use the super-basic CapSense library to do touch sensing instead (no extras required, just alligator clips).</p>
<p>This is really fun. A great project! :D</p>
<p>Impressive! I am definitely going to try this.</p><p>I don't see it in the Arduino contest yet. You have to enter this. I'll vote for it.</p>
<p>Hi, thanks! I'd love to hear your experience if/when you do try it. :)</p><p>I did submit to the contest, hopefully they'll accept it and it'll be up in another day or so.</p>

About This Instructable


286 favorites


Bio: Software engineer at Codecademy, based in NYC. Member of NYC Resistor. I do stuff with Arduino, musical programming, and lasers. See more of my projects ... More »
More by bonniee: Illumaphone: Light-based Musical Instrument with Arduino Caramelize Sugar onto Chocolate with a Laser Cutter Mug Music: Turn Water Into an Instrument with Arduino and ChucK
Add instructable to: