Skip to content

This software is able to power an ESP8266 driven RGB LED strip. It integrates with HomeKit natively (no bridge needed)

License

Notifications You must be signed in to change notification settings

DominikHorn/esp8266-rgb-led-strip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Purpose of this software

This software is meant to be flashed on an esp8266, connected with an RGB LED strip. It is able to drive all colors of the strip from 0 to 100% dimmable via multichannel pwm.

Homekit integration

No bridge is required. Instead, this project uses the esp-homekit implementation found here: https://github.com/maximkulkin/esp-homekit to directly connect with homekit controller devices.

Installation

  1. Install esp-open-sdk, build it with make toolchain esptool libhal STANDALONE=n, then edit your PATH and add the generated toolchain bin directory. The path will be something like /path/to/esp-open-sdk/xtensa-lx106-elf/bin.
  2. Install esptool.py and make it available on your PATH. If you used esp-open-sdk then this is done already.
  3. Checkout esp-open-rtos and set SDK_PATH environment variable pointing to it.
  4. Clone esp-homekit-demo (for archive purposes forked here) and initialize all submodules (recursively):
git clone https://github.com/maximkulkin/esp-homekit-demo
cd esp-homekit-demo
git submodule update --init --recursive
  1. Copy wifi.h.sample -> wifi.h and edit it with correct WiFi SSID and password:
cp wifi.h.sample wifi.h
vi wifi.h
  1. Clone this project into the examples subfolder and copy config.h.sample -> config.h. Set correct config options afterwards:
cd examples
git clone https://github.com/DominikHorn/esp8266-rgb-led-strip.git
cd esp8266-rgb-led-strip
cp config.h.sample config.h
vi config.h
  1. Configure settings:
    1. If you use ESP8266 with 4MB of flash (32m bit), then you're fine. If you have 1MB chip, you need to set following environment variables:
    export FLASH_SIZE=8
    export HOMEKIT_SPI_FLASH_BASE_ADDR=0x7a000
    1. If you're debugging stuff, or have troubles and want to file issue and attach log, please enable DEBUG output:
    export HOMEKIT_DEBUG=1
    1. Depending on your device, it might be required to change the flash mode:
    export FLASH_MODE=dout
    (see issue #80)
  2. Build:
cd esp-homekit-demo/examples/esp8266-rgb-led-strip
make -C . all
  1. Set ESPPORT environment variable pointing to USB device your ESP8266 is attached to (assuming your device is at /dev/tty.SLAB_USBtoUART):
export ESPPORT=/dev/tty.SLAB_USBtoUART
  1. To prevent any effects from previous firmware (e.g. firmware crashing right at start), highly recommend to erase flash:
    cd esp-homekit-demo/examples/esp8266-rgb-led-strip
    make -C . erase_flash
  1. Upload firmware to ESP:
    cd esp-homekit-demo/examples/esp8266-rgb-led-strip
    make -C . test

or

    cd esp-homekit-demo/examples/esp8266-rgb-led-strip
    make -C flash
    make -C monitor

or

    cd esp-homekit-demo/examples/esp8266-rgb-led-strip
    ./build.sh
  1. Open Home app on your device, and click '+'. If Home does not recognize the ESP8266, proceed to adding device anyways by entering code.

Troubleshooting

Try to monitor the ESP8266 while it's executing the software:

    cd esp-homekit-demo/examples/esp8266-rgb-led-strip
    make -C . monitor

It is often also a good idea to reset the ESP (cutoff power).

Circuitry

Bare in mind that I have not studied electronics engineering an am merely a software engineer with hobby interests in the subject. As far as I can tell my setup allows for max 3A at 12V, meaning with the LED Strip I used, 3m is the maximum possible length!

I roughly followed ideas from this tutorial/project.

My components/setup:

  • 1x esp8266. I prefer the NodeMCU version because it's PCB comes with a USB controlling unit and port built in. This allows for fast debugging and most importantly you may reflash easily even after soldering. Alternatively you can use a standard ESP8266 with a programmer unit, and solder only a mount to your custom pcb.
  • 1x RGB LED Strip
  • 1x DC Power Supply (12V, x Amps). Make sure this delivers enough power to drive you LED Strip length and doesn't exceed the maximum 3A at which the transistor, dc jack and step down module are rated!
  • 1x DC 12V 3A power jack female
  • 1x DC DC step-down module for driving esp8266 from 12V power supply
  • insulated electric wire (preferably multiple colors, makes your life easier)
  • 3x IRF3205 TO220 Hexfet power mosfet transistors
  • 1x prototype PCB

Optional

  • 1x SMD button if you wish to physically turn the strip on/off

I ordered my components from aliexpress.com. Bellow is a list of all things I ordered: