maximkulkin / esp-homekit-demo

Demo of Apple HomeKit accessory server library
MIT License
809 stars 233 forks source link

Add: An Example to control Ws2812b / SK6812 RGB(W) Stripes #41

Closed dbambus closed 6 years ago

dbambus commented 6 years ago

Hey maximkulkin,

you really did an amazing job creating all those examples for HomeKit on an ESP8266. I used it to create a bunch of different accessories, but I was wondering how to control RGB(W) LED Stripes using HomeKit. I took a look in your Light example, but couldn't work it out.

David

renssies commented 6 years ago

The lightbulb example uses regular LEDs, controlling them with transistors and PWM. WS281x LEDs are digital LEDs, you can control them individually from one data wire.

To find an example of how to control WS281x LEDs using esp-open-rtos (what the homekit code is based on), have a look at this: https://github.com/SuperHouse/esp-open-rtos/tree/master/examples/ws2812_i2s and the fireplace example. Both use i2s to control WS281x LEDs.

Controlling the WS281x over i2s is required because of the timing that is incorrect because of a lot of network traffic.

maximkulkin commented 6 years ago

Take a look at “fireplace” example.

pcsaito commented 6 years ago

Now there is the led_strip_animation example that uses the WS2812FX lib to perform some effects animations.