Electronics

Quick Saturday hack – the RGB LED push-button

The context

It’s been a long time since my last post and since it’s always difficult to get back at it I will start the year with an easy tutorial.

I’m working on a design in which we have incorporated a big illuminated green push-button, the kind that you see on arcade machines. It is the main UI element of our project. Unfortunately my local hardware store‘s choice in green illuminated push-buttons was limited to really big or really small ones (that it compared to what we had in mind).

They did however have the perfect model, but equipped with a white light. No problem, I thought to myself. I can just take out the LED and replace it with one of my choosing. Going through my LED bin I came across a NeoPixel PCB and realized that it was the exact same diameter as the LED holder of my push-button. An RGB-enabled button was not the original idea but after all, the effort would be the same and the option would be there to be used on the prototype if we needed to test different UI ideas.

The hack

Components list

1. Remove the original LED

Start by removing the LED holder from the button top part. Then remove the LED holder from its holder. You can quickly understand the principle at work here: the legs of the LED are coiled around the LED holder’s base. By sliding into the socket, the legs come in contact with connectors linked to two pads respectively on each side of the button’s base.

2. Prepare the wires

We need 3 wires: GND, VIN and DATA.

The wires for GND and VIN should have a length approximately equal to the length of legs of the LED you just took out of the holder + a little margin to solder them. Strip these wires completely as to end up with the bare metal wire.

The wire for the DATA pin should be long enough so that it will be able to reach your microcontroller so if you don’t have any specifications yet and are just playing around with a cool button just make it quite long (better cut it later than ending up with a wire too short for your needs).

3. Make a hole for the control wire

The two holes at the bottom of the holder are just big enough to let a stripped wire come through so that’s a no go for our DATA wire.

Simply make a hole approximately in the middle of the holder using a rotary tool (or anything that will get the job done. I didn’t have my tool near by so I ended up using the tip of my old soldering iron…). Try to place it so that the wire won’t mess up with the button’s mechanism once in place.

4. Solder the wires to the PCB

Nothing complicated here. Solder the two bare wires on each side of the PCB (make sure to solder it to the input side of the board), the DATA wire goes at the center.

5. Assemble and test

Pass the DATA wire through the whole on the side of the LED holder, then insert the bare wires. It doesn’t mater which way they go as long as you remember which one is positive and which one is negative. If you plug it wrong you will short and fry your component (like I did).

Pull on the + and – wires to set the LED in place and coil them around the pads of the LED holder. This will be enough to keep the LED in place but if you don’t feel comfortable with this method you can add a bit of hold glue under the PCB before putting it in place.

You can now test the set-up by putting the LED holder back into the socket, attaching alligator clips to the power pads and connecting the DATA pin to your microcontroller. I used the example sketch from Adafruit, only setting the number of neopixels to 1.

If everything works put the socket assemble it back with the button, being careful that the DATA wire doesn’t block the button mechanism in any way.

6. Final result

Enjoy your colorful button and don’t forget to tell me in the comments if you make anything cool with it!

PS: I swear that I’m not affiliated with Adafruit (I wish I was though ;)) it just happens that my shop pretty much only sells theirs and Sparkfun’s stuff.

Leave a Reply