Maker.io main logo

Floor Lamp with NeoPixels and WLED Custom Animations

2024-09-17 | By Adafruit Industries

License: See Original Project Hand Tools LED Strips Solder / Desoldering Touch Wifi Wireless

Courtesy of Adafruit

Guide by Erin St Blaine

Overview

 

The lighting in your home can really change the energy and the ‎mood. This modern floor lamp uses addressable NeoPixel LEDs, a QT ‎Py Pico ESP32 with WiFi, and the free, open-source WLED software: ‎a wonderful and easy way to create animations, schedule programs, ‎and take control of the lighting in your house.‎

This lamp also uses the capacitive touch sensor pads on the QT Py. A ‎copper foil decoration on the base allows me to turn the lamp on ‎and off and change modes just by tapping it with my toe.‎

This guide uses version 14.4 of WLED.‎

wled_1

Materials

Adafruit sells two different controllers that will run WLED: ‎the Feather Huzzah and the QT Py Pico. The QT Py is a little smaller ‎and a little less expensive, so that's the one I chose for this project.‎

NeoPixel lights come in many different shapes, sizes, and densities. ‎For this lamp I chose 60/m NeoPixel, but WLED will work with any of ‎the types that Adafruit sells. The higher density 144/m pixels would ‎also look great with this project. There are also side-light, dual sided, ‎seed pixels and more -- take a look around the shop to find the lights ‎you like best.‎

I'm using copper foil tape for the capacitive touch switch. This can be ‎cut into shape by hand or with a Cricut vinyl cutter and will function ‎as a decorative toe switch for turning the lamp on and off and ‎changing modes.‎

For lamps with less than around 100 pixels, a power supply can be ‎used that plugs directly into the QT Py with a USB C port. I like this ‎one because it already has an inline on/off switch. ‎

You'll also need some silicone wire in 3 different colors, and it's ‎helpful to have some clear heat shrink to seal the ends of the LED ‎strip.‎

Additional Materials

I used a hot wheels track from Amazon to make the spiral support ‎for my LEDs. ‎

hotwheels_2

You'll also need a piece of wood or other heavy thing for the base of ‎the lamp, and a pole for the arm. I used a hollow steel tube I found in ‎my garage, but a wooden dowel or PVC pipe would work just as well.‎

Tools

  • Soldering iron & accessories
  • Hot glue gun
  • Screws & screwdriver
  • Drill with small drill bits and large spade bit
  • Silicone caulk & caulking gun

Wiring Diagram

diagram_3

  • QT Py A0 --> NeoPixel IN
  • QT Py 5v --> NeoPixel 5v
  • QT Py G --> NeoPixel G
  • QT Py A2 --> wire for capacitive touch‎

The pixels are powered directly through the board since there are ‎only a few pixels. This arrangement works for small projects of up to ‎‎100 pixels. For larger projects with more LEDs, you'll want to power ‎the pixels directly from a 5V power supply. If you are powering more ‎than 100 LEDs or so, see the guides below:‎

WLED Software

Driver Update

Some versions of the QT Py have a new serial chip which needs a ‎driver installed before we can install WLED. Head over to our How to ‎Install Drivers for WCH USB to Serial Chips tutorial, and download ‎and install the new driver.

‎If you have an older QT Py with CP2102 USB-to-Serial bridge, use ‎SiLabs’ driver instead.‎

Install WLED

These next steps require a Web Serial-compatible browser. As of ‎this writing, that ‎means Google Chrome, Microsoft Edge or Opera “desktop” ‎browsers. Other browsers (Safari, Firefox, Explorer ‎and anything mobile) won’t work.‎

Visit https://install.wled.me/‎

Plug your microcontroller into your computer with a known good ‎USB cable. Click "Install" and select the port for your board.‎

Depending on the USB-to-serial bridge chip on the board, you might ‎see one or two serial ports. On Mac, for instance, there might be both ‎‎“/dev/cu.usbmodem[number]” and “/dev/cu.wchusbserial[number]”. ‎

Use the “wchusbserial” one.‎

install_4

After successful installation, enter your WiFi network name and ‎password when prompted. This must be a 2.4 GHz WiFi network; ‎ESP32 does not support 5 GHz networks. If it can’t connect, then as a ‎fallback WLED will create its own 2.4 GHz WiFi access point.‎

Setup & Preferences

WiFi Setup

Head to the WiFi Setup screen under Config and create a good URL ‎so you can control your project from any web-enabled device. Call it ‎something you'll remember, that's easy to type into any web ‎browser on your WiFi network in order to connect to your project.‎

setup_5

setup_6

LED Preferences

Next, head to the LED Preferences tab under the Config menu.‎

Scroll down to Hardware Setup. Put your total number of LEDs into ‎the "Length" field and change GPIO to the pin number associated ‎with the pin you soldered to. Check the QT Py Pico Pinout (or ‎the Feather Huzzah Pinout if you're using that board) to find this ‎number (it's the one in yellow).‎

preferences_7

Use It

useit_8

Now you can use any computer or handheld device to control your ‎LEDs. ‎

Make sure your device is on the same WiFi network as your board. ‎Navigate to your custom URL (sparkle.local/ for me) in a web ‎browser. You'll see a color picker above a whole bunch of color ‎palette choices.‎

Choose a color, choose an effect, and watch your lights animate and ‎glow!‎

Save your favorite combinations as presets, create playlists, control ‎the speed and intensity of the animations, and lots more. This web ‎app is incredibly intuitive and easy to use.‎

Head over to the WLED wiki at https://kno.wled.ge/ to delve into all ‎the particulars.‎

Electronics Assembly

Solder four wires to the QT Py:‎

  • Red to +5v
  • Black to G
  • White to A0
  •  Yellow to A2‎

The red, black, and white wires will connect to the NeoPixels:‎

  • Red to +5v
  • Black to G
  • White to DI (data IN)

electronics_9

One end of the NeoPixel Strip is Data Out, the other Data In. Be sure ‎to connect to Data In which might be labeled DI or have a triangle ‎pointing into the strip. The Data Out Pin (DO or triangle pointed out ‎the end) will not work.‎

Strip a little shielding off the end of the yellow wire but don't connect ‎it to anything yet. This will become our capacitive touch switch.‎

Once you've got the software installed, plug in the QT Py to power ‎via the onboard USB-C port. Your lights should come on in a soft ‎yellow color.‎

Troubleshooting

If the lights don't come on, here are a couple things to try:‎

  1. Be sure you soldered to the correct end of the LED strip. These ‎strips are directional and won't work if you connect the data ‎wire to the wrong end. More about how to solder NeoPixels ‎here
  2. Open the WLED software and go to the LED Settings page. ‎Make sure you have the correct pin (GPIO) entered here. Find ‎this out in the pinout diagram in the QT PY guide).‎
  3. If it's still not working, head over to the NeoPixel Uberguide and ‎try uploading some basic code, just to see whether the problem ‎is with your wiring or with the software. If you can get the lights ‎to come on using Arduino or CircuitPython, the trouble is with ‎the software -- try reinstalling.‎

Once your lights are working, seal the end up with a piece of clear ‎heat shrink. I like to squirt a little hot glue in before I shrink it down, ‎so the solder joints are fully encased in plastic and won't pull out.‎

Create Presets

Animation Presets

Once your lights are working, it's time for the fun part: creating light ‎animations using WLED presets. This is easy and intuitive in WLED. ‎Choose a color palette and an effect, then play with the sliders at the ‎bottom of the Effect Mode column to customize the effect.‎

When you find something, you like, click the +Preset button in the ‎Presets tab and give your preset a name, then save it. You can ‎reorder them using the "Save to ID" field. ‎

You can create hundreds of presets using the preprogrammed ‎effects, so take some time to play around and see what looks good ‎on your LED strip.‎

presets_10

Create at least 3 presets and be sure they are saved to ID numbers 1-‎‎3. Our next step will be to set up the capacitive touch switch to ‎toggle between these presets. ‎

Control Presets

The WLED preset interface can also be used to send control ‎commands to the LED strip. The capacitive touch switch can be used ‎for a wide variety of functions: change modes, change brightness, ‎toggle the lights on and off, or a whole host of other features. ‎

Each button in WLED has 3 options: a short press, a long press, or a ‎double press. I want my lamp to cycle through presets with a short ‎touch, and to turn on or off with a long touch. Here's how I set up a ‎control preset for each of these features.‎

Cycle through Presets

Click +Preset and then uncheck the "Use current state" checkbox. ‎This will open up an API command window within the preset ‎module.‎

Call the effect "Next_FX" and type {"ps":"1~3~"} into the API command ‎box. This tells WLED to cycle through presets 1-3. If you'd like to cycle ‎through more presets, change the 3 to the number of presets you ‎have. ‎

Be sure your preset IDs include all the numbers -- skipping a ‎number will break this command.‎

Give your preset an ID number that's above the range of your preset ‎numbers -- I called mine 9. ‎

presets_11

Toggle On/Off

Create another preset and call it "Toggle". Uncheck the "use current ‎state" checkbox and enter T=2 into the API command box. This will ‎tell the LEDs to toggle between on and off. Save this one to ID 10.‎

toggle_12

On the next page we'll connect these control presets to our ‎capacitive touch button.‎

Find out more about creating these control presets here: ‎

https://kno.wled.ge/features/presets/‎

You can enter either JSON commands or HTTP commands into this ‎command box, giving you a lot of control over your WLED project. ‎

https://kno.wled.ge/interfaces/json-api/‎

Capacitive Touch Button

I soldered my capacitive touch wire to pin A2, which is also known ‎as GPIO 27 (see the QT Py Pico pinout diagram, it's the number in ‎yellow).‎

In the LED Settings screen, scroll to the button setup section and set ‎button 0 to use pin 27, with the type set as "touch".‎

button_13

Next, head to the Time & Macros config screen. Scroll down to the ‎Button actions area. ‎

For button 0, enter the number assigned to the two control presets ‎you made on the last page. My Next_FX preset is number 9, so I ‎entered 9 under "short press", and my Toggle preset is number 10, so ‎I've got that set up as a "long press". ‎

button_14

button_15

Test your setup by stripping a bit of shielding off the end of your ‎capacitive touch wire and touching the bare wire. You should see ‎your LED strip scrolling through presets with a short touch, and the ‎strip turning on and off with a longer touch.‎

If your strip is not reacting the way you expect, here are a few things ‎to try:‎

  1. Try touching the copper pad on the board instead of the wire. If ‎it works when you do that, change the Touch Threshold ‎number on the LED settings page until the sensitivity is right. ‎With a 5" wire I found that a threshold of 52 seems to work well.‎‎
  2. Double check both the LED preferences page and the Time & ‎Macros page to be sure your settings are correct and have ‎saved.‎‎
  3. 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).‎‎
  4. Try soldering to a different GPIO pin, and make sure to update ‎the pin number in LED Preferences. I originally soldered to A1, ‎but there was a short or some interference from A0 so giving a ‎little space between the soldered wires on the board seemed to ‎help.‎

Build the Lamp

I used a scrap piece of wood that is around 10" square and 7/8" thick ‎for my lamp. I used a spade bit to drill a hole in the center. My lamp ‎arm is made of steel and has a screw mount inside one end, so all I ‎need is a way to secure it to the base and I can screw it together ‎from underneath.‎

I added some EVA foam rubber feet to the bottom of the base, so ‎there's room for the cord underneath. ‎

I ended up drilling a second hole (not shown) next to the center hole ‎for the USB cord to come through. I did it after the lamp was built, ‎but this would have been a better moment.‎

build_16

build_17

I drilled three holes in my steel lamp arm: one at the top, middle, and ‎bottom to attach the track to the arm with screws.‎

drilled_18

Sand the track lightly to help with paint adhesion. Paint really ‎doesn't want to stick to this stuff! I had the most success when I ‎started with a plastic primer spray paint and then did a few topcoats ‎of metallic black.‎

sand_19

I screwed my lamp arm to the base and did a test-fit with the track ‎to be sure my screw holes were in the right places. This took a little ‎trial and error but I'm happy with the result.‎

I took the track back off again to mount the LEDs and diffusion gems.‎

screwed_20

For diffusion, I'm using these plastic crystals from Amazon. They are ‎fairly lightweight and have an interesting texture. I'd considered ‎using glass pebbles but they'd likely be too heavy and pull the track ‎out of shape. These crystals are perfect. I ordered the 16x22mm size. ‎One bag was the perfect amount for my 5' track.‎

crystals_21

I used clear silicone caulk to fix the LED strip and gems to the track. ‎It will stick to the silicone casing around the LED strip, and also give ‎me a firm setting for the gems. It dries clear, so won't block the light.‎

This brand takes 5-7 days to fully dry, but I had a decent hold after 24 ‎hours and was able to assemble the lamp by moving carefully.‎

caulk_22

I pressed the LED strip into the caulk, then added more on the top ‎and pressed the gems firmly on top, making sure they were all stuck ‎down. Be generous -- really goop it on there.‎

These gems make a truly wonderful diffusion material. I can't spot ‎individual lights at all.‎

gems_23

Once the caulk was dry (enough), I screwed the track back onto the ‎rod at the top, bottom, and middle. I had to do a little adjusting ‎because a fully loaded track weighs quite a bit more than the empty ‎track weighed, but it worked out well in the end.‎

dry_24

I put a large piece of black heat shrink over the QT Py to keep it from ‎shorting, and also to hide it from view. I hot glued it to the back of ‎the track near the lamp base, with the capacitive touch wire and ‎USB port facing down. ‎

black_25

For the capacitive touch sensor, I decided to use copper tape. I cut ‎some pretty shapes out of a copper tape sheet using my Cricut vinyl ‎cutter. I chose the Adhesive Foil setting and cut one large starflower ‎to use as the main button, and a few more smaller ones just for ‎decoration.‎

sensor_26

sensor_27

I stuck the big star to the lamp base with the capacitive touch wire ‎underneath, pressing down firmly and smoothing with a straight ‎edge to get a good electrical connection.

I tested touching it with my toe and it works to control the lamp, ‎even though my socks!

star_28

star_29

Capacitive Touch Trigger Warning

My original idea had been to hook the capacitive touch wire up to ‎the metal pole so I could touch the lamp anywhere on the stem and ‎control it. However, the amount of metal in the pole was just too ‎much for my microcontroller. The current fried the QT Py (not once, ‎but twice!). This may be fixable with a resistor, but the copper foil ‎method works just as well and after being burned twice, I didn't ‎want to keep experimenting.‎

pole_30

制造商零件编号 2821
ESP8266 FEATHER HUZZAH LOOSE HDR
Adafruit Industries LLC
¥121.69
Details
制造商零件编号 5395
ADAFRUIT QT PY ESP32 PICO - WIFI
Adafruit Industries LLC
¥121.69
Details
制造商零件编号 1138
ADDRESS LED STRIP SERIAL RGB 4M
Adafruit Industries LLC
¥840.82
Details
制造商零件编号 4607
RF EMI SHIELDING SHEET 12" X 12"
Adafruit Industries LLC
¥41.70
Details
制造商零件编号 5801
VERTICAL WALL POWER SUPPLY WITH
Adafruit Industries LLC
¥48.43
Details
制造商零件编号 2003
HOOK-UP 30AWG 600V BLACK 6.56'
Adafruit Industries LLC
¥6.29
Details
制造商零件编号 1020
HEATSHRINK 3/8" X 1' CLEAR
Adafruit Industries LLC
¥33.98
Details
Add all DigiKey Parts to Cart
TechForum

Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.

Visit TechForum