Another Mostly 3D Printed Rotary Switch




Introduction: Another Mostly 3D Printed Rotary Switch

About: A retired software developer, living in Waterloo, Ontario, Canada, who appreciates having the time to make whatever the heck he damn well feels like!

A while back I created a Mostly 3D Printed Rotary Switch specifically for my Minivac 601 Replica project. For my new Think-a-Tron 2020 project, I find myself in need of yet another rotary switch. I am looking for a SP5T panel mount switch. An additional requirement is that I will be reading the switch using an Arduino with limited I/O pins available.

I was surprised at how expensive SP5T rotary switches can be. The PCB mount ones are pretty cheap, but too small and unsuitable for my needs. Panel mount switches were $25+ on Digi-Key and I will need two. If I were a patient fellow I probably could have sourced some overseas much cheaper. I could have used an inexpensive potentiometer in conjunction with an analog input to do the job, but I really wanted a solution with proper "detents". So at the end of day I decided to try a DIY approach, and after a couple of days work I came up with the design pictured above.

It's not a compact as a "store bought" switch at 50 mm in diameter, but it's certainly useable in many situations including mine. Like a potentiometer, you can read the five different "stops" with a single analog pin and, as can be seen above, is panel mount.

So let's build one.


In addition to the printed parts you will need:

  • 6 2K ohm resistors.
  • Some small disk magnets 3 mm in diameter and 2 mm deep.
  • A short 7 mm length of 2 mm diameter (12 AWG) uninsulated copper wire.
  • Some hookup wire. Mine had soft silicon insulation.

Step 1: Print the Parts

Everything you need to make this Rotary Switch is pictured above. For the printed parts I used the following settings (unless otherwise specified):

Print Resolution: .2 mm

Infill: 20%

Filament: AMZ3D PLA

Notes: No supports. Print the parts in their default orientation. To make a Rotary Switch you will need to print the following parts:

  • 1 - Rotary Switch Base
  • 1 - Rotary Switch Rotor
  • 1 - Rotary Switch Piston
  • 1 - Rotary Switch Gasket
  • 1 - Rotary Switch Base
  • 1 - Rotary Switch Wiring Harness (optional)

Step 2: Prepare the Base

  1. Insert 6 of the magnets into the Base piece. Use a small dab of glue to hold them in place. Make sure that the polarity is the same for all 6 magnets.
  2. Solder the resistors in series as in the above photo. Each should be 15 mm apart. I made a small jig to hold them in place for soldering.
  3. Insert the resistors into the Base channel, behind the "posts" holding the magnets. The resistors go directly behind the posts while the soldered leads go into the "gaps".
  4. When you are satisfied that all the resistors are positioned correctly, push them down to the bottom of the channel, then secure them in place with the "Gasket" piece.

Step 3: Prepare the Rotor

  1. Insert a magnet into each of the six holes on side of the rotor. NOTE: The magnets should be oriented so they attract the magnets that have been set into the inside of the Base. Use a little glue to hold all of the magnets in place.
  2. Insert a stack of four magnets into the hole at the back of the Rotor "trough" pictured above.
  3. Glue the Rotor Top onto the Rotor so that the trough becomes a small square tunnel. I've aligned the flat edge of the shaft with the left edge of the trough.

Step 4: Prepare the Piston

  1. Insert a stack of three magnets into the hole at the "back" of the piston. NOTE: These magnets should be oriented so they repel the magnets that have been set into the inside of the Rotor at the back of the trough. Use a little glue to secure them.
  2. Solder the 7 mm length of 2 mm diameter copper wire to the end of a short length of hookup wire.
  3. Push the hookup wire through the hole in the front of the Piston and glue the 7 mm copper wire to the groves in the front of the Piston as in the photo above. Be careful not to get any glue on the front of the copper wire.

Step 5: Assemble the Rotary Switch

  1. Slide the Piston into the Rotor with the wire pushed through the slot in the bottom as above. The magnets should be pushing the Piston towards the front of the Rotor.
  2. Slot the wire through the hole in the bottom of the Base, push the Piston towards the back of the Rotor trough, and slide the assembly into the Base.
  3. This is a good time to test the switch out. The Rotor should turn freely and the Piston should slide into the Base recesses as you turn. You should feel when the Piston snaps into one of the slots, and feel some resistance when you try to twist away from a slot. That is the detent action that I spoke of.
  4. When you are satisfied that everything is working OK, glue the Base Top onto the Base being careful to to gum up the Rotor.

Step 6: Test the Rotary Switch

I connected the rotary switch to an Arduino Nano and wrote a small test sketch to determine the values returned from an analogRead() at each of the five rotary switch positions, and came up with the following values: 233, 196, 159, 115, and 68. In the following sketch I use these values and set a range of -10 to +10 around them to account for jitter in the readings.

#include "FastLED.h"

#define NUM_LEDS 35
#define LEDS_PIN 6

int A[35] = {0,0,1,1,1,1,1,

int B[35] = {1,1,1,1,1,1,1,

int C[35] = {0,1,1,1,1,1,0,

int T[35] = {1,0,0,0,0,0,0,

int F[35] = {1,1,1,1,1,1,1,

int a = 0;
void setup()  {
  Serial.println("Test Resistor Network");
  pinMode(A5, INPUT_PULLUP);

  FastLED.addLeds<NEOPIXEL, LEDS_PIN>(leds, NUM_LEDS);
  Serial.println("5x7 LED Array");

int countA = 0;
int countB = 0;
int countC = 0;
int countT = 0;
int countF = 0;

void loop() {
  a = analogRead(5);

  if (a <= 78 && a >= 58) countF++;
  if (a <= 125 && a >= 105) countT++;
  if (a <= 169 && a >= 149) countC++;
  if (a <= 206 && a >= 186) countB++;
  if (a <= 243 && a >= 223) countA++;

  if (countF > 10) {showLetter(F); countA = 0; countB = 0; countC = 0; countT = 0; countF = 0;}
  if (countT > 10) {showLetter(T); countA = 0; countB = 0; countC = 0; countT = 0; countF = 0;}
  if (countC > 10) {showLetter(C); countA = 0; countB = 0; countC = 0; countT = 0; countF = 0;}
  if (countB > 10) {showLetter(B); countA = 0; countB = 0; countC = 0; countT = 0; countF = 0;}
  if (countA > 10) {showLetter(A); countA = 0; countB = 0; countC = 0; countT = 0; countF = 0;}

void showLetter(int letter[]) {
  for (int i = 0; i < NUM_LEDS; i++) {
    if (letter[i] == 1) {
      leds[i] = CRGB::White; 
    } else {
      leds[i] = CRGB::Black; 

The results of this test can been seen above. I printed a small panel to mount the switch on. This is the indended use for the Rotary Switch, to accept a user's answer to a multiple choice question (A, B, C), or a True/False question (T, F). Then I connected a 5x7 NeoPixel Display which is also part of my Think-a-Tron 2020 project. Here are all the connections to the Arduino:

  • Display Red wire to +5V
  • Display Green wire to D6
  • Display White wire to GND
  • Switch Piston wire to A5
  • Switch Resistors wire to GND

Here is a video of the Rotary Switch and 5x7 Display in action.

Step 7: Final Thoughts

I'm pretty happy with my DIY Rotary Switch. It works well and has a nice "feel" as you switch between the stops.

Not everyone will want to take the time to make their own rotary switch, and will most certainly have different requirements than I had. However, for someone like me that does a lot of reproduction work, it's nice to know that with a little effort you can obtain exactly what you need to get the job done, without compromise.

Be the First to Share


    • Make It Bridge

      Make It Bridge
    • Big and Small Contest

      Big and Small Contest
    • Game Design: Student Design Challenge

      Game Design: Student Design Challenge



    2 years ago

    That's fantastic! I am conceiving a fligh simulator cockpit and your project is a great source of inspiration.


    Reply 2 years ago

    Thank you. Good luck with your project.