Adding a control button is easy with the Sparkle Motion board. Any momentary switch will work. I'm using this chonky 12mm Tactile Switch Button and a STEMMA JST PH 2mm 3-Pin connector with female sockets.
Plug the JST connector into the smaller of the two stemma ports. Straighten out the legs on one side of your button and slip the legs into the female connectors: one leg goes to white (data GPIO 27), the other to black (G).
It's fine to extend these wires so they're longer. For a more solid connection you can cut the connectors off and solder directly to the button legs.
Open up the LED settings screen in WLED under "Config". Scroll to the button setup section and set button 1 to use pin 27, with the type set as "Pushbutton".
Click save. Try pressing your button and see if your effects change. The default behavior for button 1 is to cycle through effects, but we can change this and set up the button for any number of behaviors using the Presets panel.
I advise against using button 0. WLED's buttons have some default behaviors written in, and one of button 0's default behaviors is that when it's pressed for more than a few seconds, it resets your microcontroller to factory settings. I originally had button 0 selected, and I held the button down a bit too long while I was sewing it onto the hat, and .. POOF. All my settings and presets were wiped out.
Check out the "Backup" section under the Additonal Settings page to learn to back up your configuration and presets, in case this kind of thing happens to you.
Next, head to the Time & Macros config screen. Scroll down to the Button actions area.
For button 1, enter the number assigned to the two control presets you made on the last page. My Next_FX preset is number 22, so I entered 22 under "short press", and my Toggle preset is number 21, so I've got that set up as a "long press".
I also added my playlist toggle to preset 20, so a double-click of my button will turn sound reactive mode on or off.
Troubleshooting
If your button isn't working, here are some things to try:
- Double check both the LED preferences page and the Time & Macros page to be sure your settings are correct, and have saved.
- Be sure your presets are correctly numbered. WLED gets confused if the presets have non-sequential IDs (so make sure they're numbered 1, 2, 3 rather than 2, 5, 7).
- Be sure you're connected to the correct legs on your button. You want the legs on the same side (facing the same way), rather than connecting to the two top legs or the two bottom legs. Those pins are connected together inside the button so won't work when the switch is activated.
Page last edited January 14, 2025
Text editor powered by tinymce.