Introduction: Arduino Step Sequencer
So here goes a simple project which can later be modified and used in different projects, check last step for more detail on stuff to do with this sequencer.
Schematic, code and original idea is from Beavis Audio, everything can be found at there website:
www.beavisaudio.com
Here is a little preview video I made:
Step 1: Materials
- X8 Momentary pushbuttons, normally open.
- X1 Small Toggle DPDT switch.
- X1 LED, whichever color, it's only used to indicate that the Arduino is on and working.
- X9 10K resistors.
- X4 100K Potentiometers.
- X1 Female stereo jack, it can be 3,5mm or a 6,3mm.
- X1 Cable.
- X1 Enclosure, I just picked up a simple hard plastic box.
- X4 Knobs for the pots, only if you wish so.
List of tools to elaborate:
- Soldering Iron.
- Solder.
- Drill.
- Tweezers.
- Screwdrivers.
Step 2: Schematic and Wiring
Following the schematic is fairly easy. What we must notice is that the 10K resistors are pull down, this means it's hooked up to ground and it holds the logic signal when no other active device is connected. So you must hook the wire leading to the Arduino pins for the steps from the pushbutton. Arduino pins from digital 10 till 2 go to pushbuttons.
Then connect all buttons together with the pots positive lead and hook it up to 5V. All Resistors go together with pots negative leads and hook it up to ground. Also notice the traditional 100K wiring for the volume, which goes to Arduino digital 11. The pots go hooked up to Arduino analog 0, 1 and 3. Finally a red led goes to Arduino pin digital 12.
*There are two schematics. One that I made on Fritzing and the second one which is much better organised, can be found at beavis audio.
Step 3: Code
The original code comes with a LCD setup for displaying frequency changes. I just deleted that part, but you can get the code with lcd setup here.
/* ======================================================================
Arduino Punk Console
A simple programmable 8 step tone sequencer
by dano/beavisaudio.com
Revs
-----------------------------------
15 Sept djh initial version
======================================================================*/
// Map all the input and output pins
#define AnalogInFrequency 1
#define AnalogInTempo 2
#define AnalogInDuration 0
#define DigitalOutSignal 11
#define DigitalInSwitch0 2
#define DigitalInSwitch1 3
#define DigitalInSwitch2 4
#define DigitalInSwitch3 5
#define DigitalInSwitch4 6
#define DigitalInSwitch5 7
#define DigitalInSwitch6 8
#define DigitalInSwitch7 9
#define DigitalInStartStop 10
#define DigitalOutLED 12
// Set up the array for each step
int steps[] = {100,120,140,160,180,200,220,240};
// misc housekeeping
int duration = 50;
int pitchval = 1;
int fPlayMode = true;
int lastPushedStep = -1;
// Initialize the tempo
int tempo = 100;
void setup()
{
// setup pin modes (Digital pins are input by default, but
// I like to set 'em explicitly just so the code is clear.
pinMode (DigitalInSwitch0, INPUT);
pinMode (DigitalInSwitch1, INPUT);
pinMode (DigitalInSwitch2, INPUT);
pinMode (DigitalInSwitch3, INPUT);
pinMode (DigitalInSwitch4, INPUT);
pinMode (DigitalInSwitch5, INPUT);
pinMode (DigitalInSwitch6, INPUT);
pinMode (DigitalInSwitch7, INPUT);
pinMode (DigitalInStartStop, INPUT);
pinMode (DigitalOutSignal, OUTPUT);
pinMode (DigitalOutLED, OUTPUT);
}
void loop()
{
// Main sequence loop
for (int i=0; i<8; i++)
{
// Are we playing or stopping?
fPlayMode = digitalRead (DigitalInStartStop);
digitalWrite (DigitalOutLED, HIGH);
// Check the Hardware
readSwitches();
readPots();
// update the display
updateDisplay();
// Make the noise
if (fPlayMode)
{
freqout (steps[i], duration);
}
digitalWrite (DigitalOutLED, LOW);
// Pause between steps
delay (tempo);
}
}
void updateDisplay()
{
Serial.print (254, BYTE);
Serial.print (192, BYTE);
Serial.print ("T:");
Serial.print (tempo);
Serial.print (" d:");
Serial.print (duration);
if (lastPushedStep != -1)
{
Serial.print ("*");
Serial.print (lastPushedStep);
}
}
// Read the current values of the pots, called from the loop.
void readPots ()
{
tempo = (analogRead (AnalogInTempo) * 1.9);
duration = (analogRead (AnalogInDuration));
}
// Read the current values of the switches and
// if pressed, replace the switch's slot frequency
// by reading the frequency pot.
void readSwitches()
{
// reset last pushed button number
lastPushedStep = -1;
// check switch 0, if pressed, get the current freq into step 0, etc. etc.
if (digitalRead (DigitalInSwitch0) == HIGH)
{
steps[0] = analogRead(AnalogInFrequency);
lastPushedStep = 1;
}
else if (digitalRead (DigitalInSwitch1) == HIGH)
{
steps[1] = analogRead(AnalogInFrequency);
lastPushedStep = 2;
}
else if (digitalRead (DigitalInSwitch2) == HIGH)
{
steps[2] = analogRead(AnalogInFrequency);
lastPushedStep = 3;
}
else if (digitalRead (DigitalInSwitch3) == HIGH)
{
steps[3] = analogRead(AnalogInFrequency);
lastPushedStep = 4;
}
else if (digitalRead (DigitalInSwitch4) == HIGH)
{
steps[4] = analogRead(AnalogInFrequency);
lastPushedStep = 5;
}
else if (digitalRead (DigitalInSwitch5) == HIGH)
{
steps[5] = analogRead(AnalogInFrequency);
lastPushedStep = 6;
}
else if (digitalRead (DigitalInSwitch6) == HIGH)
{
steps[6] = analogRead(AnalogInFrequency);
lastPushedStep = 7;
}
else if (digitalRead (DigitalInSwitch7) == HIGH)
{
steps[7] = analogRead(AnalogInFrequency);
lastPushedStep = 8;
}
}
//freqout code by Paul Badger
// freq - frequency value
// t - time duration of tone
void freqout(int freq, int t)
{
int hperiod; //calculate 1/2 period in us
long cycles, i;
// subtract 7 us to make up for digitalWrite overhead - determined empirically
hperiod = (500000 / ((freq - 7) * pitchval));
// calculate cycles
cycles = ((long)freq * (long)t) / 1000; // calculate cycles
for (i=0; i<= cycles; i++)
{ // play note for t ms
digitalWrite(DigitalOutSignal, HIGH);
delayMicroseconds(hperiod);
digitalWrite(DigitalOutSignal, LOW);
delayMicroseconds(hperiod - 1); // - 1 to make up for fractional microsecond in digitaWrite overhead
}
}
Step 4: Enclosure
Making holes is very simple but sometimes can be very tedious, especially when theres many holes. I took out a ruler a divided the box into 8, so I could drill 8 holes. After that, above I drilled two holes for the pause switch and the LED. Above 4 Holes for the pots. On the side a hole for the output and beneath a square for the Arduino usb port, so you can feed power through it. After putting everything in there place I slided in some Knobs on the pots and screwed ever component to the plastic box.
To making holes; try all type of drill bits to see what fits better for each component.
Step 5: Wrapping Up
So it's a fun piece of machine, and I wanted to share this nice build so later you can modify it and eventually make something even better. A few ideas on improvement would be; having a led for each step, that you could hold a tone to change it's frequency, have an input so you can send synth based sounds into this little machine, and finally add a MIDI output for using with the computer.
For know, Im going to use some sound effect boxes, which have input and output, so I can listen to the kind off sound generated with the steps.
*All credit goes to beavis audio; who made this project and also wrote the Arduino sketch.
Tobias,

Participated in the
Instructables Design Competition

Participated in the
Holiday Gifts Contest
19 Comments
8 years ago
Isn't a connection to 5V missing from the Tempo potentiometer?
Reply 1 year ago
that´s exactly what i think aswell and started to discuss a minute ago!
Question 1 year ago on Step 1
hi out there, just built a APC last night and ran into several issues… got the impression finally that the schematic beavis has published and that is reposted alot got an error concearnig the tempo pot? it is missing the +V connection which the duration&frequency have. added one and it seems to work now. but in general the APC seems to be running too slow, like 60bpm or even less. have a thread up here: https://forum.arduino.cc/t/arduinopunkconsole/951784/6 so if anyone feels like helping to troubleshoot, would warmly appreciate it !
Question 5 years ago
Hello!
Any reason for the 100k pots? I have 5K pots here that I was messing around with mozzi library. Is it ok for me to use them instead?
Thanks!
6 years ago
i finished all the connections but i dont understand how the switches work
6 years ago
i'm just starting in the electronic world, and i wanted to know if i can use potentiometers instead of the momentary buttons
Reply 6 years ago
Hey Mate, indeed you could if we are talking of switch pot's, but no resistor pots with are the most common. But I would recommend using switches.
6 years ago
Hey! Can anyone share a copy of the code for this project? Doesn't look like its available from BeavisAudio anymore, womp womp!
7 years ago
I can see in the video that the first 2 knobs are tempo and pitch but curious to know what the other 2 do
8 years ago on Introduction
Hi!
Does a 16 step instead of 8 sequencer require a arduino board with more terminals .
Was this the main reason you built an 8 step sequencer?
I just bought my first arduino just to get into it.
I even bought a cheap copy.
But wih the sole purpose of building a 16step sequencer.
As I learned programming drummachines on a Roland 707 I had I would feel if might be odd to not be able to program a single "clap" on every second round of the second steps " Boom ..Ka... Boom...Ka. Ka "
Maybe i will invest in a more complex Arduino?
Im totally on to soldering and so on.. Ive done some Joule theifs and I salvage electronics in a compulsary manner.
Any comments would be helpful.
8 years ago on Introduction
8 years ago on Introduction
change:
Serial.print (254, BYTE);
Serial.print (192, BYTE);
with:
Serial.write (254);
Serial.write (192);
9 years ago on Introduction
Nice instruction! :) But I would probably never be able to learn how to play it :/ haha
10 years ago on Introduction
I can't tell through the video whether yours does this or not, but when I turn off the switch connected to pin 10 of the Arduino, the LED does not change. In the code it looks like it should?
10 years ago on Introduction
awesome instructable, just a few suggestions, make the potentiometers 10k rather than 100k so you dont have to move it so slowly to get the desired change or divide the value by ten in the code so that the arduino thinks the pots are 10 or use map (). this might solve the problem where some data is out of the audially preferiental range. but i was amazed at this instructable, great photos, clear instructions, and a good end product.
Reply 10 years ago on Introduction
Thanks mate. Yes you're right, I only had a 100K lying around my house, but sure 10K will have a better range. :)
Reply 10 years ago on Introduction
awesome use of all components though. i havnt had time to do some of the projects you have instructables on but i think i will use yours as guides. keep up the good work.
10 years ago on Step 4
Hello there! I haven't yet read the whole article, But I do look the like of it so far. I might build myself one :). I was wondering if you could share the code? I wont copy it, but I just want to see the concept of hole everything is put together. I find ideas and concepts in codes fascinating and for me is by far the best part. Thank you very much. :)
Reply 10 years ago on Step 4
I didn't upload the sketch, my mistake. You can get the code at beavisaudio.com and I am going to add the code to the instructable. Thanks for reminding me; no worries, the code is free share, it's exactly for tinkering around. It's why I uploaded this project; for creating new stuff and finding ideas :)