8-Step Arduino Sequencer

Gates are basically pulses, you know square wave stuff. You can alter the pulse width, or how long things are on vs off. This is called a duty cycle. A square wave pulse is when it is 50% on, 50% off, so a duty cycle of 50.


When you modulate or change this duty cycle, its called pulse width modulation or PWM. :slight_smile:

1 Like

Thanks @Caustic. We use a lot of acronyms on this site. That explanation should be bookmarked for a glossary. Perhaps it’s possible : admin?

1 Like

Thats actually a good idea, i think a glossary thread wouldnt go amiss.

1 Like

Wondering if a glossary thread is as flexible as maybe linking posts to the awful spell check this post editor has. Who is admin btw? Or are we under AI?

Or even just links to a good glossary elsewhere. Like a wiki

Let’s see if this works:

1 Like

Thanks for the quick input @fredrik .

Edit: Ignore this nonsense, I was misremembering how the kbd gate works.

I haven’t looked at it but I can see how that might occur. Each step gate is on for however long and then off again, but the next gate turns on just about simultaneously with the previous one turning off, so the logical or of all of them I would guess is essentially DC. It might be a good idea in the code to turn off all gates, delay a couple milliseconds, then turn on the new one.

1 Like

Breadboard test of modified code and “rotary switch” (actually just moving a jumper) to change sequence length. All seems to work.


I’ve taken your hint about reset and stepbutton1 being the same. I’ve got a rotary switch with 5 options hooked up to A0. Working on the code now to give me 5 types of sequences in each direction. Random backwards is still random, but hey, it’s there.

The modes I’m including:

Simple cycle 1-2-3-4-1-2-3-4
Inclusive rotate 1-2-3-4-4-3-2-1-1
Exclusive rotate 1-2-3-4-3-2-1-2-3
2x step repeat 1-1-2-2-3-3-4-4

Working on the syntax to get this done but probably about half way there

1 Like

Nice, though incompatible with my sequence length selector! Due to having only one input pin free.

1 Like

I didnt even know discourse had a wiki capability thats dope.


I would also look into a switch debounce code. Occasionally (1 in 50) I will get a double step on the step selector. Not a big deal on something not used much but may as well throw it in


I was thinking you can do sequence length selection purely in hardware if you have a switch on each stage that sends the step signal to the reset pin instead of to the outputs.

That works, in forward mode. But it doesn’t do the right thing in backward mode, or in CTorp’s variant modes. So to have selectable lengths and patterns you need two rotary switches, which there’s not room for on the pins.

I think something like this could work, though, to replace the eight BUTTON inputs with a single analog input:

Kind of a poor man’s CV keyboard.


Poor mans keystep except it probably ends up costing about the same :rofl: oh well I’ve been having fun playing with this thing

1 Like

That doesn’t work, the input is floating if no buttons pressed…

OK, looks like something along these lines will work.

Unfortunately now you need bipolar power. Unless maybe a rail to rail op amp would work on 0 and +5V? But I don’t have one to test.

With ±12V you need to follow this with a diode and voltage divider to get the gate into 0–5V territory. If you can use an op amp on 0 and +5V you might need a transistor to get the gate up to the full 5V.

Might be nice to avoid bipolar power just so you’d have the option of having the sequencer be in a separate, battery power case.


No, that doesn’t work either… 1M is too big, gives a nonzero value on the Arduino… back to the drawing board.

Starting to think a multiplexer would be easier.

Wait, you know what’s even easier? One rotary switch. CTorp’s patterns need five positions and my sequence length selection needs seven, total twelve. You’d give up having CTorp’s patterns for any sequence length but 8, but hey.


Patterns working:


Dude this is awesome!

Looks like all that’s left is setup the correct voltages to read from the rotary. Hats off to you for the speedy coding and thanks lot for sharing!

That being said, the rotary hooked up with 1ks between each leg ought to do the trick?

1 Like

excellent !!!