The humble dial has been with us for decades. Early radios would use a form of a potentiometer to fine tune a frequency. Audio video editing equipment makes use of rotary encoders to navigate menus and timelines. These components are used for precision control Raspberry Pi projects, typically manual control of motor speeds.
Pimoroni’s latest breakouts for their Breakout Garden HAT are two dials. The first is an RGB Encoder, a rotary encoder which uses “bumps” to indicate rotation and direction. The other is a potentiometer, an analog component which is really a variable resistor that outputs voltages based on how far the dial has been turned. Both of these, typically rather “boring” components have been tweaked to include a Nuvoton MS51 microcontroller offering I2C output and an RGB LED for that “subtle” lighting which every project deserves.
Design and Use of the Pimoroni RGB Breakouts
Designed for use with Pimoroni’s Breakout Garden range of boards, the RGB Encoder and Potentiometer breakouts at a glance look identical to each other. They both feature the same I2C pinout, designed to be used with the Breakout Garden’s slots but they can also be used with conventional header pins and inserted directly into the GPIO.
No matter how they are used, they both connect to the I2C pins of the Raspberry Pi and identify as I2C devices. The RGB Encoder Breakout is a dial which can rotate in clockwise and counterclockwise directions and each time we rotate we feel a “bump” and this is used to determine the direction we are rotating the dial. These bumps can be counted and used in code to trigger an event.
The RGB Potentiometer Breakout is an analog electronic component. We can smoothly turn the dial clockwise or counterclockwise but the dial will only turn so far. The potentiometer outputs a voltage level based upon the position of the dial. The voltage range is between 0 and either 3 or 5V, depending on the voltage source. The voltage is then output via a builtin microcontroller (Nuvoton MS51) which acts as an analog-to-digital converter, providing the data to the Raspberry Pi via I2C.
Present on both breakouts is an RGB LED, not a smart LED such as a Neopixel or APA102, rather a “dumb” LED which we can control by altering the mix of each color using pulse width modulation (PWM).
How can we use these breakouts? Luckily, they both use the same Python library as Pimoroni’s IO Expander board, which meant we could quickly setup and test each of the breakouts using example Python scripts. The RGB Encoder Breakout used each “bump” to increment the color of the embedded RGB LED through the colors of the rainbow. The RGB potentiometer was a smoother experience, but with the same output.
Use Cases for the Pimoroni RGB Breakouts
What use is an RGB encoder or potentiometer? An encoder can be used to navigate a menu, for precise control when navigating through a video timeline or it can be used as a game controller. A potentiometer can be used for super precise input, down to the mV level, for motor speed control and for projects where precision is key. The RGB LED in each breakout can be used for visual feedback, for projects without a screen.
These breakouts are tactile, physical interfaces designed for humans to interact with. We feel the input and have a measure of control which “feels” different than using a slider in a GUI application.
The RGB Encoder and Potentiometer breakouts are a little niche. We don’t “need” RGB in these inputs, but they look great and with a little code we can use this feature to provide useful information to the user. Even though they are designed for the Breakout Garden HAT, they can be used directly with the GPIO, and with other microcontrollers that have an I2C interface.