Go Down

Topic: Midi Footcontroller switch problem (Read 8279 times) previous topic - next topic

gregchill

Hi

I came across this site DIY midi foot controller http://www.pekenverenmediaproducties.nl/projects/ and downloaded the sketch  and instructions which is very good and decided to have a go, and after a couple of weeks i finally got it working, every thing works the way it should, except on extra switch  1 & 2 when i send a cc number from the controller to the unit, the switch turns off the effect and wont turn it back on.
I have tried different combinations of the switch but the same thing keeps happening,i have researched how to fix it but to no avail.
I am very new to Arduino code and i am not sure what part of the code to change any help would be appreciated.


Greg

Grumpy_Mike

I can't see a schematic on what you linked to.
The hardware and software are intimately linked, one is not much use without the other.

I would suggest that if you are having trouble with the extra buttons then they are not wired up right, but what is "right" is impossible to tell without a schematic. Did I miss it in that page?

gregchill

Hi,

Thanks for the reply, on the home page there is a list of where the hardware is connected to the pins other than that there isn't a schematic, and your right it is probably the way i have the switch wired, is their anything i can try.

Grumpy_Mike

Lists are crap at replacing a schematic. You can try drawing a schematic of what you have wired, then it is easy to spot if anything is wrong.

The other thing you can do is some debugging serial prints to look at values of variables at points in the code. Or even write test code just to test your switches are working as you expect.

gregchill

Hi

I have drawn a schematic first time using the program so please forgive the mess,

i tried connecting the switch to another basic sketch and it works fine.
it works in this sketch by turning the led on and off on the extra switch setting when pressed, i think it is something to do with the midi messaging.

Grumpy_Mike

Thanks, yes not the best schematic I have seen.
There appears to be no resistors in line with the LEDs is this correct?
If so the person who wrote that web page is an idiot. You need to put a 220R in series with every LED to prevent damage to both the LED and your Arduino.

Quote
i tried connecting the switch to another basic sketch and it works fine.
OK but that is not really the way to connect external switches.

Given that the code was also written by the same idiot who did the hardware we have a job finding out what he has done wrong. Have you tried contacting him?

gregchill

Sorry yep the resistors in the schematic is my fault, i do have a resistor going to each led, i tried about a week ago e-mailing the guy who made it but no answer yet.
What is the best way of connecting the external switch? i have tried many combinations.
I took a reading with the multi meter the switch is getting 5 volts at the pin and when pressed 0 volts i think thats what should be happening.
Funny i don't have any problem changing programs or banks.

Grumpy_Mike

Quote
What is the best way of connecting the external switch?
Put the switch between input and ground and enable the internal pull up resistors. That way you don't need external resistors. The "logic" is reversed, that is a low for a push and a high for no push but that is the way the pros do it.

http://www.thebox.myzen.co.uk/Tutorial/Inputs.html

Quote
Funny i don't have any problem changing programs or banks.
So its pointing to the software then. I will try and have a look at it.

Grumpy_Mike

OK the code and schematic do not match up.
In the setup function you have:-
Code: [Select]
pinMode(P1, INPUT_PULLUP);
  pinMode(P2, INPUT_PULLUP);
  pinMode(P3, INPUT_PULLUP);
  pinMode(P4, INPUT_PULLUP);
  pinMode(L1, OUTPUT);
  pinMode(L2, OUTPUT);
  pinMode(L3, OUTPUT);
  pinMode(L4, OUTPUT);
  pinMode(S1, INPUT_PULLUP);
  pinMode(S2, INPUT_PULLUP);
  pinMode(LS1, OUTPUT);
  pinMode(LS2, OUTPUT); 

  pinMode(PDL1,INPUT_PULLUP); 
  pinMode(PDL2,INPUT_PULLUP); 
  pinMode(BD,INPUT_PULLUP); 
  pinMode(BU,INPUT_PULLUP); 


And yet the schematic shows the inputs with pull down resistors.
Try this,
change all the pinMode INPUT_PULLUP into just INPUT and see if it works.

gregchill

Hi Mike,

Thanks for all your help, i have rewired all the switches as you suggested from input to ground and took out the resistors( using the internal resistors) connected to the switches and they all work fine except extra switch 1, which still turns the switch 1 led on and off and turns the effect off and not on again.

I also tried change all the pinMode INPUT_PULLUP into just INPUT and its still the same.

Its like the switch is only sending one midi command to turn off the effect.

Grumpy_Mike

Have you mipodifurd the code so that the logic is inverted? You need that if you change the switch wiring.
The just INPUT should only be used if you do not change the wiring.

gregchill

The software says input_pullup on all the switches work fine from input to ground except the extra switch without any other external resistors.

gregchill

The extra switch 2 is doing the same thing.

gregchill

He also mentions in the software for extra switch 1 & 2 he is using latching switches does this make any difference?

Grumpy_Mike

Quote
The software says input_pullup on all the switches work fine from input to ground except the extra switch without any other external resistors.
The software is full of bollocks comments like that.
That is not consistent with your schematic. The internal pull up resistor are about 40K and the external pull down is 10K. This means that the input sits very uncomfortably at some sort of mid voltage level.

Quote
He also mentions in the software for extra switch 1 & 2 he is using latching switches does this make any difference?
No.

I have been looking at the software and it is quite clear that the person who wrote it has a very muddled idea about how to write software. It is very convoluted and much more complex than it needs to be for what it does. It is sadly almost impossible to follow.
Is it possible that you have made an error in actually wiring it up. Can you take some voltage measurements on those inputs with the switches pressed and not pressed running the software.

Go Up