8-Step Arduino Sequencer

Oh there it is. I thought I had a .diy file. The ordering of D2–D13 and A0–A7 was what I intended but not what I actually did, and the Arduino code reflects the actual ordering.

I pushed some improvements to the (still sparse) documentation.

9 Likes

now that i can follow! fantastic, I’ll adjust my 8 step accordingly. Got the majority of the hardware done today, just waiting on delivery of the buttons.

4 Likes

If I plan on using the built in lamps in my buttons instead of LEDs - Would I be able to nix the resistors and still need the diodes?

I’m currently building this using LED buttons too, assuming there isnt a resistor built into the button, you still need one to prevent the LED from burning out.

1 Like

Check the datasheet for the buttons.

3 Likes

These are the ones I picked up…

I am digging around for a datasheet, but I think I might be on my own. I could pull one apart for science, but I’m not exactly sure what that would tell me. Its probably best to just stick with the standard resistor & diode setup. The next problem is telling anode from cathode as they are not marked and appear to be identical.

1 Like

Do you have a multimeter with a diode test function?

Random tutorial:

4 Likes

Worth a breadboarding experiment with a color you don’t care about

2 Likes

Are the diodes 1N5817 right - not 1N5818?

3 Likes

Welcome to the community!

Use either. Main difference between 1n5817, 1n5818, and 1n5819 is maximum reverse voltage: 20, 30, and 40 V, vs. the 5 V used here, so they’re all good. They also have different forward voltage but not significantly. 5818 is a penny more than 5817 at Tayda, but 5819 is a penny less, go figure. I have 1n5817 on hand so I used that.

2 Likes

Thanks for the info and especially for the welcome.

I asked because I have problems with the construction of the sequencer and wanted to know if it is because of this diode.

The problem manifests itself as follows: if I press a certain button, the corresponding step is not activated. It is as if the order of the buttons or steps are swapped.

I have already checked everything several times and I do not know where the error is.

— We will see.

1 Like

Which schematic are you following and which version of the Arduino code are you using?

1 Like

I followed your schematic and Arduino code I have found in GitHub. I think its the latest.

2 Likes

Did you take note of the README?

Stripboard layout reflects my intended ordering for D2…D13 and A0…A7, but not the ordering I actually ended up with, and which is coded for in the Arduino sketch initialization section.

That is, I drew up the stripboard layout, but then I goofed when doing the wiring and got the ordering wrong, so the ordering in the code and the ordering on the stripboard layout are inconsistent. I didn’t want to change the code for the Github repository because I’d have no way to test it, and I didn’t want to change the stripboard layout because it makes a good deal more sense than what I ended up with. So if you haven’t done so, you need to edit the code to reflect the actual ordering you used, specifically the lines

#define STEP1     9
#define STEP2     8
#define STEP3     7
#define STEP4     6
#define STEP5     5
#define STEP6     4
#define STEP7     3
#define STEP8     2
#define RESET    10
#define ZERO     11
#define FORW     12
#define BACK     13
#define ROTARY   A7
#define BUTTON1  10  // same as RESET (same action)
#define BUTTON2  19  // must be read as analog
#define BUTTON3  18
#define BUTTON4  17
#define BUTTON5  16
#define BUTTON6  15
#define BUTTON7  14
#define BUTTON8  A6
4 Likes

Thanks, now the sequencer runs!
I build it like described in GitHub.
And the Arduinos code in the ‘define section’ is now:

#define STEP1 2 // D2
#define STEP2 3 // D3
#define STEP3 4 // D4
#define STEP4 5 // D5
#define STEP5 6 // D6
#define STEP6 7 // D7
#define STEP7 8 // D8
#define STEP8 9 // D9
#define RESET 10 // D10
#define ZERO 11 // D11
#define FORW 12 // D12
#define BACK 13 // D13
#define ROTARY 14 // A0
#define BUTTON1 10 // D10; same as RESET (same action)
#define BUTTON2 15 // A1; must be read as analog
#define BUTTON3 16 // A2
#define BUTTON4 17 // A3
#define BUTTON5 18 // A4
#define BUTTON6 19 // A5
#define BUTTON7 A6 // A6
#define BUTTON8 A7 // A7

The sequencer runs in all eight steps. But unfortunately I have a mistake now after all:
Button7 is not able to activate the two potis and the LED 7.
Hardware seems to be ok. Im not sure but could it be the software?
I am not familiar with the software and cannot do anything about it. At the hardware I will take a closer look to find the error.

2 Likes

Tip: put ``` on a line before and after the code block, to get discourse to format it as code and not plain text.

4 Likes

I didn’t use the A0…A5 macros since those pins (14–19) are read as digital. A6 and A7 cannot be read as digital and have to be read as analog, hence the comment in my code, except it looks like I put the comment on the pin 19 line which isn’t correct. I’ll fix that. Anyway, in my code BUTTON1 through BUTTON7 are read as digital (pins 10 and 14–19) and ROTARY and BUTTON8 (pins A7 and A6) as analog.

In yours, pins A6 and A7 are BUTTON7 and BUTTON8 so those have to be read as analog, and ROTARY is read as analog.

So there are some other code changes needed. In void setup () near line 115 delete the line

    pinMode (BUTTON7, INPUT);  // BUTTON8 and ROTARY will be read as analog

And in void loop () near line 178 change

    for (int ib = 2; ib <= 7; ++ib)

to

    for (int ib = 2; ib <= 6; ++ib)

and before

    valButton[7] = analogRead (buttons[7]);

add a new line

    valButton[6] = analogRead (buttons[6]);

Near line 313 change

    for (int ib = 2; ib <= 7; ++ib)

to

    for (int ib = 2; ib <= 6; ++ib)

and finally (I think) near line 328 change

  // Pin A6 cannot be read as digital on the Nano so read
  // as analog and expect > 1000 when button pressed
  
  if (valButton[7] >= 1000 && old_valButton[7] < 1000)
    {
      doNewGate = true;
      stepOn = 8;
#if DBG==1
	  Serial.print("pin ");
	  Serial.print(buttons[7]);
	  Serial.println(" button 8");
#endif
    }
  old_valButton[7] = valButton[7];

to

  // Pins A6 and A7 cannot be read as digital on the Nano so read
  // as analog and expect > 1000 when button pressed
  
  if (valButton[6] >= 1000 && old_valButton[6] < 1000)
    {
      doNewGate = true;
      stepOn = 7;
#if DBG==1
	  Serial.print("pin ");
	  Serial.print(buttons[6]);
	  Serial.println(" button 7");
#endif
    }
  old_valButton[6] = valButton[6];
  
  if (valButton[7] >= 1000 && old_valButton[7] < 1000)
    {
      doNewGate = true;
      stepOn = 8;
#if DBG==1
	  Serial.print("pin ");
	  Serial.print(buttons[7]);
	  Serial.println(" button 8");
#endif
    }
  old_valButton[7] = valButton[7];

I think that should take care of it, I hope. Sorry I didn’t realize these changes were needed sooner. Let me know if that fixes it.

4 Likes

Yes, that was very good - it works perfectly!
Its a miracle for me.
Thanks a lot!

5 Likes

Great, thanks, I’ll update the code on the repository!

2 Likes

I pushed a new version of the code, if you have a chance to download it and verify it with your sequencer that would be great https://github.com/holmesrichards/8StepSequencer/blob/master/Software/sequencer/sequencer.ino

4 Likes