Code Monkey home page Code Monkey logo

Comments (27)

Kristian8606 avatar Kristian8606 commented on July 19, 2024 1

I would like to contribute to your example.
I added an on / off and reset button as well as a smooth color change and brightness.
https://github.com/Kristian8606/LED_Strip/blob/master/main.c

from esp8266-homekit-neopixel-light-strip.

AchimPieters avatar AchimPieters commented on July 19, 2024 1

@Kristian8606 Thank you for your contribution! I will have a look as soon as possible!

from esp8266-homekit-neopixel-light-strip.

Kristian8606 avatar Kristian8606 commented on July 19, 2024 1

change this ws2812_i2s_init(LED_COUNT, PIXEL_RGBW); and this ws2812_i2s_update(pixels, PIXEL_RGBW); int r, g, b, w;

w = LED_RGB_SCALE * i * (1 -s);
rgb->red = (uint8_t) r;
rgb->green = (uint8_t) g;
rgb->blue = (uint8_t) b;
rgb->white= (uint8_t) w;

Someone to try will this work for sk6812?

from esp8266-homekit-neopixel-light-strip.

AchimPieters avatar AchimPieters commented on July 19, 2024

@dbartelmus It's made for the WS2812 Integrated Light Source, so it's uses just Red, green and blue LEDs. The use for RGBW is on my todo list.

If you want to make you own start here: ESP HomeKit SDK – Full Installation

from esp8266-homekit-neopixel-light-strip.

rmuike avatar rmuike commented on July 19, 2024

@dbartelmus Use this https://github.com/maximkulkin/esp-homekit-demo/blob/master/examples/led_strip/led_strip.c and edit it so it fits your needs. That’s what I did.

from esp8266-homekit-neopixel-light-strip.

dbartelmus avatar dbartelmus commented on July 19, 2024

Thank you greatly. I will share my job later with you.

from esp8266-homekit-neopixel-light-strip.

dbartelmus avatar dbartelmus commented on July 19, 2024

This repository seems to support SK6812 through i2s - https://github.com/esp8266-setup/ws2812_i2s and I can see that author is using different bit patterns depending of led strand:

#if LED_TYPE == LED_TYPE_WS2812
const IRAM_DATA int16_t bitpatterns[16] = {
    0b1000100010001000, 0b1000100010001110, 0b1000100011101000, 0b1000100011101110,
    0b1000111010001000, 0b1000111010001110, 0b1000111011101000, 0b1000111011101110,
    0b1110100010001000, 0b1110100010001110, 0b1110100011101000, 0b1110100011101110,
    0b1110111010001000, 0b1110111010001110, 0b1110111011101000, 0b1110111011101110,
};
#endif

#if LED_TYPE == LED_TYPE_SK6812
static const uint16_t bitpatterns[16] = {
    0b1000100010001000, 0b1000100010001100, 0b1000100011001000, 0b1000100011001100,
    0b1000110010001000, 0b1000110010001100, 0b1000110011001000, 0b1000110011001100,
    0b1100100010001000, 0b1100100010001100, 0b1100100011001000, 0b1100100011001100,
    0b1100110010001000, 0b1100110010001100, 0b1100110011001000, 0b1100110011001100,
};
#endif

and code for ws2812_i2c that was linked above by @rmuike is from different source - it seems that this one is striped only for ws2812 strand - but I can be wrong.
On the other hand there is a function named hsi2rgb:
static void **hsi2rgb**(float h, float s, float i, ws2812_pixel_t* rgb)
and it's easy to find related one to RGBW hsi2rgbw - I'm curious if this as simple as this @rmuike?

from esp8266-homekit-neopixel-light-strip.

AchimPieters avatar AchimPieters commented on July 19, 2024

very interesting! am curious how you would tackle RGBW?

from esp8266-homekit-neopixel-light-strip.

dbartelmus avatar dbartelmus commented on July 19, 2024

I've tried to make approach for "W" (RGBW) of @Kristian8606 code customisation but without success

from esp8266-homekit-neopixel-light-strip.

Kristian8606 avatar Kristian8606 commented on July 19, 2024

The only LED strip I have is ws2812b which is rgb and does not support W.
I think the one that supports rgbw is sk6812, but I don't have one.

from esp8266-homekit-neopixel-light-strip.

AchimPieters avatar AchimPieters commented on July 19, 2024

Okay, that's a pity, but how would you approach it?

from esp8266-homekit-neopixel-light-strip.

dbartelmus avatar dbartelmus commented on July 19, 2024

I've tried this, the real deal with HomeKit is to separate RGB and White cold/White warm channel, not to mix it like the HSI to RGB method to with this code to emulate white with all colors.
This code seems to have some references for white channel, look at every commented section like: // convert HSI to RGBW and etc.
I've done all of this but even RGB is flickering some random color not to mention that I don't get separate white channel like this:
74273644-188e8e80-4d11-11ea-8af8-f70a12180c50

from esp8266-homekit-neopixel-light-strip.

dbartelmus avatar dbartelmus commented on July 19, 2024

Try to build this, I think this comes originally from @Kristian8606 fork
main.c.zip
This is with uncommented and adapted (I think) for RGBW but I'm not sure how HomeKit API works

from esp8266-homekit-neopixel-light-strip.

dbartelmus avatar dbartelmus commented on July 19, 2024

So this is output on sk6812 from main.c which I've attached - despite wifi.h and defining pass and ssid, you still need to connect manually device to your network and then add it to HomeKit, pin-code is 1111-111-111.

Colors are messed up, what's up with that? But it's stable

IMG_7140

from esp8266-homekit-neopixel-light-strip.

Kristian8606 avatar Kristian8606 commented on July 19, 2024

I understand that there are several types of sk6812 rgb and rgbw you need to be sure yours is rgbw

from esp8266-homekit-neopixel-light-strip.

Kristian8606 avatar Kristian8606 commented on July 19, 2024

LED_COUNT must match your pixels count

from esp8266-homekit-neopixel-light-strip.

dbartelmus avatar dbartelmus commented on July 19, 2024

from esp8266-homekit-neopixel-light-strip.

AchimPieters avatar AchimPieters commented on July 19, 2024

change this ws2812_i2s_init(LED_COUNT, PIXEL_RGBW); and this ws2812_i2s_update(pixels, PIXEL_RGBW); int r, g, b, w;

w = LED_RGB_SCALE * i * (1 -s);
rgb->red = (uint8_t) r;
rgb->green = (uint8_t) g;
rgb->blue = (uint8_t) b;
rgb->white= (uint8_t) w;

Someone to try will this work for sk6812?

Tested with a RGBW stip and It works!

from esp8266-homekit-neopixel-light-strip.

Kristian8606 avatar Kristian8606 commented on July 19, 2024

is it possible to make a video because soon i will not have such an LED strip

from esp8266-homekit-neopixel-light-strip.

AchimPieters avatar AchimPieters commented on July 19, 2024

Here's your proof of concept!
IMG_1249.mov.zip

from esp8266-homekit-neopixel-light-strip.

dbartelmus avatar dbartelmus commented on July 19, 2024

It does, goes nicely with Siri :)

from esp8266-homekit-neopixel-light-strip.

dbartelmus avatar dbartelmus commented on July 19, 2024

SK6812 LED Strip RGBW With ESP under HOMEKIT - main.bin.zip
compiled bin for tests - id has some bugs like changing name and first time parity problem, and connection is overall slow BUT working.

from esp8266-homekit-neopixel-light-strip.

rmuike avatar rmuike commented on July 19, 2024

It works but the white channel is not in use when you set it to white.
BC814113-C47B-4A1C-8E28-A5865D54B4E8
This is what it is supposed to look like.
92224B85-39C9-421E-98DD-DA82620E220E

from esp8266-homekit-neopixel-light-strip.

vniehues avatar vniehues commented on July 19, 2024

@rmuike should it not be only white, when its set to white? Thats the point of rgbw, right?
@AchimPieters Any news on RGBW/SK6812 support?

from esp8266-homekit-neopixel-light-strip.

dbartelmus avatar dbartelmus commented on July 19, 2024

from esp8266-homekit-neopixel-light-strip.

vniehues avatar vniehues commented on July 19, 2024

well... i do :D

from esp8266-homekit-neopixel-light-strip.

dbartelmus avatar dbartelmus commented on July 19, 2024

from esp8266-homekit-neopixel-light-strip.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.