logo elektroda
logo elektroda
X
logo elektroda

OpenBeken WS2812B driver (compatible with SM16703P, etc) - short scripting presentation

p.kaczmarek2 7794 52
ADVERTISEMENT
  • #31 20970128
    p.kaczmarek2
    Moderator Smart Home
    MnM1 wrote:

    MnM1 wrote:

    WS2811 LED strip with a SOIC chip and 3 RGB LEDs.

    Well, @MnM1 , I can clearly see on your picture that this device has one LED controller per 3 RGB LEDs, so the LEDs are working in group of 3, that's fully expected and understandable, so please stop reporting this as potential firmware error.

    Here is a breakdown of most common WS strips:
    Image showing a comparison of LED strips WS2812, WS2811, WS2813, and WS2815.
    Your device has WS2811 LED strips, that's the strip where SOIC chip controls 3 LEDs in a group. Here is WS2811 pinout:
    Pin diagram of the WS2811 chip with pin function description.
    So everything works as expected.


    Now I think we can focus on the user interface. What kind of features would you like to have on the main panel, @MnM1 ?


    @igfotfrank ok that is now clear. I will make a better driver dedicated for such case, I will let you know once it's ready for testing.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #32 20971186
    igfotfrank
    Level 7  
    i've wrote a small script.
    Now im abel to control the RGB and White mode seperate.
    Now i want to create a virtual button to enable/disable the Light completly.

    
    startDriver SM16703P
    SM16703P_Init 60
    again:
    if  $led_enableAll<1 then goto color
    SM16703P_SetPixel all 0 0 0
    SM16703P_Start
    led_temperature $led_temperature*$led_enableAll
    led_dimmer $led_dimmer*$led_enableAll
    goto end
    color:
    SM16703P_SetPixel all 1*$led_red*$led_dimmer/255 1*$led_green*$led_dimmer/255 1*$led_blue*$led_dimmer/255
    SM16703P_Start
    end:
    delay_s 1
    goto again
    
  • ADVERTISEMENT
  • #33 20971678
    MnM1
    Level 10  
    OK, for me I will like to see some effects that are available in the Tuya app - Gradient mode (this one I use the most),, Jump mode, Flash Mode, Symphony Mode, Trail Mode, etc

    Also I think will be good if there is a speed slider on the main page to slow down or speed up any effects.

    This might be doable with scripting but I don't have much experience in that area...
  • #34 20971707
    p.kaczmarek2
    Moderator Smart Home
    Don't worry about scripting, I will make this in firmware for you guys.

    Speed slider is a good idea. I will also note down the effects.

    Okay, any futher ideas?

    @igfotfrank good job on the script, it should be good for a start until I get some dedicated drivers for your lamp
    Helpful post? Buy me a coffee.
  • #35 20971798
    igfotfrank
    Level 7  
    @p.kaczmarek2
    Would be good if you could take the standard variables for led red green blue, so that you could set the leds with the topic "cmnd/device_name/led_basecolor_rgb" and then get a state via mqtt in which state(rgb/white/both) the stripe is.
  • ADVERTISEMENT
  • #36 20972135
    jkwim
    Level 12  
    p.kaczmarek2 wrote:
    Why do you want to use SM16703P_SetRaw for single pixel if there arleady is SM16703P_SetPixel?

    The update parameter determines whether the data is automatically sent to the LEDs. It's an option to have "SM16703P_Start" called automatically.


    I want to use the color codes in HEX.

    Added after 7 [minutes]:

    p.kaczmarek2 wrote:
    Don't worry about scripting, I will make this in firmware for you guys.

    Speed slider is a good idea. I will also note down the effects.

    Okay, any futher ideas?



    Don't know whether something closer to FastLED Library can be embedded. I mean the upper layers. FastLED runs on ordinary GPIO pins using bit banging. So that is out for OpenBK since we can only use MOSI pin.

    FastLED has lot of functions in the upper layer eg: gradient fill etc.

    And even color addition, subtraction.
  • #37 20972178
    p.kaczmarek2
    Moderator Smart Home
    I've did a groundwork for the driver, and by groundwork I mean I've started creating automatic self tests for LED control:
    https://github.com/openshwprojects/OpenBK7231...mmit/a61c9965ef1f163551772be62bac9f8fe3d63b01
    This will automatically test LED system to ensure that everything works as expected. This is required because it's easy to break something during development and it's hard to test every possible combination by hand.

    I will start expanding LED driver later.

    igfotfrank wrote:
    @p.kaczmarek2
    Would be good if you could take the standard variables for led red green blue, so that you could set the leds with the topic "cmnd/device_name/led_basecolor_rgb" and then get a state via mqtt in which state(rgb/white/both) the stripe is.

    This is my plan. I am going to extend old LED driver and add there an extra state for animations.


    jkwim wrote:

    Don't know whether something closer to FastLED Library can be embedded.

    I have looked at one library so far but it was in CPP (so it would require mixing, like IR did) and it required quite a lot of porting. Maybe I will decide to just create few simple effects myself first. I don't know yet. I'm open to suggestions.

    jkwim wrote:
    FastLED runs on ordinary GPIO pins using bit banging.

    I've tried that and failed. The instruction cache causes lags. It would only work with ramfunc, but we failed to get ramfunc running on BK.
    Helpful post? Buy me a coffee.
  • #38 20972834
    MnM1
    Level 10  
    @p.kaczmarek2 - is this available for BK7231T as well?
  • #39 20972896
    jkwim
    Level 12  
    p.kaczmarek2 wrote:
    Why do you want to use SM16703P_SetRaw for single pixel if there arleady is SM16703P_SetPixel?

    The update parameter determines whether the data is automatically sent to the LEDs. It's an option to have "SM16703P_Start" called automatically.

    I want to use the color codes in HEX.




    Also I observed that the delay caused by SM16703P_Start command can be eliminated when using RAW command.

    I created two scripts of my loop above using the different commands.

    I could observe that the SM16703P_Start loop causes the LED to be lit for longer period than when using RAW command. Both loops did not have any delay_ms statement.

    So if somebody wants to create faster patterns, it would be better to use the RAW mode.[/quote]
  • #40 20981268
    igfotfrank
    Level 7  
    How is the status of the driver
  • #41 20981483
    jkwim
    Level 12  
    igfotfrank wrote:
    How is the status of the driver


    please see my testing results in previous posts.
  • #42 21042004
    alfakenzo
    Level 9  
    Hi guys, i updated my led stripe to newest firmware how can i now use the new things you wrote? How must i set the correct pin on the firmware? I cant configire still the stripe with the needed things.
  • #43 21042131
    p.kaczmarek2
    Moderator Smart Home
    Have you tried the script from the Class LED controller (single color only) section of the first post?
    Helpful post? Buy me a coffee.
  • #44 21066567
    p.kaczmarek2
    Moderator Smart Home
    I am working on LEDs again. For now, to make development quicker, I have integrated per-pixel lighting into OBK simulator, more here:
    https://www.elektroda.com/rtvforum/topic4046056.html
    Here is a sample:
    Circuit simulation with WS2812 LEDs in OpenBeken software.
    More updates coming soon!
    Helpful post? Buy me a coffee.
  • #45 21082916
    igfotfrank
    Level 7  
    Are they any new Updates for the GUI Toggeling the White/RGB Mode. In my prevoius post i have wrote my script but i don't know how to integrate it with HomeAssistant. So that i can toggle between them.
  • ADVERTISEMENT
  • #46 21082923
    p.kaczmarek2
    Moderator Smart Home
    Yes, latest version should work without scripts. We also have a WIP version of pixel animations: https://github.com/openshwprojects/OpenBK7231T_App/pull/1205
    Helpful post? Buy me a coffee.
  • #47 21083738
    igfotfrank
    Level 7  
    Sorry but i doesn't understand. Should i set some Flags ? I can control the color but i can't toggle between RGB and Cold/Warm White Mode/ON/OFF over the WebGUI.
    Edit:
    HomeAssistant works great thanks
  • #48 21098975
    divadiow
    Level 34  
    very cool

    I'm just playing with a new device that came today that is almost the perfect thing for OBK SPI LED control

    CBU. SPI LED connector. Toggle button. Connected but vacant IR pad for DIY expansion. 12-24v barrel connector. The only issue is that it outputs 12V and was advertised as being for WS2811. Easy enough to mod though.

    Here's my device running OBK and RGB full length static script. 120 WS2128B LED strip, external PSU.

    The image shows an RGB LED strip and a controller placed on a wooden table.
  • #49 21098997
    p.kaczmarek2
    Moderator Smart Home
    Hey @divadiow, do you think that we can put PixelAnim in the public release? Have you checked this driver?

    @igfotfrank where do you have CW slider? Can you provide more info? WS2812B LEDs are RGB only. There is no CW.
    Helpful post? Buy me a coffee.
  • #50 21099011
    divadiow
    Level 34  
    p.kaczmarek2 wrote:
    do you think that we can put PixelAnim in the public release? Have you checked this driver?


    Not yet. Will do shortly. Only just flashed to OBK.
  • #51 21099045
    igfotfrank
    Level 7  
    On page 1. I described my stripe. It's almost the same as the first post.
    Quote:
    It has 2 Pwm pins for the white led (brightness/temperatur) and i configured one pin for the sm16703p.
    Rgb led and white leds are seperate
  • Helpful post
    #52 21099114
    divadiow
    Level 34  
    it works.

    Screenshot of the user interface for the LED lighting controller OpenBK_BK7231N_CBU_Outsmart.

    autoexec for me
    Code: Text
    Log in, to see the code






    curiously the last few LEDs are a bit static or off and each time you turn off the strip odd ones remain on

    Two LED strips on a carpet with several brightly lit bulbs of different colors. LED strip light illuminating in various colors on a carpeted floor. LED strip emitting various colors, arranged in a loop on a brown carpet.

    Added after 6 [minutes]:

    and the speed slider is reverse - left = faster. right = slower.

    :)
  • #53 21101531
    p.kaczmarek2
    Moderator Smart Home
    The speed is actually "interval between refreshes" so I may need to rename that...

    Anyway, let's continue in the release topic:
    https://www.elektroda.com/rtvforum/topic4057187.html
    Please report problems there. I will close the current topic now.
    Helpful post? Buy me a coffee.

Topic summary

The discussion focuses on the implementation and control of individually addressable LEDs, specifically WS2812B and SM16703P, using the OpenBeken (OBK) firmware. Users share their experiences with integrating these LEDs into various devices, such as smart wall switches and LED strips. Key topics include manual LED control, scripting for LED commands, and troubleshooting issues related to firmware versions and LED behavior. Users also discuss the potential for advanced animations and the need for specific configurations to toggle between RGB and white modes. The conversation highlights the importance of using the correct firmware version and the impact of power supply on LED performance.
Summary generated by the language model.
ADVERTISEMENT