Skip to content

DIY Lights

cheesemarathon edited this page Dec 6, 2018 · 5 revisions

The following devices are currently supported:

  • generic pwm cct lights (2 channels) - ex Milight bicolor
  • generic pwm rgb lights (3 channels)
  • generic pwm rgbw lights (4 channels) - ex. Feican bulbs
  • generic pwm rgb-cct lights (5 chnnels - ex Milight FUT015)
  • SK6812 neopixels
  • WS2812B neopixels
  • all ZigBee lights - check Raspbee module page

A lot of Wi-Fi lights from the market are ESP8266 based and can be used very easily with this project by flashing the firmware with one provided. Almost all dimmable lights that are not ESP8266 based (ex MiLight bulbs) can be converted to Wi-Fi with one ESP-12S module by connecting the outputs directly to led drivers (picture available). If you decide to convert a MiLight bulb to ESP-12S, then I recommend to use a micro step down buck converter in order to avoid overheating issues.

All lights are two way synchronized so any change made by 3rd party device will also be added to the bridge emulator on the first request to each light group. By default any light that become unreachable will be marked as unreachable and will be displayed as off. This is because lot of people still use classic light switches.

Light GUI

LightGUI

All lights have an internal web GUI that can be accesses with any browser and offers the following options:

  • Turn the light on/off
  • Set the startup option:
    • Light Off (default)
    • Light On
    • Last State (Turns the light on to the same state as it was the last time it was on)
  • Change the scene. This will change also the power on scene
  • Change any light parameter (bri, color, ct, xy, etc)

Hardware

We currently have two custom PCBs designed that use Wemos D1 minis as their main processor. One PCB is for driving 12v strips without an integrated driver IC, and the other is for LED strips with WS2812, SK6812 or similar LEDs. These can be found here

Flashing the Firmware

Neopixels

Before compiling the code, you must set the lightsCount and pixelCount variables. lightsCount is the number of virtual lights to create from your NeoPixel strip. pixelCount is the number of NeoPixel LED's per light. transitionLeds variable represent the number of leds used for smooth transition from current light to nearby lights. I recommend to use at last 3 lights, one light at every 20 - 50 LED's so you can enjoy the Hue scenes and Hue Entertainment. The data pin of the LED's must be connected to RX pin of the ESP8266 board. Make sure to disconnect this when uploading or it will fail.

neopixel_wiring

Generic lights

If your device is factory ESP8266 based, then you must specify the pins used in that devices before compiling the code. If you don't know what pins are used or what color is controlled on a pin then try random pins with OTA firmware upgrades until you find the correct pins.
I recommend using the MiLight FUT15 bulbs converted to ESP-12S because of it's high brightness and good color reproduction.

MiLight FUT15

Connecting the lights to a Wi-Fi network

All the lights are using WiFiManager and on power on it will broadcast for the first 2 minutes with the SSID set in light_name variable (default Hue .....). Connect to this network with you phone or computer and browse to http://192.168.4.1. Modern computers/phones popup automatically the configuration window. From here you can choose the SSID of the network you would like the light to connect to and enter its password. After the light is present on your network open the official Hue application and scan for new lights. In case no lights are found, check if the nmap package is installed. Note: The app will often say no lights found but the lights will then appear a few seconds after this notification. So be patient!

Lights API

The lights use the same Hue protocol however, the values are not sent in json, like in the Hue protocol, but directly in GET request:
Example:

"http://{light ip}/set?light=1&r=0&g=60&b=255&transitiontime=2000"  
"http://{light ip}/discover"

Arguments that can be passed in the URL:

  • "on": 1 to set light on, 0 to set the light off.
  • "r", "g", "b": Set the light color using RGB values between 0 and 255.
  • "x" and "y": Values between 0.0 and 1.0 to set the light color using a CIE chart.
  • "ct": Value between 153 (max warm white) and 500 (max could white) http://en.wikipedia.org/wiki/Mired
  • hue: Value between 0 and 65535, representing the hue of the light.
  • sat: Set the saturation of the light. 255 is the most saturated and 0 is the least saturated.
  • bri: Set the brightness of the light, 255 is the maximum brightness, 1 is the minimum, 0 will turn the light on to previous state
  • transitiontime: Duration of the transition from the light’s current state to the new state. The default is 4 representing 0.4 seconds.
  • bri_inc: Increase or decrease the brightness with a specified value

Firmware upgrade

You can upgrade the firmware very easily with Adruino OTA.