I've had my LIFX bulb for a while now, and I absolutely love the fact that I can now change my light to different colors, and even different shades of white. However, I find that it's really cumbersome to flip through my phone just to turn on the light or change the brightness.
Which is why I built this project, a simple and quick way to control your LIFX bulb. The control is really intuitive: place your hand over the device, the further you move your hands up, the brighter the light, vice versa.
Step 1: Tool and Supplies
- Wire cutter / diagonal cutter
- Needle nose pliers
- Wire stripper
- Soldering iron
- 3D printer
- HC-SR04 Ultrasonic distance sensor
- Particle Photon
- Female Headers (Optional)
Step 2: Prepare the Supplies
Use your pliers to bend the headers of the ultrasonic sensor, this way the sensor will be facing up when you solder it onto the perfboard.
This is optional, but if you would like to reuse your Particle Photon, trim 2 female headers to match the male headers of Photon.
Trim your perfboard to a 50 x 50 mm square. I find it easier and cleaner to do this with a diagonal cutter instead of a saw.
Step 3: Wiring and Soldering
Mark the hole for the ultrasonic sensor headers before temporarily removing it from the board. Wire up according to the schematic and reinsert the sensor when finished. Flip the board and solder all the connections.
Step 4: Enclosure and Assembly
Download the STL files linked below, I printed mine with the following settings:
- Material - Silver PLA
- Infill - 10%
- Support - None
- Speed - 50mm/s
Afterward, line up the ultrasonic sensor with the cutout, and snap fit the case together. The electronics should fit pretty snug inside.
Step 5: The Code
To communicate with the LIFX bulb, the code utilizes the LIFX LAN Protocol. The only thing you need to change is the target, or the MAC address of your LIFX bulb, which should be listed at the base of your bulb. If you want to control all the bulbs in your house, set all the address fields to 0. The code for this project is written in Particle IDE, and can be found on my Github.
Step 6: Other Applications
While I built this project to control LIFX lightbulbs, I can see how this concept can be easily applied to control other IoT device just by tweaking the code. Imagine controlling the volume of your smart speaker with your hand, or adjusting the temperature through your smart thermostat.
This is an entry in the