Switch Ground wiring Question.

Status
Not open for further replies.

bossredman

Well-known member
Switch Ground Routings.JPG

Hi - before I started on big tear up of my Midi Foot Controller wiring, I just wanted to double check.

Currently the switches in my controller are wired up as per the diagram on the left. (ie each switch's ground pin is seperately wired to the ground bus-bar on my proto-board).

I want to simplify/tidy it up - as it's like spaghetti junction inside.

Plan was to move to wiring as the diagram on the right. (ie link all the earth pins on each switch together & tie last switch to the ground bus-bar on my proto-board ).

Are there any downsides/pity falls/watchouts with this proposal?
I'm no electrician/electronics engineer - so would I need to say use a larger guage of wire for the common grounds.

Thanks
 
Arh sorry - yes - big boo boo in my drawing (I rushed it to get it out there tonight as I know alot of teh folks on this forum are US based).

The Ground for the Switch on pin 2 wil also be also be part of the chain (ie connected to the Ground of the Switch connected to pin 3.
Thanks
 
Paul or one of the EEs here may give a more definate answer... but I highly doubt it would affect operation of the controller -- especially not digital signals.

You may get more pot jitter on way over the other (still minimal) but I can't see digital logic being effected by tiny deviations from ground voltage.
 
Last edited:
Thanks oddson.

Just noticed that the diagram I moified was quiite old.
It was just meant to give folks a quick idea of my intensions.

But just to be 100% accurate:
- the controller is now a Teensy 3.6
- I currently have 22 switches as Digitial inputs (pins 3 - 12, 24 - 32 & 36 - 37).
(I may in future also look to add a further 8 switches (Dig pins 14 - 21) plus 2 pots on Analogue pins (22 - 23).


Paul or one of the EEs - as oddson says - would be nice to some input from yourselves before I proceed pls.
 
The potential problem with having grounds wired like that is if you have high current draw. So if the wire from the common grounds is 1 ohm, and you have 10 switchs that draw 100ma when closed things will be fine with switches open, but as more switches get closed you get more and more current draw through that 1 ohm wire until if 10 buttons are down you have 1V of the 3.3V being lost in that wire and the suddenly there is 2.3V levels where the design assumed 3.3v

All of this is making some extreme assumptions, but is where this sort of solution might come to greif, if say it was 10 light switches on the end of a long lead all wired together on a common return.

With digital inputs where currents are in the uAmps or less no feasible wire is going to have a measurable voltage drop, and even if it does the digital inputs will still work as intended until you got above about 30% of VCC.

So your design is sound for digital inputs, and for pretty much any sane analog inputs so go to it.

For info where such a scheme might cause trouble would be if one or more of those pins was passing high current as an output, especially pulses (say driving a transmitter or heavy LEDs) while other pins were reading a pot or other analog sensor. Even with quite solid wires this would probably get noise from the high current source into the analog read and generally make problems. Lots of stuff to dig into in this area re best practice, but for what you've for the simplified design is what you want.
 
Thanks.

I should have also mentioned that all the switches are "momentary" (non-latching) AND in general operation, only 1 switch would be pressed at any one time.
The only exception would be if my foot accidently hit 2 (or more) switches at the same time.
 
I cant see any practical problems with what you're planning. Even with all the switches pressed, I'm sure you wont be drawing enough current to cause any issues.

Just a couple of random comments.

I guess you will rely on internal pull-ups, as you don't seem to have any external ones.

If the most number of switches to be pressed simultaneously is only two, there are better ways to maximise the number of switches with a lower pin usage, such as a resistive ladder, or a strobe/return button matrix. You could support many more momentary switches, rather than one per pin.

In your software, you will need to debounce the buttons, rule of thumb, is about 4 consistent samples of the pin at 10ms intervals, to ensure the button is fully pressed or fully released. (perhaps the libraries do this for you, I'm not sure).
 
Thanks for those comments.
I think with these comments & the previous ones I feel confident enough to begin with the re-wire.

BTW - my project is already up & running & work fine.
Yes I am using Internal Pull-ups.
I'm also de-bouncing the switches using the "Bounce.h" library. (There is a Bounce2 library available - everything seems to work OK so didnt feel the need to update as there was code changes needed for Boucne2).
The Teensy 3.6 has enough I/O pins for my needs but will take a look at your other suggestions for future reference.
 
Status
Not open for further replies.
Back
Top