Big Button gate length

Hey,

Im building a Big Button. I am no coder…

How do I change the total OUTPUT trigger length to be longer? I dont really need it per channel, just a global variable.

Is it easy to make it a variable length, either switched for ‘short’ / ‘long’ or variable via a pot? How?

maybe its this delay (10), and I can make it bigger?:

digitalWrite(OUT1,Sequence [1+BankArrayShift1][BankPush1 + NewKnobValue1] || (Fill1));
digitalWrite(OUT2,Sequence [2+BankArrayShift2][BankPush2 + NewKnobValue2] || (Fill2));
digitalWrite(OUT3,Sequence [3+BankArrayShift3][BankPush3 + NewKnobValue3] || (Fill3));
digitalWrite(OUT4,Sequence [7+BankArrayShift4][BankPush4 + NewKnobValue4] || (Fill4));
digitalWrite(OUT5,Sequence [8+BankArrayShift5][BankPush5 + NewKnobValue5] || (Fill5));
digitalWrite(OUT6,Sequence [9+BankArrayShift6][BankPush6 + NewKnobValue6] || (Fill6));
delay(10);
digitalWrite(OUT1,LOW);
digitalWrite(OUT2,LOW);
digitalWrite(OUT3,LOW);
digitalWrite(OUT4,LOW);
digitalWrite(OUT5,LOW);
digitalWrite(OUT6,LOW);
buttonState = LOW;

cheers

Lance

2 Likes

I’m far from coding too :grin:
but my first thought is that it is a Trigger signal and not a Gate signal, so not sure if this is possible, but it is only a thought, the reality is often different.

Yes, I just want a longer trigger for my light based synth stuff as LDRs are slow, and also longer flashes may lokk cooler.

My first idea was to analog it with caps and buffers ala the MFOS Cmos strategy, but that uses 2 chips when it really seems like there should. Be a digital programming solution for something so simple.

2 Likes

If the code solution don’t work, here’s a simple Trigger to Gate schem from Niklas Rönneberg

clk2gate_components

await the advice of the coding specialist :slight_smile:

2 Likes

Nah thats waaaaay too much to do per channel!

Im pretfy sure that code bit i pasted is corrext, but it may also slow down the whole provram if i change it. I may get to test it tonight. If i do have to resort to analog, ill be doing the pulse stretcher from Ray Wilson here.

Which will need just 2 * 40106 plus a cap and r per channel. But thar still seems crazy vs just knowing which line of code to change…

2 Likes

Changing that delay(10); instruction will increase the length of the pulse, however…

During that time, the Arduino isn’ t doing anything, not even watching the buttons, so it may become really slugish to respond to user input.

Just try it and see if you can stand the slower interaction…

1 Like

Yes. That is what i feared…

Ill have a play and see how it works. Id rathrr have responsive with more supprt chips than laggy…

I do this in my MIDI to CV code:

Declare a global

unsigned long trigTimer = 0;

Near the top of the loop:

  if ((trigTimer > 0) && (millis() - trigTimer > 20))
    {
      digitalWrite(TRIG, LOW); // Set trigger low after 20 msec
      trigTimer = 0;
    }

and then at the place in the code where the trigger is to be generated

  digitalWrite(TRIG, HIGH);
  trigTimer = millis();

So the Nano stays awake and working during the time the trigger is on.

5 Likes

I’m betting we could also refactor these with interrupts to decouple the interface with the running of the sequencer.

I need to build one of these soon.

2 Likes

Yeah, I did that with the GEAR sequencer. I ended up having to put more into the interrupt handler than I liked but it seems to work. Before doing that the user interface really bogged down the sequencing. I switched the digitalWrites over to DirectIO library calls which are supposed to be much faster.

But that’s a big project. If the easy way works, it works.

1 Like

This is super guys. Thanks a lot. Ill try it tonight or next week.

There are lots of forks of this out there now when you search, is there any particular vesion you coders would recommend over another to base it on?

ok,

what with parenting and COVID and the inevitable electronics letting off the wrong kind of smoke, its taken me over a week to get back to this.
i also have no idea about what I’m really doing, and I don’t actually know where to put this code. I tried puttinig it here:

void loop()
{
RecordButtonState = digitalRead(BigButton);
DeleteButtonState = digitalRead(ButtonDelete);
ClearButtonState = digitalRead(ButtonClear);
ResetButtonState = digitalRead(ResetButton);
FillButtonState = digitalRead(FillButton);
ButtonBankSelectState[BankArrayNumber] = digitalRead(ButtonBankSelect);//These setup the states of the buttons
unsigned long trigTimer = 0;

if ((trigTimer > 0) && (millis() - trigTimer > 20))
{
digitalWrite(TRIG, LOW); // Set trigger low after 20 msec
trigTimer = 0;
}

{if(buttonState == HIGH) {

looper    = (looper+1);
BankPush1 = (BankPush1+1);
BankPush2 = (BankPush2+1);
BankPush3 = (BankPush3+1);
BankPush4 = (BankPush4+1);
BankPush5 = (BankPush5+1);
BankPush6 = (BankPush6+1);
ClockKeep = (ClockKeep+1);

digitalWrite(TRIG, HIGH);

trigTimer = millis();

digitalWrite(OUT1,Sequence       [1+BankArrayShift1][BankPush1 + NewKnobValue1] || (Fill1));
digitalWrite(OUT2,Sequence       [2+BankArrayShift2][BankPush2 + NewKnobValue2] || (Fill2));
digitalWrite(OUT3,Sequence       [3+BankArrayShift3][BankPush3 + NewKnobValue3] || (Fill3));
digitalWrite(OUT4,Sequence       [7+BankArrayShift4][BankPush4 + NewKnobValue4] || (Fill4));
digitalWrite(OUT5,Sequence       [8+BankArrayShift5][BankPush5 + NewKnobValue5] || (Fill5));
digitalWrite(OUT6,Sequence       [9+BankArrayShift6][BankPush6 + NewKnobValue6] || (Fill6));
delay(10); // 10 ?
digitalWrite(OUT1,LOW);
digitalWrite(OUT2,LOW);
digitalWrite(OUT3,LOW);
digitalWrite(OUT4,LOW);
digitalWrite(OUT5,LOW);
digitalWrite(OUT6,LOW);
buttonState = LOW;

}
else
{
looper = looper;
ClockKeep = ClockKeep;
}
}

but it dont liek that at all…:

/home/lance/Documents/synth/BB/code_b_b/code_b_b.ino: In function ‘void loop()’:
code_b_b:198:20: error: ‘TRIG’ was not declared in this scope
digitalWrite(TRIG, LOW); // Set trigger low after 20 msec
^~~~
/home/lance/Documents/synth/BB/code_b_b/code_b_b.ino:198:20: note: suggested alternative: ‘TWIE’
digitalWrite(TRIG, LOW); // Set trigger low after 20 msec
^~~~
TWIE
code_b_b:213:18: error: ‘TRIG’ was not declared in this scope
digitalWrite(TRIG, HIGH);
^~~~
/home/lance/Documents/synth/BB/code_b_b/code_b_b.ino:213:18: note: suggested alternative: ‘TWIE’
digitalWrite(TRIG, HIGH);
^~~~
TWIE
exit status 1
‘TRIG’ was not declared in this scope

can you possibly be a little bit more precise as to where i stick it?

The code snippets I posted were from my MIDI to CV code, they won’t work here without modification. And they’re not to be just added, they’re to replace some of what’s there now. Instead of writing to TRIG you need to write to OUT1 through OUT6. Where there now is a 10 ms delay and then writing LOW to OUT1 through OUT6 is where you should instead put trigTimer = millis();. Also the declaration of trigTimer needs to be global — before, not inside, the loop() routine. I don’t have this module so I can’t write and test the code for you but that’s the gist of it.

2 Likes

Aha. I had thought as much but thought i could end up faffing for hours, so just asked first…

Hopefully ill have a chance to try it tonight, not in 2 weeks…

1 Like

Ok I tried and had a look, but I really don’t have clue about coding so its really too much for me to have a crack at it. The digitalWrite in the BB has a heap of extras which I guess is the code for the programemd seuqnce (hence ‘Sequeunce’ in there)…

I’m suire for coders your instructions are sufficient and this task is trivial, but for me, that depth of instruction is kind of like saying to an analog newbie ‘make a basic op amp inverting mixer with trimpots for the required DC offset then just invert it again to get the signal within range.’

That, I can do no worries. This. Nup…

If anyone can help me out that would be great.
in the meantime I’m just going to get the basic hardare wokring again and think about doing this the analog way BUUUUT I’d rather do it with program if pssible becasue that just seems more sensible…

IF anyone can help, I’d also wonder if its possible to make the gate legnth adjustable. I’d swap out the shift pot for gate length OR happily add a third pot.

cheers,

Lance

2 Likes

you kniow what. after all my stress, i think im fine.

ive got a pretty edge use case here wher i am driving high power LEDs for mega flashing light action, and when I benched it last time the pwoerLED was really dim, which I had interpreted as a really shprt trigger pulse.

But i just used a new arduino (the last one fired ) it is now totally usable for my case… I wonder if the old one was on its way out and I didnt realise it before…

3 Likes

Bench test…

The black tube with yellow tape is actually a light sensor driving a BMC FM drum standalone. Normal people would just use a cable…

3 Likes

Ok. So I’m opening this topic up again with a Backflip. …

The gate is too short. I need to sort something out one way or another…

This is a video of our performance last weekend. The LED array (dubbed the do-deca-LED because theres 12 of them) is functioanlly split in two halves. The Right half from this view is a simple clock divider, the left half is the Big Button. As you can see the BB is blown away in terms of brightness to the point where its not relly functionaing as intended without a ton of faff. In the end, after making whats a pretty awesome light machine, I only really used half of it…

I’d really like some help to modify the code. Ideally in a way that the gate length can be either switched short/long or analog controlled with a pot, but at the least, set to a greater value without slowing down the code.

I’m happy to learn a bit and do the work but I need, at the least, some advice to get started. I am not trying to become a coder here, just smoosh other peoples code together in a way that works for me.

cheers,

Lance

2 Likes

Hey, I’m in the middle of a big move so I don’t have my computer in front of me, but can you post the code you are currently using in it’s present form? Should be as simple as increasing the wait times between the low and highs.

1 Like

The original code does a delay(10) in the main loop, inceasing it, while increasing the length, makes the user interface slugish…