Here we'll build a simple-yet-powerful volume knob using a rotary encoder and Circuit Playground Bluefruit.
Build on Breadboard
Following the schematic above, plug the rotary encoder into the breadboard, and then connect the alligator clip wires between the encoder pins and the CPB.
The encoder is essentially two components in one -- the three lower pins are for measuring the knob rotational position, while the two upper pins are for the push switch when the knob is pressed down.
This is the wiring connection list:
- Encoder A pin to CPB A3
- Encoder GND to CPB GND
- Encoder B pin to CPB A2
- Switch ground to CPB GND
- Switch button to CPB A1
Pair (and Bond)
Now you can power up the device with a battery (or USB power) and it will begin to advertise and turn the NeoPixel ring yellow.
On your mobile device or computer with BLE, pick the device (the first time you connect it may have a nondescript name, or the name Bluefruit Volume Control as seen here on an iPad), and agree to the Pairing prompt.
The devices will be paired, and automatically bonded so they can auto reconnect later.
Once connected, the NeoPixel ring will turn cyan. Rotate the knob to raise and lower the volume. Neat huh?! You'll see the bright pixel rotating around along with the knob.
Now, press the push encoder knob down to mute, and the NeoPixels turn red. You can unmute by pressing the button again, or by turning the volume knob.
You can also use the button A on the CPB to toggle Play/Pause.
First, remove the side mounting legs from the encoder using some diagonal cutters. We don't have mounting holes for them, and they aren't part of the circuit, they are just for mechanical stability.
Insert the encoder in the board as shown.
Be sure to remove the twelve amber Kapton stickers from the standoffs, otherwise there won't be an electrical connection to the CPB when we screw them together.
Using short lengths of hookup wire, solder the connections as shown in the schematic drawing below.
You can run all of the wiring on the underside of the Gizmo if you like,for a neater appearance.
Trim all of the excess pin and wire lengths with diagonal side cutters.
Place the battery between the two boards, and then screw them together with the provided M3 mounting screws.
Plug in the power, pair the CPB with your mobile device or computer with BLE, and you can use your volume knob in style!