Hacking Project: RGB Shades with Potentiometer

By: Cameron Bachman

When you first receive your RGB Shades in the mail, you can’t help but notice that the entire circuit board is exposed on the right arm. With plenty of extra pins for i/o devices, our RGB LED Glasses are ready to add all sorts of sensors and components.  

In order to learn a little more hacking and show off the potential for hacking projects, I set off to find a component to work with. 

Potentiometer close-up

We found a potentiometer available on Amazon that seemed to fit the pins on

the shades and would send a simple voltage reading to the microcontroller, which we would hopefully get the Shades code to read and use to control some aspect of the shades’ behavior. 

As for the function of the new “control wheel,” there were a couple options to consider, including using the wheel on the potentiometer to cycle through animations, crank up the speed of the animations or control brightness. We landed on the brightness control as a handy proof-of-concept. The wheel theoretically would be much easier to control while “in the field” at a party to control the brightness than the existing button and give a more fine control of the brightness between minimum and maximum, rather than the stepped control that the button cycles through. (This would also free that button up to be used for any other function.) 

When the potentiometers arrived from Amazon, I had my first problem. The pins were not actually spaced to match the pins on the Shades. The distance between pins was quite a bit smaller which means it wouldn’t easily fit into the shades’ pin holes and be a quick solder job. The pins on the potentiometer were very thin and soft, so I attempted to bend them out to match up. It took quite a bit of doing, but they did get there. The way the dial fit over the controller and components on the arm was pretty ideal, so that a bit of the wheel is positioned higher than the top of the arm and easy to adjust. 

I soldered the leftmost pin into ground, middle pin into A4 and rightmost pin into A3. While A3 is labeled as an analog pin, it can also be used as a digital output pin. By setting A3 to OUTPUT and HIGH, the potentiometer is now a voltage divider. The middle pin will output a divided voltage somewhere between 5V and 0V, proportional to the position of the dial. The Arduino can read that voltage level on pin A4 and map it to the variable we choose (in this case, brightness).

I used the AnalogRead Serial tool in the Arduino IDE to test the potentiometer and check whether there was a signal coming from the component and whether it scaled up and down when the wheel was turned (Arduino has a handy and simple-to-follow tutorial on their site). Note that I needed to add 2 lines of code to the setup function in order to send voltage to the outer pin opposite ground. 

After a successful test, Garrett helped me with an updated version of the RGB Shades code with a few lines of code to get the newly installed scroll wheel to control the brightness on the shades. You can check the custom code for this project on our GitHub.

In the setup function shown below, we tell A3 (the outer pin opposite of ground) to output high voltage so that the potentiometer’s position can be read on the middle pin (A4 in our case). Then we create a function to check the analog reading on the A4 pin and set brightness based on the reading.

Custom Arduino Code for Potentiometer

Later in the loop function, we check if the voltage has changed significantly since the last loop and update the brightness if it has. 

Custom code to check potentiometer and update LED brightness

Even though the pins weren’t perfect for the shades pin configuration, once installed, the potentiometer was the perfect size for the job. As you can see in the video, the wheel is an easy and convenient control for the brightness. It feels great to take a part that costs less than $5 to upgrade the shades. 

RGB Shades with potentiometer brightness control

As an open source hardware project, the RGB Shades were always meant to be hacked, modified and improved. If you’ve got a project or idea that you’ve been working on with the shades, let us know!

 


Older Post


Leave a comment

Please note, comments must be approved before they are published