12 way 1 pole rotary

I’m using this 12 way rotary with these 10 kohm resistors. I wired everything like this.

Now, the problem is that the first four positions show the full voltage, the “middle” four positions show oscillating strength, which stays more or less the same, no matter the position, with a little ditch whenever I change the position. You can see the plotter displaying it here. The red circles show whenever I turn the rotary once. The last four positions show zero voltage. When I check the outter pins individually they all show full voltage.

The code I’m using:

void setup() {
  // put your setup code here, to run once:

void loop() {
  // put your main code here, to run repeatedly:

Thanks in advance.

Seems the wiring is picking up some interference.
Possible, because total resistance is >=120k.
Datasheet of the MCU recommends an impedance of <=10k, so you should have used a ladder of 1k resistors.

Try to fix it with a 10-100n capacitor from A5 to ground, close to the Arduino pins.
And/or use shielded wiring if wiring is long/exposed.

P.S. What is exactly the amplitude of the oscillation.

Your wiring does not show which of the central pins you connected to the analog. There are A, B, and D central pins, by the link you gave for the switch. You assume it is a single pole, 12 position switch, just like the Chinese wrote on the heading. Obviously you have discovered they are not correct. You need to use and Ohmmeter to determine for yourself how the switch is connected. Make a table of connections you find.

All switches are either "break before make" , meaning the current connection is opened before the next connection is made, or "make before make", which is uncommon and will make the next connection before opening the prior connection. Your little "ditch" proves the switch is "break before make".

When you have the table of the internal switch connections, post it here and we can help.


I agree with Paul_KD7HB in that you don’t have what you think.

I can’t be sure but it looks to me like it might be a 3 pole 4 position switch.

The 12-position switches I have from China are indeed 12 positions.
They also have the ABCD writing on them, but only one pin is long. The other ones are short (cut off).
Those switches also come in 26 positions, 43 positions, etc. In which case some or all of the ABCD pins are long.

Can you post a picture of the switch and the resistors connected?

Cnd can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
Showing the pin numbers on your schematic.

Thanks… Tom… :slight_smile:

Get out the multimeter and check the switch is doing what you expect, then check that the ends of
the resistor string are actually at 0V and 5V, then check each contact on the switch is at the voltage
you expect, then check that the centre pole is set to the correct voltage for each position of the switch,
etc etc. IE when troubleshooting assume nothing and measure everything.

Thank you for all the responses and sorry for the late reply.

@Paul_KD7HB I connected the A pin since it's the only one that "sticks out" and the others seem to be leftover from production.

@TomGeorge I posted a drawing of my circuit in the main post, you could simply add more pins in between and number them 1 to 12, I didn't do that for clarity's sake. Here is a picture of it. Sorry for the bad solder job, I only wanted to make a small project and haven't soldered in ages.

Which leads me to my next point, I don't have an ohmmeter and neither do I have a multimeter which makes troubleshooting a bit difficult. I don't have any transistors or smaller resistors either.

@wawa Here is an image of the plotter. That's when the rotary is one of the middle four positions.

Again, thanks for the help guys, really appreciate it. I've already tried figuring it out with the help of a friend before I came here but I feel like without a multimeter it's almost impossible to troubleshoot this properly. I'll probably just call it done and leave the rotary out.

You can get quite cheap multimeters - a worthwhile, almost essential tool in your toolbox !!

You can get quite cheap multimeters - a worthwhile, almost essential tool in your toolbox !!

Indeed. Harbor Freight has their lower tier model as a 'free with any purchase' item from time to time.