rbx rotary switch assembled

The Rotary Switch Brick is made from the KY-040 Rotary Switch Encoder. It provides a dial that turns clockwise or anti-clockwise, and the dial can be clicked to indicate selection. 

ky 040

The Rotary Switch Brick connects to the Microcontroller Brick via a 2-pin port (for reading the state of the switch) and a 4-pin port (for reading the direction/movement of the dial).

Parts list

KY-040 Rotary Switch Encoder 1
2-pin JST XH connector (male) 1
4-pin JST XH connector (male) 1
M2 self-tapping screw 4


Solder the JST XH connectors to the rotary switch as follows:

rbx rotary switch schematic

So basically for the 4-pin JST XH connector, yellow wire connected to DT, white wire connects to CLK, red and black wires connects to VCC and GND respectively.

For the 2-pin JST XH connector, red wire jconnects to SW, black wire connects to GND.

rbx rotary switch circuit 01 rbx rotary switch assembly 02


Print out the enclosure parts on a 3D printer.

rbx rotary switch 3dview

Sit the display module on the bottom piece, and arrange the wires in the grooves. Optionally secure the wires with a small amount of hot glue.

.rbx rotary switch assembly 01

Mount the top piece with 4 x M2 screws.

rbx rotary switch assembly 02

Line up one 2x1 brickbase and two 3x1 brickbases on a faceplate as shown. Surround the brickbases with a few other bricks to assist in alignment.

rbx rotary switch assembly 03

Add two drops of superglue on each brickbase and mount the module. Press and hold for 60s.

rbx rotary switch assembly 04

The finished module:

rbx rotary switch assembled