Introduction: Randomized Arduino Drum Machine

Picture of Randomized Arduino Drum Machine

I like drum machines. However they are not always the easiest to build. I wanted one that is:

A. Simple, Yet Powerful-If it uses lots of components then it is too complicated
B. Sound-It's not a a drum machine if it "beeps"
C. Easily Modifiable-If I can't change stuff for improvement it is kind of annoying.

A meticulous internet search wasn't so successful.

Finally, I found this but, even that was a bit un-editable although it was cool. I thought that the samples were a bit small and I for one was not going to rewrite a bunch of samples.

Therefore, I decided to play around with the code and rewrote my own version of it and tweaked it around until I got a sound I liked.

Remember: Make sure you have the Potentiometer on Analog Pin 1 and not Analog Pin Zero. The True Random library uses this wobbly voltage to pick random numbers! MAKE SURE TO FREE UP ANALOG PIN 0!

I drew up a schematic from the code and then made it real.

I know this uses the TX (Digital Pin 1) and RX (Digital Pin Zero) but I had already built a Digital to Analog Converter shield for those pins and was too lazy too build it again.

Step 1: Parts and Stuff.

Picture of Parts and Stuff.
You Will Need:
8 1K Resistors
8 2K Resistors
1 Potentiometer
1 3-Pin Terminal Block
Male Headers
Arduino Uno
Perf Board/Breadboard

Step 2: Program.

Picture of Program.
Here is the source code so far:

Here is some more code you can try:

Step 3: Okay...So What Exactly Is a DAC?

Picture of Okay...So What Exactly Is a DAC?
A DAC or, Digital to Analog Converter is essentially, a device that takes a series of on-off pulses from a computer, which speaks in binary (or microcontroller) and then converts it into specific voltage levels.

So How does it do it exactly?

Collin Cunningham will explain in more depth:

Step 4: Let's Get Started!

Picture of Let's Get Started!

Build according to the schematic. I can supply pictures of my build in the end but my camera was broken at the time I made this and so, I don't have the pictures for during the build. Sorry.

Step 5: Let's Finish!

Picture of Let's Finish!

Solder the headers terminal and the output wires and commence testing. (make sure you screw in the potentiometer.)

Step 6: Done!

Picture of Done!

That's it!

If you need any help or you have any suggestions PM me or leave a comment below.


SagarD23 (author)2016-09-30

sir I am building this but unfortunately in your finished pic I can see another board in between ,now I am totally confused.where to do what.i have ardiuno board and drum kit board ,do I need anything more? Please email me or leave comment My email is

VickyV32 (author)2016-08-26

Hi bro...! I'm new to Arduino!! Currently using uno...Im.doin a project on Arduino drums! I successfully built a midi drums.
.now try to upgrade to e drum..I fetched the audio samples into the Arduino Uno.. 
Used piezo sensor as input ..getting output thr 11

PCM library

When I hit one piezo i can able to hear the sound..but when I hit two piezo simultaneously..(.I.e kick and hats at same time )o I can't able to hear the both sound same time...struggling alot n this issue.I googled ,but n't able to find a solution...plz help me to fix the problem...

Fetching sample to Arduino

Code example;-
Void loop(){

If { piezo 1 > 100)

startPlayback( sample 1);

If { piezo 2> 100)

startPlayback( sample 2);


blinkyblinky (author)VickyV322016-08-26

Like I said in my previous response, the problem is that the Arduino sequentially loops through the program waiting for a piezo hit, and when it detects one, it breaks the loop to play the sound that was hit. In that case, the Arduino is no longer checking for other hits, which is why two sounds can't be played simultaneously. I put some possible solutions in the reply to your last comment.

VickyV32 (author)blinkyblinky2016-08-26

thnks for u reply...but its workin fine ..initially I have created MIDI a midi .. Arduino works fine...means it's checking simultaneous hits....

I guess the problm is on pcm...

help me...but I'm sure it s checking simultaneous piezo hits

VickyV32 (author)2016-08-24

Hi...I'm doin a project on Arduino drums..I added the drum kit samples in my uno..and played whenever piezo sensor reaches the maximum value..I.e
if ( piezo read > 80)

for each sensor I assigned respective samples.

now the problm is.i m not able to play 2 samples simultaneously..means..wen I hit kick and hats same doesn't workin...

I'm not using DAC ..playin digital signal directly ..used pcm library

please help soon as possible

blinkyblinky (author)VickyV322016-08-24

Hello, doing two things at the same time on any processor is usually a problem, especially on microcontrollers like the Arduino. While I can't diagnose the exact problem without seeing the actual source code, I would imagine that the problem is that the Arduino sequentially loops through the program waiting for a piezo hit, and when it detects one, it breaks the loop to play the sound that was hit. In that case, the Arduino is no longer checking for other hits, which is why two sounds can't be played simultaneously. There are a few ways to fix this problem: although inefficient, a hardware solution would be to make each sound its own Arduino; a different solution would be to fiddle with the code to see if it can also check for double piezo hits. While I can help with the problem, I currently have limited access to a computer (on vacation for the next two weeks), so it might take a while before I can look in depth into any programming heavy problems.

benekeneb (author)2013-04-05

Why is hat and crash the same?

benekeneb (author)2013-04-03

I don`t understand what the Pot is for. What does it do?

blinkyblinky (author)benekeneb2013-04-03

It is used for speed control. The drum sounds slow down/speed up as you turn the pot.

TobaTobias (author)2012-05-12

Nice! What resistance is the pot?

blinkyblinky (author)TobaTobias2012-05-13

It can be any value you want...I used 1Megaohm but 10K, 5K 100K and most other values will work.

georgelstuart (author)2012-05-08

Let's hear what it sounds like!

I guess I was too lazy to shoot a video...Better get started...will get back soon.

About This Instructable




Bio: I love building things and taking pictures. If you want me to build something...I'm open to ideas. My motto? "If you want something ... More »
More by blinkyblinky:Keeping Up Appearances with ChindoguA Complete Beginner's Guide to Raw Files And Raw ProcessingHypercard - An Impossible Paper Object
Add instructable to: