Virtual Drumsticks Completed

Click here to see the beginning stages of this project.
Click here to read the initial project proposal.

After testing with one drumstick and verifying that I could turn an LED on and off, I ordered additional ball tilt switches (the Arduino kit only comes with one). I purchased this lot of 10 from Amazon: Gikfun ball tilt switches. These new switches only have 2 posts instead of 4 like the one included with my kit.

When the new switches arrived, I constructed another drumstick and tested. I decided to wrap the sticks in white electrical tape so that they would be able to withstand more use.


Next I setup Processing 3 by uploading the Firmata protocol to my Arduino. This allows you to interface with the Arduino from Processing (you must have the Arduino Library for Processing folder added to your Processing libraries folder for this to work). Then I experimented with some code.

Screen Shot 2015-11-08 at 8.55.59 PM

I set digital pins 2 and 3 on the Arduino to INPUT. I also wired my drumsticks/switches from +5V power to pins 2 and 3. When the ball tilt switches are level, they complete the circuit and send a HIGH signal to Processing. When the switches are not level, such as when striking a virtual drum, the circuit is broken and the Arduino sends a LOW signal to Processing.


Next, I found some drum sound effects (WAV files) online to use as drum beats. I imported the Minim sound library for Processing and was able to use the play() function to play my sounds whenever there was a LOW signal detected by the Arduino.

Screen Shot 2015-11-08 at 9.01.49 PM

The reason I chose to play the sound effect on a low signal was to prevent the sounds from going off while the drumsticks were being held in the vertical position. Each time the user swings the drumsticks, it breaks the circuit, sends a LOW signal to Processing, and my program plays the sound.

This was a fun experiment and obviously there are likely other types of switches that would be more accurate to use as virtual drumsticks, but for the price and simplicity, I was happy with the results I achieved.


  1. Interesting Daryl,

    Sounds like fun, and could lead to more than just fun.


  2. Daryl Auclair

    November 17, 2015 at 10:23 am

    Thanks Dad, I am very excited about our group final project, we will be making a toy or game using the Arduino, and it must be more polished this time, complete with printed instruction manuals and all!


Leave a Reply to Daryl Auclair Cancel reply

Your email address will not be published.


© 2020

Theme by Anders NorénUp ↑