loading
I was wondering about on making a sequencer, a big 16 step sequencer was what I wanted to make. To it's full extension with lots of features including single leds for each step, midi input and output, etc. Then I realised that I should start from a more basic model and then maybe tweak around to see what I can do. So while surfing the web and between other small sequencer projects I found this arduino sequencer, named "arduino punk console" after the simple tone output device from the 555 (atari punk console) and using the arduino as the tone generator. 
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

The bill of materials to making this project consists in:
  •  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,
<p>Hey! Can anyone share a copy of the code for this project? Doesn't look like its available from BeavisAudio anymore, womp womp!</p>
<p>I can see in the video that the first 2 knobs are tempo and pitch but curious to know what the other 2 do</p>
<p>are there 2 void setups and 2 void loops?</p>
<p>Isn't a connection to 5V missing from the Tempo potentiometer?</p>
<p>Hi!</p><p>Does a 16 step instead of 8 sequencer require a arduino board with more terminals .</p><p>Was this the main reason you built an 8 step sequencer?</p><p>I just bought my first arduino just to get into it.</p><p>I even bought a cheap copy.</p><p>But wih the sole purpose of building a 16step sequencer.</p><p>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 &quot;clap&quot; on every second round of the second steps &quot; Boom ..Ka... Boom...Ka. Ka &quot; </p><p>Maybe i will invest in a more complex Arduino?</p><p>Im totally on to soldering and so on.. Ive done some Joule theifs and I salvage electronics in a compulsary manner.</p><p>Any comments would be helpful.</p>
<p>change:<br>Serial.print (254, BYTE);</p><p> Serial.print (192, BYTE);</p><p>with:<br>Serial.write (254);</p><p> Serial.write (192);</p>
<p>Nice instruction! :) But I would probably never be able to learn how to play it :/ haha</p>
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?
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. <br>
Thanks mate. Yes you're right, I only had a 100K lying around my house, but sure 10K will have a better range. :) <br> <br>
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.
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. :)
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 :)

About This Instructable

72,368views

289favorites

License:

Bio: Im 16 and love electronics! I love music; writing music and playing piano. I have fun with microcontrollers and playing with other stuff too. There ... More »
More by TobaTobias:Chaos Nand Synth Arduino Step Sequencer Mini metronome 
Add instructable to: