Go Down

Topic: USB Midi Foot Controller Help (Read 2831 times) previous topic - next topic

cameron206

ha ha I would bet a million dollars that switch is a latching switch. Many guitar amp channel switchers use latched.

Put a meter on it.

NervusTwitch

ha ha I would bet a million dollars that switch is a latching switch. Many guitar amp channel switchers use latched.

Put a meter on it.

I thought the same but this wasnt an analog pedal like the normal type. This type controlled onboard digital effects the amp had itself.
Now to be sure I tried a switch tonight from a batch of momentary switches I ordered for projects that required non latching. Tried 2 of them. No matter which one I tried same results.

I have gone thru the wiring more than I can count now with a 600 lumens headlamp and magnifying glass to see every connection best I can. It all looks good.

This is really frustrating, never had an issue like this with everything I have made thru the years using those foot switch types.

Tell me if I did something wrong with connections that Im overlooking maybe.

Basically 1 lug on each switch are all connected by a single GND wire,that same lug also has the led leed.
The opposite LED leed has the resistor that goes to Pro MIcro pins for all led's.

The 2nd lug of the switch then goes to each pin on the Pro Micro.

I have wired in a 5 pin DIN jack to be able to connect the external expression pedal and on/off switch to main unit with Arduino and switches.
POT= 1 pin GND,1 to 5v, and 1 to Pro Micro pin.
switch is wired same as the others.

1 LED to show power when USB connected. Of course 1 to 5v and other to GND with needed resistor wired correct.

Best of my knowledge that should be correct.

PieterP

Does the problem occur when you're using just one button?
Code: [Select]
#include <Control_Surface.h>
 
USBMIDI_Interface midi;

CCButtonLatched button = { 3, 0x13 };
const pin_t ledPin = 14;

void setup() {
  Control_Surface.begin();
  pinMode(ledPin, OUTPUT);
}

void loop() {
  Control_Surface.loop();
  digitalWrite(ledPin, button.getState() ? HIGH : LOW);
}

NervusTwitch

Does the problem occur when you're using just one button?
Code: [Select]
#include <Control_Surface.h>
 
USBMIDI_Interface midi;

CCButtonLatched button = { 3, 0x13 };
const pin_t ledPin = 14;

void setup() {
  Control_Surface.begin();
  pinMode(ledPin, OUTPUT);
}

void loop() {
  Control_Surface.loop();
  digitalWrite(ledPin, button.getState() ? HIGH : LOW);
}


I'll give that a try.
Gonna go get a new test meter today before I do much more, mine decided to quit on me last night

NervusTwitch

Found the issue.

Ok so the original 4 switches that I mentioned from the old pedal I used, 3 are momentary and 1 was latching. Why this was done I have no clue but all 4 are the original installed by Marshall.

No for the other part that stumped me. Couple months ago I ordered 20pc momentary foot switches, each sealed individually and all 20 labeled "MOMENTARY". I used most of them rebuilding and replacing a previous pedal board project all of them had proper function.

Now all the ones I had left still sealed and labeled from seller said momentary but they are not. SPST Latching is what they really are and if my test meter wasnt acting up without my knowing before it quit altogether I would have known that from the start.

This lil project has been one of the most pains Ive had to deal with in a long time. 1st its me getting confused with the code because of a bug/glitch happening with the IDE,then all my confusion and really messing it up to wrong mislabeled switches and finally a test meter going faulty until it just quit....Just WOW...lol.

Anyways had to order more switches and I think its all worked out and proper function.

But yall may hear from me again soon since I know how this is working, I'm think I wanna add one of the port expansion cards to give me a few more pins. I wanna add a side plug in pedal that will use 3 pedals w/led to control my looper in the same amp sim software.

Just 2 questions.
What Multiplexer card would I need? I looked up the one Grumpy mentioned on the 1st page searching by the chip model.
Should I need a specific layout on the card or just any as long as its running that chip?
I usually use Amazon U.S. for that stuff.

Any example code I can get that shows how to add that to mine? I dont need a code for looper just for adding the PIN expansion card.

I dont think it will be as hard for me to figure out since I have better understanding how the code works since I really had it correct the 2nd time I tried but the software was bugged making me think I messed up.

Thanks again everyone, I learned quiet a bit thru all this.

PieterP

Glad to hear you found it!

Personally I use 74HC4067 16-channel multiplexers for most of my projects. I got them from eBay, on a small breakout board (less than $1 each, IIRC). The 74HC4051 is similar, it's an 8-channel multiplexer if you don't need 16 channels. Multiplexers are very simple devices, so it doesn't really matter which one you buy.

Multiplexers are supported out of the box using Control Surface, just declare the multiplexer, and use their pins (mux.pin(n)) instead of the usual pin numbers (A0 etc.) when declaring the potentiometers, buttons, or other inputs.
See this getting started guide.

NervusTwitch

Glad to hear you found it!

Personally I use 74HC4067 16-channel multiplexers for most of my projects. I got them from eBay, on a small breakout board (less than $1 each, IIRC). The 74HC4051 is similar, it's an 8-channel multiplexer if you don't need 16 channels. Multiplexers are very simple devices, so it doesn't really matter which one you buy.

Multiplexers are supported out of the box using Control Surface, just declare the multiplexer, and use their pins (mux.pin(n)) instead of the usual pin numbers (A0 etc.) when declaring the potentiometers, buttons, or other inputs.
See this getting started guide.
Thanks.
That sounds easy then.

cameron206

Quote
Ok so the original 4 switches that I mentioned from the old pedal I used, 3 are momentary and 1 was latching. Why this was done I have no clue but all 4 are the original installed by Marshall.
ha ha where is my $1M

NervusTwitch

ha ha where is my $1M
Your gonna be waiting a loooooong time for that....lol

chrisplaysmusic

Found the issue.

Ok so the original 4 switches that I mentioned from the old pedal I used, 3 are momentary and 1 was latching. Why this was done I have no clue but all 4 are the original installed by Marshall.
This is a cool project. I was looking for something similar. Would love to see some photos/video once you have everything done.

-Chris
https://www.guitarlobby.com/best-midi-keyboards/

NervusTwitch

This is a cool project. I was looking for something similar. Would love to see some photos/video once you have everything done.

-Chris
https://www.guitarlobby.com/best-midi-keyboards/
I'll get ya some pics.
Its basically done, just a few tweaks Im making here and there as I go.
So far its working pretty good.

Only 1 downside with it so far.
Amplitube 4 doesnt send midi out to devices so if you control anything with mouse and doesnt change the state of the leds on the controller which really isnt a problem for me. I just have to engage all the switches to light up before I start Amplitube then its fine.

I just used old pedals that were no use to me anymore to work. I already had everything on hand so it was a cheap project.

NervusTwitch


This is a cool project. I was looking for something similar. Would love to see some photos/video once you have everything done.

-Chris
https://www.guitarlobby.com/best-midi-keyboards/



Housings used:
Old Marshall AVT foot controller
Behringer FS112
Zoom vol/exp pedal

The board was just plywood with black vinyl on top. The aluminum was U channel and cut to 45 degree angles at corners.
Gutted all original electronics except switches.

The exp and FS112 were connected by using 5 pin DIN jacks and I made the patch cables.
The Behringer pedal with the red and green leds are for controller my DAW(Reaper). Green=play and red= record.

So far all works great. I think I need to change the exp pedal pot to a 10k,its 100k right now.

NervusTwitch

Hmm didnt post the pic for some reason

I also repainted the Marshall box since the original finish was really bad off.


Try again


NervusTwitch

Glad to hear you found it!

Personally I use 74HC4067 16-channel multiplexers for most of my projects. I got them from eBay, on a small breakout board (less than $1 each, IIRC). The 74HC4051 is similar, it's an 8-channel multiplexer if you don't need 16 channels. Multiplexers are very simple devices, so it doesn't really matter which one you buy.

Multiplexers are supported out of the box using Control Surface, just declare the multiplexer, and use their pins (mux.pin(n)) instead of the usual pin numbers (A0 etc.) when declaring the potentiometers, buttons, or other inputs.
See this getting started guide.
I have a quick question about the code im using, the one you gave in examples.

Its using latched buttons with the LED's indicating the state. I wanted to try using non-latching so in the code CCbuttonslatched, I just removed the latched command but that gave errors.

So how do I keep the function of the led's but with non-latching?
Trying a new DAW and there seems no setting to make it latched on or off so I have to double click everything.
Id like to try without latching to know if I want to use the controller or not in DAW since my amp sim allows me to set latched or not in the settings.

PieterP

Its using latched buttons with the LED's indicating the state. I wanted to try using non-latching so in the code CCbuttonslatched, I just removed the latched command but that gave errors.
The CCButton class doesn't have a getState method (because it doesn't have a latched state). It does have a getButtonState method. If it returns Button::Pressed, turn on the LED.

Go Up