Can you suggest a 4-position rotary switch?

Building a MIDI Controller but I'm having a difficult time finding a suitable 4-position rotary switch (not an encoder). This switch will send MIDI CC messages to connected devices and will specifically choose the oscillator waveform. There are four possible waveforms the oscillator can generate: Square, Saw, Triangle, Sine. This switch will control which wave is generated.

Suggestions for switch make/model? Having a tough time finding something suitable. Thanks in advance.

What, exactly, do you intend this switch to do?

Is it just an input to an Arduino, so the Arduino can detect the 4 different options?

Searching for "4 position rotary switch" seems to show loads of possibilities. :thinking:

1 Like

Yes, the ground pin of the switch will go to the ground bus (pin) and the other four pins will connect to analog input pins. This is purely to connect to the Arduino to select which MIDI CC messages to send, which will select which waveform the oscillator generates.

That doesn't quite make sense. Do you mean that the 4 pins will connect to 4 analog inputs? If so, why analog inputs? They will be digital signals.

Or did you mean 4 pins will connect to a single analog input? You could do that by connecting the common pin to the analog input, pin 1 to ground, pin 4 to Vcc and adding 3x 1K resistors between pins 1, 2, 3, 4.

Another method, if you are short of analog pins, would be connect the common pin to ground, connect the common pin to ground, pin 1 to an Arduino digital pin with a diode, pin 2 to a second Arduino pin with another diode, pin 3 to both those 2 Arduino pins with 2 more diodes and leave pin 4 unconnected.

1 Like

As @PaulRB said, why analogue pins?

But, anyhow, any of those switches shown should be fine for this application.

Thanks for the reply @awneil and @PaulRBryson - I am not familiar with putting together electronics or using Arduinos at all, totally new. Have been reading and reading, but there's a lot to absorb. Apologies for the newbness.

@PaulRB I have available digital inputs, yes for sure. Would this ask become easier if I were to use the digital input pins on my Leonardo instead of analogue inputs pins for this Sp4t rotary switch implementation? Thank you.

You were asking for a switch - as far as that goes, it makes no difference.

But using digital inputs would make more sense - they analogue pins are a rarer commodity, so use them only when you really need to.

EDIT

Correction - see post #9

The easiest method is to use 3 Arduino pins for the switch because no extra components would be needed. These could be digital or analog pins, but if you used analog pins, you would not really be using them as analog pins, you would be using them as digital pins (which they can also do, with rare exceptions). That could be a waste, because most Arduino have fewer analog pins compared to digital, making analog pins more valuable.

You could reduce the need for 3 digital pins to 2 by using 4 diodes.

You could reduce the 3 digital pins to 1 but that pin would have to be an analog pin, and 3 resistors would be needed.

@awneil meant so say that analog pins are a rarer commodity.

1 Like

Indeed I did. I've updated post #8

@spevinkasey - you might ask why only 3 when the switch has four positions?

Consider:

  1. Your 1st input is activated by the switch in position 1
  2. Your 2nd input is activated by the switch in position 2
  3. Your 3rd input is activated by the switch in position 3
  4. None of the inputs is activated - the switch must be in position 4 !

Thus you can detect the four positions using only 3 inputs!

2 Likes

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.