Changing the functionality of a foot switch using transistor - Looking for some advice from the pro

Yes, that is what is so truly terrible about the "tutorials" on the Arduino site which "teach" things entirely contrary to good engineering practice. :roll_eyes:

More practical and generally safer. Wiring the power supply line to switches, contacts or in fact anything that you do not need to, carries a risk however slight, of interference with the supply either from picking up impulses from other devices or mechanical damage and being shorted to ground.

In addition, the microcontroller provides a built-in pull-up resistor function of approximately 45k, which may be sufficient to not require an external component.

Any, preferably small, a reed relay would probably be very appropriate.

It suppresses a substantial voltage surge when the transistor switches off the current to the coil, called "kickback" and other things.

@bklyn3 yes Paul is correct in what he says.

@Paul_B
@Grumpy_Mike

Thanks Paul and Mike. I am truly learning a lot here.

So from what Mike previously suggested, I would have to wire the button as follows (the right 5V wire goes to the relay so ignore it for the sake of the button discussion) :

Is that right ?

I have also seen postings where it is wired without the resistor + 5V connection. Directly to the ground, like this :

Is this second wire diagram acceptable ? If so, why would you favor one vs the other?

It assumes you are using a pinMode of INPUT_PULLUP on that pin to enable the internal pull-up "resistor" of approximately 45k.

Yes

Because:-

  1. You don't need an extra component.
  2. In the wiring you don't have 5V going round the place which as the potential to cause damage in the case of a wiring mix-up. See my tutorial at Inputs

If you are keen to learn about MIDI and Audio then I do have a book out:-
Arduino Audio Projects

Hi Mike,

Thanks a lot for the link to your tutorial. I should have started there !!!
I will checkout your book.