logo elektroda
logo elektroda
X
logo elektroda

OpenBeken for Smart Bulb GU10 5W (?) by ? with BK7231N and SM2235

emarck 681 14
ADVERTISEMENT
  • #1 21755069
    emarck
    Level 6  
    The Smart Bulb GU10 5W (?) by ? has been available under the Avatar Controls brand name since around November 2020, for example at Amazon.com, Amazon.co.uk and Amazon.de. It is usually integrated into the smart home using the Avatar Controls app.

    White GU10 smart bulb with colored gradient top and Avatar Controls logo

    Manufacturer?
    Model nameSmart Bulb GU10 5W
    Model number?
    PCB name26X32SEG21172
    PCB date?


    Products

    Brand nameAvatar Controls
    Product nameSmart Bulb GU10 5W
    Product numberALS23L
    GTIN-13 (EAN-13)
    Article numberX001ASUR2F


    Principle of operation

    A microcontroller BK7231N by Beken is used directly on the circuit board, which connects to the Tuya cloud via Wi-Fi and controlling five multicolored as well as each of six cool white and warm white LEDs. The dimmable RGBCW lamp (SM2235) can be operated through an app.


    Firmware flashing

    It is not possible to disconnect from the Tuya cloud using CloudCutter, as the pre-installed firmware version 1.5.32 with class oem_bk7231n_light_ty has already been patched against the known vulnerability.
    Therefore, OpenBeken must be flashed via the serial interface (GND, 3.3V, U1_TX, U1_RX).

    Close-up of PCB inside GU10 smart bulb with labeled serial pins and surface components


    Firmware configuration

    OpenBeken template:
    {
      "vendor": "?",
      "bDetailed": "0",
      "name": "Smart Bulb GU10 5W",
      "model": "?",
      "chip": "BK7231N",
      "board": "on PCB",
      "flags": "2251937261425664",
      "keywords": [
        "26X32SEG21172",
        "Avatar Controls",
        "ALS23L",
        "X001ASUR2F",
        "LED",
        "RGBCW",
        "SM2235",
        "GU10",
        "500 lm",
        "5.0 W"
      ],
      "pins": {
        "24": "SM2235DAT;0",
        "26": "SM2235CLK;0"
      },
      "command": "SM2235_Map 1 0 2 3 4",
      "image": "https://obrazki.elektroda.pl/1057299100_1763206637.png",
      "wiki": "https://www.elektroda.com/rtvforum/topic_YOUR_TOPIC.html"
    }

    Contents of the autoexec.bat file:
    // Enable NTP (Network Time Protocol) driver
    startDriver ntp
    
    // Config local NTP server IP address
    //ntp_setServer 192.168.1.1 // OpenWrt
    //ntp_setServer 192.168.10.1 // LibreCMC
    ntp_setServer 192.168.178.1 // Fritz!Box
    
    // Config local time zone
    setChannelType 5 Default
    setChannelLabel 5  "Time Zone Offset"
    setChannelPrivate 5 1
    setChannelVisible 5 0
    //setChannel 5 -5 // EST (Eastern Standard Time)
    setChannel 5 1 // CET (Central European Time)
    
    // Config summer time
    setChannelType 6 Toggle
    setChannelLabel 6 "Summer Time" 0
    setChannelPrivate 6 1
    addChangeHandler Channel6 == 0 ntp_timeZoneOfs $CH5 // Standard time
    addChangeHandler Channel6 == 1 ntp_timeZoneOfs $CH5+1 // Summer time
    
    // Config local time
    if $CH6==0 then "ntp_timeZoneOfs $CH5" else "ntp_timeZoneOfs $CH5+1"
    
    // Config location
    //ntp_setLatlong 38.895 -77.036667 // District of Columbia, United States
    ntp_setLatlong 52.518611 13.408333 // Berlin, Germany
    
    // Wait for available time values
    waitFor NTPState 1
    
    // Store current time
    setChannelType 10 TimerSeconds
    setChannelLabel 10 "Current Time"
    setChannelPrivate 10 1
    setChannelVisible 10 0
    
    // Config aliased commands
    alias startColorWheelTransition addRepeatingEventID 48 -1 1 backlog led_lerpSpeed 32; led_basecolor_rgbcw #0000FF0000; delay_s 4; led_basecolor_rgbcw #007FFF0000; delay_s 4; led_basecolor_rgbcw #00FFFF0000; delay_s 4; led_basecolor_rgbcw #00FF7F0000; delay_s 4; led_basecolor_rgbcw #00FF000000; delay_s 4; led_basecolor_rgbcw #7FFF000000; delay_s 4; led_basecolor_rgbcw #FFFF000000; delay_s 4; led_basecolor_rgbcw #FF7F000000; delay_s 4; led_basecolor_rgbcw #FF00000000; delay_s 4; led_basecolor_rgbcw #FF007F0000; delay_s 4; led_basecolor_rgbcw #FF00FF0000; delay_s 4; led_basecolor_rgbcw #7F00FF0000; delay_s 4 // Infinitely repeating color wheel transition
    alias stopColorWheelTransition backlog cancelRepeatingEvent 1; led_enableAll 0
    alias storeCurrentTime setChannel 10 $hour*3600+$minute*60+$second
    alias checkSunriseTime backlog removeClockEvent 5; storeCurrentTime; if $sunrise>=18000 then "addClockEvent 05:00 0xff 5 startColorWheelTransition" // Turn on light every day at 05:00, unless sun has already risen
    alias checkSunsetTime backlog removeClockEvent 6; storeCurrentTime; if $sunset<=72000 then "addClockEvent sunset 0xff 6 startColorWheelTransition" // Turn on light every day at sunset, unless it is already 20:00
    
    // Config clock events
    addClockEvent 01:00 0xff 1 checkSunriseTime // Check whether addClockEvent for 05:00 is possible
    addClockEvent sunrise 0xff 2 stopColorWheelTransition // Turn off light every day at sunrise
    addClockEvent 13:00 0xff 3 checkSunsetTime // Check whether addClockEvent for sunset is possible
    addClockEvent 20:00 0xff 4 stopColorWheelTransition // Turn off light every day at 20:00
    
    // Initialize lamp
    checkSunriseTime
    checkSunsetTime
    storeCurrentTime
    if $hour>=05&&$CH10<=$sunrise then startColorWheelTransition // Turn on light from 05:00 to sunrise
    if $CH10>$sunrise&&$CH10<$sunset then "led_enableAll 0" // Turn off light from sunrise to sunset
    if $CH10>=$sunset&&$hour<=20 then startColorWheelTransition // Turn on light from sunset to 20:00
    if $hour>20||$hour<05 then "led_enableAll 0" // Turn off light from 20:00 to 05:00

    OpenBeken setting, to remember the set standard or summer time:
    Config → Configure Startup → Channel 6: -1


    Firmware explaination

    The lamp is to be installed in a weatherproof outdoor housing and used to illuminate a sculpture with smooth color transitions in winter, shining during the dark hours of the morning and evening, with the switch-on and switch-off times based on the sun.


    Firmware difficulties

    1. There is no ready-made driver for smooth color transitions, as there is for addressable LEDs with PixelAnim, right? Therefore, I defined this alias together with flag 18:
    alias startColorWheelTransition addRepeatingEventID 48 -1 1 backlog led_lerpSpeed 32; led_basecolor_rgbcw #0000FF0000; delay_s 4; led_basecolor_rgbcw #007FFF0000; delay_s 4; led_basecolor_rgbcw #00FFFF0000; delay_s 4; led_basecolor_rgbcw #00FF7F0000; delay_s 4; led_basecolor_rgbcw #00FF000000; delay_s 4; led_basecolor_rgbcw #7FFF000000; delay_s 4; led_basecolor_rgbcw #FFFF000000; delay_s 4; led_basecolor_rgbcw #FF7F000000; delay_s 4; led_basecolor_rgbcw #FF00000000; delay_s 4; led_basecolor_rgbcw #FF007F0000; delay_s 4; led_basecolor_rgbcw #FF00FF0000; delay_s 4; led_basecolor_rgbcw #7F00FF0000; delay_s 4 // Infinitely repeating color wheel transition

    However, the following event occurs in the log:
    ...
    Error:CMD:Too many args, skipped all after 32nd.
    Info:CMD:New alias has been set: startColorWheelTransition runs addRepeatingEventID 48 -1 1 backlog led_lerpSpeed 32; led_basecolor_rgbcw #0000FF0000; delay_s 4; led_basecolor_rgbcw #007FFF0000; delay_s 4; led_basecolor_rgbcw #00FFFF0000; delay_s 4; led_basecolor_rgbcw #00FF7F0000; delay_s 4; led_basecolor_rgbcw #00FF000000; delay_s 4; led_basecolor_rgbcw #7FFF000000; delay_s 4; led_basecolor_rgbcw #FFFF000000; delay_s 4; led_basecolor_rgbcw #FF7F000000; delay_s 4; led_basecolor_rgbcw #FF00000000; delay_s 4; led_basecolor_rgbcw #FF007F0000; delay_s 4; led_basecolor_rgbcw #FF00FF0000; delay_s 4; led_basecolor_rgbcw #7F00FF0000; delay_s 4 // Infinitely repeating color wheel transition
    Info:CMD:New alias has been set: stopColorWheelTransition runs backlog cancelRepeatingEvent 1; led_enableAll 0
    Info:CMD:New alias has been set: storeCurrentTime runs setChannel 10 $hour*3600+$minute*60+$second
    Info:CMD:New alias has been set: checkSunriseTime runs backlog removeClockEvent 5; storeCurrentTime; if $sunrise>=18000 then "addClockEvent 05:00 0xff 5 startColorWheelTransition" // Turn on light every day at 05:00, unless sun has already risen
    Info:CMD:New alias has been set: checkSunsetTime runs backlog removeClockEvent 6; storeCurrentTime; if $sunset<=72000 then "addClockEvent sunset 0xff 6 startColorWheelTransition" // Turn on light every day at sunset, unless it is already 20:00
    ...

    Is it sufficient to split this long command, because the error then disappears from the log?
    alias setColorWheelCool backlog led_basecolor_rgbcw #0000FF0000; delay_s 4; led_basecolor_rgbcw #007FFF0000; delay_s 4; led_basecolor_rgbcw #00FFFF0000; delay_s 4; led_basecolor_rgbcw #00FF7F0000; delay_s 4; led_basecolor_rgbcw #00FF000000; delay_s 4; led_basecolor_rgbcw #7FFF000000; delay_s 4
    alias setColorWheelWarm backlog led_basecolor_rgbcw #FFFF000000; delay_s 4; led_basecolor_rgbcw #FF7F000000; delay_s 4; led_basecolor_rgbcw #FF00000000; delay_s 4; led_basecolor_rgbcw #FF007F0000; delay_s 4; led_basecolor_rgbcw #FF00FF0000; delay_s 4; led_basecolor_rgbcw #7F00FF0000; delay_s 4
    alias startColorWheelTransition addRepeatingEventID 48 -1 1 backlog led_lerpSpeed 32; setColorWheelCool; setColorWheelWarm // Infinitely repeating color wheel transition


    2. It seems as if this autoexec.bat file overloads the lamp, because crashes occur from time to time and a message appears, such as:
    ...
    Error:MAIN:Low heap warning!
    ...


    3. The check for the initial state after startup is based on this post, but only works when the light is turned off and not when the alias startColorWheelTransition is called, because the comment is interpreted incorrectly (without it is fine):
    ...
    Info:CMD:addRepeatingEvent: interval nan, repeats 0, command [on light from sunset to 20:00]
    ...
  • ADVERTISEMENT
  • #2 21755614
    p.kaczmarek2
    Moderator Smart Home
    Hey, can you try to do this animation in script thread? Each command in next line... not in backlog.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #3 21755980
    emarck
    Level 6  
    Thanks for the reply. I hadn't thought of putting the long command into a separate ledanim.bat file:
    animColorWheel:
        led_lerpSpeed 32
        led_basecolor_rgbcw #0000FF0000 // Blue
        delay_s 4
        led_basecolor_rgbcw #007FFF0000
        delay_s 4
        led_basecolor_rgbcw #00FFFF0000
        delay_s 4
        led_basecolor_rgbcw #00FF7F0000
        delay_s 4
        led_basecolor_rgbcw #00FF000000 // Lime
        delay_s 4
        led_basecolor_rgbcw #7FFF000000
        delay_s 4
        led_basecolor_rgbcw #FFFF000000
        delay_s 4
        led_basecolor_rgbcw #FF7F000000
        delay_s 4
        led_basecolor_rgbcw #FF00000000 // Red
        delay_s 4
        led_basecolor_rgbcw #FF007F0000
        delay_s 4
        led_basecolor_rgbcw #FF00FF0000
        delay_s 4
        led_basecolor_rgbcw #7F00FF0000
        delay_s 4
        return


    The script is called and terminated using these two aliases:
    alias startColorWheelTransition addRepeatingEventID 48 -1 1 startScript ledanim.bat animColorWheel
    alias stopColorWheelTransition backlog cancelRepeatingEvent 1; stopAllScripts; led_enableAll 0


    The animation now runs much better, but crashes and warnings still occur occasionally.
  • #4 21757766
    divadiow
    Level 37  
    I wonder if it's crashing now because of a heat issue? I doubt it's ultimate accuracy but have you noted what temperatures the GUI reports the chip to get up to?

    are you using powersave 1 command in startup or autoexec?

    you could also limit the SM2235 current because OBK default may be too high compared to factory

    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/commands-extended.md

    Table section with entry SM2235_Current and highlighted word “current”

    I don't see any/many examples of users limiting SM2235 current though and it seems the command only accepts one value

    Added after 2 [minutes]:

    extraction from the backup you kindly sent

    Code: Text
    Log in, to see the code


    Added after 5 [minutes]:

    and the boot log

    Code: Text
    Log in, to see the code


    Added after 5 [minutes]:

    Code: Text
    Log in, to see the code


    Added after 24 [minutes]:

    divadiow wrote:
    it seems the command only accepts one value


    but maybe commands doc is wrong @p.kaczmarek2 ?

    https://github.com/divadiow/OpenBK7231T_App/blob/main/src/driver/drv_sm2235.c#L76
  • ADVERTISEMENT
  • #5 21758146
    p.kaczmarek2
    Moderator Smart Home
    Nice finding. It's not implemented. Do you have SM2235 to try to test? I also wonder if LLM could manage it. Maybe with some guidance,.
    Helpful post? Buy me a coffee.
  • #7 21758164
    divadiow
    Level 37  
    p.kaczmarek2 wrote:
    Do you have SM2235 to try to test?

    sadly no, unless there's one in a bulb I haven't opened yet.

    Added after 1 [hours] 53 [minutes]:

    divadiow wrote:
    unless there's one in a bulb I haven't opened yet.


    nope

    @emarck your template has SM2235_Map 1 0 2 3 4 but easy flasher extraction is SM2235_Map 1 0 2 4 3. Are you colours mapped as you would expect?
  • ADVERTISEMENT
  • #8 21758706
    emarck
    Level 6  
    The chip temperature averages 110 °C and peaks at 119.4 °C.

    I am using the lamp with exactly the same configuration as in the first post, or rather with the modification suggested by p.kaczmarek2. I have not used the PowerSave command to date. Should I try it?

    Initially, I also used automatic configuration extraction, but warm white and cool white were swapped, which is why I changed the mapping to SM2235_Map 1 0 2 3 4.

    Are the values for RGB and white current really ideal, or are they just as they were read from the official firmware and may still need to be questioned? What are the current default values of OpenBeken without adjustment?
    I am able to test with the appropriate instructions.
  • #9 21762083
    p.kaczmarek2
    Moderator Smart Home
    I fixed SM2235_Current, default values are SM2235_Current 2 4, try lower maybe? SM2235_Current RGB CW.

    Give it a go and let me know if it works.

    @insmod can you double check if commit looks ok, just to be sure? Not that it would break anything...
    https://github.com/openshwprojects/OpenBK7231...mmit/22daaeb07e90696c2cbaf529856d420099fec80b
    Helpful post? Buy me a coffee.
  • #11 21762233
    p.kaczmarek2
    Moderator Smart Home
    I also added another solution for it. Should be already in release.
    led_dimmerScale is a simple way of decreasing LED bulbs heating. led_dimmerScale expects argument in 0-1 range. For example, if you set led_dimmerScale to 0.8, then OBK/Home Assistant dimmer at 100% will in reality translate to 80% PWM duty cycle, so LEDs will be slightly darker, but they will heat less and it will prolong LEDs life.

    It should work for all LED types - PWM based and driver based.

    Try it out and let me know if it helps with your bulb
    Helpful post? Buy me a coffee.
  • #12 21762652
    emarck
    Level 6  
    I'm still a little unsure. I can find the values for SM2235_Current in this table, right?
    The original current was extracted at 1 mA for RGB and 2 mA for CW, which is significantly below the smallest possible adjustable values.

    I have tested the following so far:
    1. SM2235_Current 2 4 (default values: RGB 30 mA, CW 25 mA) → Average temperature 109 °C
    2. SM2235_Current 0 0 (lowest values: RGB 10 mA, CW 5 mA) → Average temperature 85 °C
    3. SM2235_Current 0 3; led_dimmerScale 0.1 (original values: RGB 0.1 * 10 mA, CW 0.1 * 20 mA) → Average temperature 68 °C

    I am aware that in the last attempt, only the average current is limited to the original values, not the maximum current, but I don't know how else to set them. Apart from that, the lamp is much too dark with this setting and crashes still occur in all three tests.
  • #13 21762663
    p.kaczmarek2
    Moderator Smart Home
    The values are there:
    OpenBeken for Smart Bulb GU10 5W (?) by ? with BK7231N and SM2235
    SM2235_Current 2 4 is default one, as adnotated on table.

    Good point on extractor, probably those were supposed to be market not as current, but as raw indexes for SM2235_Current .

    Are you sure about led_dimmerScale 0.1 ? Isn't it already very dark? Maybe try led_dimmerScale 0.5
    Helpful post? Buy me a coffee.
  • #14 21768889
    emarck
    Level 6  
    Taking into account the entries for Tuya configurations that I found online for Lumary US-DS6B-1, Lumary US-GL4B-4, LSC Smart Connect 2578539.2, Spectrum LED WOJ 14412 and Nityam Smart LED Bulb Standard 4.7W G45, the raw byte values for 2235ccur and 2235wcur are not to be understood in mA but as indexes. Accordingly, the unit should be removed from the extractor's source code, and the correct setting for this lamp is SM2235_Current 1 2.

    While the addClockEvent command takes the time zone into account at sunrise and sunset, UTC is used for static events. Shouldn't this be handled consistently, as it is very confusing?

    The lamps do not respond to defined clock events – they neither start the color wheel transition when they are off, nor stop when they are playing it. This is independent of the PowerSave command. However, they operate correctly if you have the web interface of the lamps open in a tab in your web browser during the relevant times. It seems that otherwise they do not check their clock events.
    I placed three lamps at their location and monitored one via the web interface for testing purposes. I changed the monitored lamp and only the one being observed worked.
  • #15 21777926
    emarck
    Level 6  
    Three light bulbs have now been running for two weeks, and a few days ago a power plug was added to the setup. To my surprise, the power plug works reliably with the same autoexec.bat file (apart from "power 1/0" instead of "startColorWheelTransition/stopColorWheelTransition") in terms of switching on and off, as well as taking the local time into account for the ClockEvents.
    I also noticed that the light bulbs all crash at the same time and therefore often still light up synchronously even after a few hours.

    So far, I have used the following content in the autoexec.bat file to set the time:
    // Enable NTP (Network Time Protocol) driver
    startDriver ntp
    
    // Config local NTP server IP address
    //ntp_setServer 192.168.1.1 // OpenWrt
    //ntp_setServer 192.168.10.1 // LibreCMC
    ntp_setServer 192.168.178.1 // Fritz!Box
    
    // Config time zone
    //ntp_timeZoneOfs -05:00 // EST (Eastern Standard Time)
    ntp_timeZoneOfs +01:00 // CET (Central European Time)
    
    // Config location
    //ntp_setLatlong 38.895 -77.036667 // District of Columbia, United States
    ntp_setLatlong 52.518611 13.408333 // Berlin, Germany


    Now I saw that there are new commands and that DST can also be taken into account automatically. Unfortunately, however, this does not work:
    // Enable NTP (Network Time Protocol) driver
    startDriver ntp
    
    // Config local NTP server IP address
    //ntp_setServer 192.168.1.1 // OpenWrt
    //ntp_setServer 192.168.10.1 // LibreCMC
    ntp_setServer 192.168.178.1 // Fritz!Box
    
    // Config time zone
    //time_TZ -05:00 // EST (Eastern Standard Time)
    time_TZ +01:00 // CET (Central European Time)
    
    // Config daylight saving time
    //time_setDST 2 3 1 2 60 1 11 1 2 0 // District of Columbia, United States
    time_setDST 0 3 1 2 60 0 10 1 3 0 // Germany, Europe
    
    // Config location
    //time_setLatlong 38.895 -77.036667 // District of Columbia, United States
    time_setLatlong 52.518611 13.408333 // Berlin, Germany

Topic summary

The Smart Bulb GU10 5W, branded as Avatar Controls and available since November 2020 on platforms like Amazon, utilizes a BK7231N microcontroller by Beken integrated on a PCB labeled 26X32SEG21172. This RGBCW dimmable lamp, featuring the SM2235 LED driver, supports control of five multicolored LEDs plus six cool white and warm white LEDs via Wi-Fi connected to the Tuya cloud and managed through the Avatar Controls app. Firmware flashing attempts are complicated by the inability to disconnect from the original firmware, and scripting for animations may require sequential command execution in a script thread rather than backlog processing.
Summary generated by the language model.
ADVERTISEMENT