Go Down

Topic: Multiple position switch (either rotary, toggle, etc.) (Read 466 times) previous topic - next topic

yakumoklesk

Hi, I would need a switch that provides multiple positions, but that outputs an PWM value that can be read just by using only one pin of the Arduino.
I've seen this:
https://www.dfrobot.com/wiki/index.php/Rotary_Switch_Module_V1_(SKU:SEN0156)

The problem is that the shipping costs is higher than the price of the swith itself. I would like to know if there is any alternative that can be send with lower shipping costs or even free like some things on AliExpress.

I've found many rotary switches, that have multiple outpus, but I don't se those output pins fitting on a breadborad, nor I have no idea of how converting so many pins into just only one, although I've read that resistors need to be used for that.
I would appreciate any help that you could give to me.

My project is just as simple as use the switch to select a different song to play every time. Is something I want to show to my toddler.

Thanks in advance.

Grumpy_Mike

#1
Feb 07, 2018, 01:42 pm Last Edit: Feb 07, 2018, 01:42 pm by Grumpy_Mike
How about this:-
12 position rotary switch

Quote
I've found many rotary switches, that have multiple outpus, but I don't se those output pins fitting on a breadborad,
So don't use a breadboard, hateful unreliable things anyway.


Quote
nor I have no idea of how converting so many pins into just only one,
Use the circuit on the right and just add more resistors.

yakumoklesk

Thanks for your answer. I've seen in this page http://simvim.com/arduino/in_analog.html that the guy also uses a capacitor. I was wondering why some diagrams I've seen introduces a capacitor and others don't. Is there any real danger of a peak voltage in a circuit like this?

Thanks.

David.

PaulRB

If by "peak voltage" you mean a voltage spike, no. The cap is probably just for debouncing, and could be done in software instead. The rotary switch probably has "break-before-make" contacts, so there will be short periods where the analog input is floating and could read anything from 0 to 1023 for a reading or two. If your code checks that the reading is stable before acting on any change, you can probably dispense with the cap.

yakumoklesk

Yes, I wanted to say voltage spike, thanks for the clarification. Also thank you for the explanation, it helps me understand more. Now I understand why a cap is not needed when using an array of buttons.

Regards,

David.

Go Up