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.
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
Type | Quantity |
---|---|
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 |
Circuit
Solder the JST XH connectors to the rotary switch as follows:
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.
Enclosure
Print out the enclosure parts on a 3D printer.
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.
.
Mount the top piece with 4 x M2 screws.
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.
Add two drops of superglue on each brickbase and mount the module. Press and hold for 60s.
The finished module: