logo elektroda
logo elektroda
X
logo elektroda

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

emarck 39 0
ADVERTISEMENT
  • #1 21755069
    emarck
    Level 5  
    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.

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

    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).

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


    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
ADVERTISEMENT