logo elektroda
logo elektroda
X
logo elektroda
Dostępna jest polska wersja

Czy wolisz polską wersję strony elektroda?

Nie, dziękuję Przekieruj mnie tam

[BK7231N/CB2L] Lumary 5/6 Inch Downlight - OpenBeken driver for KP18058esp LED controller

swpharis 6039 42

TL;DR

  • Lumary 5/6 Inch Downlight uses a BK7231N/CB2L module and a KP18058esp LED controller for an OpenBeken driver setup.
  • Accessing the internals requires removing the diffusing filter, undoing 3 screws, unplugging the ribbon cable, and gently prying off the back cover.
  • The CB2L module is soldered to the power board, and the plastic housing is very soft and brittle.
ADVERTISEMENT
📢 Listen (AI):
  • #31 20663929
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14654
    Help: 655
    Rate: 12661
    Hmm, maybe let's try with red, green and blue at full bright first. Here or in private message.

    Added after 30 [minutes]:

    I've got something from @DeDaMrAz , here's a screenshot (modified by me in paint):
    [BK7231N/CB2L] Lumary 5/6 Inch Downlight - OpenBeken driver for KP18058esp LED controller

    Added after 40 [minutes]:

    we're getting closer [BK7231N/CB2L] Lumary 5/6 Inch Downlight - OpenBeken driver for KP18058esp LED controller
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #32 20664104
    DeDaMrAz
    Level 22  
    Posts: 612
    Help: 34
    Rate: 130
    Progress :) build 1.17.189

    [BK7231N/CB2L] Lumary 5/6 Inch Downlight - OpenBeken driver for KP18058esp LED controller

    KP18058_RGBCW FF00000000 - turns light on
    KP18058_RGBCW 0000000000 - turns light off

    Added after 2 [hours] 54 [minutes]:

    @swpharis

    KP15058 is now decoded and supported in general :) pin assignment and configuration will be done in next day or two.

    If you want to test this - update to build 1.17.195 and use the following commands:

    startDriver KP18058 -> to start a driver
    KP18058_Map 0 1 2 3 4 -> to map channels where 0-4 is respectfully BGRCW
    KP18058_RGBCW FF00000000 -> meaning blue will turn on with full brightness
    KP18058_RGBCW 00FF000000 -> meaning red will turn on with full brightness
    etc...
    KP18058_RGBCW 0000000000 -> will power all LED's off

    You can try any channel with values from 00 to FF,

    The rest will follow, thank you for your patience and if you find this useful and want to contribute you can do so via this link - https://paypal.me/openshwprojects
  • #33 20664486
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14654
    Help: 655
    Rate: 12661
    Today I will add KP18058 pin roles so users can choose which GPIOs are used for communication, I will also try to address the brightness issue, it seems there is one more little thing we need to resolve..
    Helpful post? Buy me a coffee.
  • #34 20665364
    DeDaMrAz
    Level 22  
    Posts: 612
    Help: 34
    Rate: 130
    Ok driver implementation is almost 100% done.

    [BK7231N/CB2L] Lumary 5/6 Inch Downlight - OpenBeken driver for KP18058esp LED controller

    The only thing to play around is the KP18058_Map 2 0 1 3 4 (20134 -> RGBWC - this should be a default mapping but may change from device to device) that can be added to autoexec file and you can enable Flag 18 for smooth transition.

    All this is ready with latest build - 1.17.199

    The only thing left is pin assignment @p.kaczmarek2 said soon and this chip is 100% supported now.

    @swpharis please test on your device and report back, thanks.
  • ADVERTISEMENT
  • #35 20665521
    swpharis
    Level 5  
    Posts: 18
    Help: 1
    Rate: 8
    DeDaMrAz wrote:
    Ok driver implementation is almost 100% done.

    [BK7231N/CB2L] Lumary 5/6 Inch Downlight - OpenBeken driver for KP18058esp LED controller

    The only thing to play around is the KP18058_Map 2 0 1 3 4 (20134 -> RGBWC - this should be a default mapping but may change from device to device) that can be added to autoexec file and you can enable Flag 18 for smooth transition.

    All this is ready with latest build - 1.17.199

    The only thing left is pin assignment @p.kaczmarek2 said soon and this chip is 100% supported now.

    @swpharis please test on your device and report back, thanks.

    Running 1.17.199 - The driver loads OK. Driver commands return OK. How can I define pin assignment to test fully?
  • #36 20665523
    DeDaMrAz
    Level 22  
    Posts: 612
    Help: 34
    Rate: 130
    Since your light is the same you can create autoexec.bat file and enter following commands:

    startDriver KP18058
    KP18058_Map 2 0 1 3 4


    and test, pin assignment will be complete in the next build.

    EDIT: pin assignments is currently hardcoded so P8 -> SDA and P7 -> SCL
  • ADVERTISEMENT
  • #37 20665537
    swpharis
    Level 5  
    Posts: 18
    Help: 1
    Rate: 8
    It is working perfectly on my setup. Thanks for the efforts in this. I'll be supporting the project shortly.
  • #38 20665538
    DeDaMrAz
    Level 22  
    Posts: 612
    Help: 34
    Rate: 130
    Glad to hear that :) and happy to see it working on your setup as well.

    Feel free to reach out if you find any other interesting device that OBK is not supporting - yet :) or have any questions about this project.
  • #39 20666810
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14654
    Help: 655
    Rate: 12661
    Thank you for the cooperation, I have pushed the KP18058 pin roles selection support.
    [BK7231N/CB2L] Lumary 5/6 Inch Downlight - OpenBeken driver for KP18058esp LED controller
    It should be available in the next release.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #40 20680104
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14654
    Help: 655
    Rate: 12661
    Template:
    Code: JSON
    Log in, to see the code
    Helpful post? Buy me a coffee.
  • #41 21434384
    WingmanNZ
    Level 3  
    Posts: 5
    >>20665538 Hi @DeDaMrAz I was wondering if you have come across any users that have the cool white (C) in RGBCW not working at the correct brightness level? The behaviour I see is that the cool white channel does not work to the same brightness level as the warm white.

    Device configuration, as extracted from Tuya:
    - KP18058DAT on P8
    - KP18058CLK on P7
    - LED remap is 1 2 0 4 3
    Device seems to be using CB2L module, which is using BK7231N.
    And the Tuya section starts at UNCOMMON POSITION 0


    When I set the Light to 100% cool white the light emits a very low glow (as if it is at 2% brightness). If I power off the lamp and then power it back on, it returns to full cool white brightness. So it seems perhaps there is something I am missing.

    Any ideas?
  • #42 21434388
    DeDaMrAz
    Level 22  
    Posts: 612
    Help: 34
    Rate: 130
    Try with this command

    Quote:
    KP18058_Current 14 30


    That should be the default value (14mA), try with that and play around with that value - but be warned your led's may burn easily!!
  • #43 21434389
    insmod
    Level 31  
    Posts: 1408
    Help: 164
    Rate: 443
    >>21434388 It should be KP18058_Current 14 30, where 14 is for RGB and 30 for CW. Allowed values are from 0 to 31. But, since 30 is default value for CW, and 31 is max, i don't know if it would help.
📢 Listen (AI):

Topic summary

✨ The discussion focuses on the Lumary 5/6 Inch Downlight using the CB2L module with a BK7231N chip and a KP18058esp LED driver IC. Initial hardware disassembly steps include removing the diffusing filter, screws, and unplugging the ribbon cable to access the soldered CB2L module. The KP18058esp is identified as a five-channel I2C-like LED driver supporting 1024 grayscale levels per channel, controlling RGB and CW LEDs. Attempts to dump firmware and extract Tuya configuration faced challenges due to varying module revisions and firmware versions. The KP18058 protocol was unknown initially, with no existing OpenBeken support, but similarities to drivers like SM2135 and BP5758 were explored. Pin assignments for SDA and SCL lines were identified (P8 and P7 respectively), and a driver implementation was developed and integrated into OpenBeken firmware builds (from version 1.17.189 onwards). Commands such as startDriver KP18058, KP18058_Map for channel mapping, and KP18058_RGBCW for LED control were introduced. Testing confirmed functional control of RGB and CW channels, with ongoing refinements including pin role selection and brightness calibration. The power board schematic reveals a typical Tuya IoT device design with a non-isolated step-down converter and minimal input filtering. Users reported a brightness discrepancy in the cool white channel, likely adjustable via KP18058_Current command parameters. The device is available on Amazon with different listings and hardware revisions, complicating uniform support. The project is open for community testing and contributions.

FAQ

TL;DR: This FAQ gives OpenBeken users 15 answers and the expert warning "SHOCK HAZARD" for flashing Lumary 5/6 Inch Downlights with CB2L, BK7231N, and KP18058ESP, solving disassembly, UART flashing, pin roles, channel mapping, and dim cool-white issues. [#20659312] Why it matters: The same Lumary-looking downlight can contain CB2L, WB2L, or TYWE2S hardware, so correct identification prevents failed flashing and unsafe probing.

Variant discussed Module Chip family LED control OpenBeken outcome
Lumary US-DL6A-4 4-pack CB2L BK7231N KP18058ESP, DAT P8, CLK P7 Supported with KP18058 roles
Single-pack September 2021 unit WB2L BK7231T Same configuration values Flashed OTA by firmware selection
Received test unit TYWE2S ESP-based Tuya module No KP LED controller Not the target KP18058 board

Key insight: Treat each Lumary 5/6 inch downlight as a board-specific device. Open it, identify the module and LED driver, then apply KP18058_DAT on P8 and KP18058_CLK on P7 only when the KP18058ESP board is present.

Quick Facts

  • The working KP18058ESP Lumary template uses BK7231N, CB2L, flags 1024, GPIO7 as KP18058_CLK, and GPIO8 as KP18058_DAT. [#20680104]
  • UART testing reported read at 115200 baud and write at 921600 baud; other rates failed on that setup. [#20635729]
  • The extracted KP18058 Tuya configuration used iicsda: 8, iicscl: 7, brightmin: 5, brightmax: 100, and cwmaxp: 100. [#20635729]
  • The early PWM-only CB2L board mapped RGB and white channels as green P24, cool P8, blue P6, warm P7, and red P26. [#20630634]
  • KP18058 current control accepts values from 0 to 31; KP18058_Current 14 30 sets RGB to 14 and CW to 30. [#21434389]

How do I disassemble a Lumary 5/6 inch downlight to access the CB2L module and LED driver board?

Remove the diffuser, undo 3 screws, unplug the ribbon cable, then pry off the back cover carefully.
  1. Remove the diffusing filter.
  2. Undo the 3 screws and disconnect the LED-board ribbon cable.
  3. Use a small flat tool on the back cover, because the plastic is soft and brittle. The CB2L module sits soldered to the power board. [#20625124]

What is the CB2L module in a Lumary downlight, and how is it related to the BK7231N chip?

CB2L is the soldered Wi-Fi module used on several Lumary downlight revisions. "CB2L is a Tuya-style wireless module that provides Wi-Fi control for the light, using the BK7231N chip as its main microcontroller." The extracted device configuration explicitly reported CB2L and BK7231N together. [#20630634]

What is the KP18058ESP LED controller, and why does OpenBeken need a specific driver for it?

KP18058ESP is a five-channel LED controller that needs its own OpenBeken protocol driver. "KP18058ESP is an I2C-like RGBCW LED driver chip that controls five LED channels over SDA and SCL, using a protocol not handled by SM2135, BP5758, SM2235, or BP1658CJ." OpenBeken initially lacked support, so developers decoded the two-wire protocol. [#20635653]

How can I dump the flash from a BK7231N or CB2L device on macOS if the BK GUI Flash tool crashes under Mono?

Use Python hid_download_py, or run the BK GUI Flash tool in a virtual machine. The Mono build failed on macOS because System.Windows.Forms.dll used a Carbon driver not ported to 64-bit. A forum video showed similar CB2S dumping, and Python was reported working. [#20630634]

What UART pins and flashing speeds worked for reading and writing the Lumary CB2L downlight firmware?

Power the extension pins, then connect TX, RX, and CEN on the board back. Ground CEN to the large ground pad when needed. The successful setup read firmware at 115200 baud and wrote firmware at 921600 baud. Other baud rates failed on the third KP18058 board revision. [#20635729]

Which OpenBeken pin roles should I use for the Lumary 5/6 inch downlight with KP18058ESP on BK7231N?

Use KP18058_CLK on GPIO7 and KP18058_DAT on GPIO8 for the documented Lumary US-DL6A-4 template. The template identifies the device as Lumary 5/6 Inch Downlight, model US-DL6A-4, chip BK7231N, and board CB2L. It also tags the device as KP18058ESP and 110V. [#20680104]

How should I configure KP18058_DAT and KP18058_CLK in OpenBeken for the Lumary US-DL6A-4 downlight?

Assign GPIO8 to KP18058_DAT and GPIO7 to KP18058_CLK in the OpenBeken pin configuration. Earlier testing hardcoded P8 as SDA and P7 as SCL, then later builds added selectable KP18058 pin roles. The published template uses exactly those two roles for US-DL6A-4. [#20680104]

What does the OpenBeken command KP18058_Map 2 0 1 3 4 do for RGB, warm white, and cool white channel mapping?

KP18058_Map 2 0 1 3 4 remaps KP18058 physical channels to the desired RGBWC order. The developer described 20134 as RGBWC and suggested adding it to autoexec.bat. On the confirmed Lumary setup, startDriver KP18058 plus KP18058_Map 2 0 1 3 4 made the light work correctly. [#20665364]

Why did SM2135, BP5758, SM2235, and BP1658CJ drivers not work with the KP18058ESP LED controller?

Those drivers failed because KP18058ESP used a different two-wire command protocol. The existing OpenBeken drivers were worth testing because their chips also use SDA and SCL. Testing found the three available drivers did not work, so developers captured and decoded KP18058 traffic instead. [#20635765]

KP18058ESP vs BP5758 vs SM2135: how do these I2C-like LED driver chips differ for RGBCW lights?

KP18058ESP, BP5758, and SM2135 all use two digital lines, but they do not guarantee protocol compatibility. KP18058ESP controlled five RGBCW channels in this Lumary board through DAT on P8 and CLK on P7. BP5758 looked similar enough to test, yet it still failed before native KP18058 support arrived. [#20661196]

Why do different Lumary downlights from similar Amazon listings contain different modules like CB2L, WB2L, or TYWE2S?

Lumary shipped similar-looking downlights with different internal revisions and modules. One single-pack unit used WB2L with newer 2.3.x Tuya firmware, while other units used CB2L. A later received light had TYWE2S and no KP LED controller, proving listing appearance did not guarantee the same board. [#20644531]

What should I do if Tuya config extraction fails with a magic constant header not found error on a Lumary downlight backup?

Treat the device as a different revision and inspect the board manually. One August 2022 CB2L board produced magic constant header not found and no Tuya config from a 2 MB backup. The user then identified SDA/SCL board markings and confirmed a KP18058ESP chip by opening the light. [#20634833]

How can I troubleshoot a Lumary KP18058 downlight where the cool white channel is much dimmer than warm white in OpenBeken?

Check the LED remap and then test KP18058 current settings. The reported faulty case used KP18058DAT on P8, KP18058CLK on P7, and remap 1 2 0 4 3. Cool white glowed near 2% at 100%, then returned bright after power cycling, suggesting configuration or current handling needed testing. [#21434384]

What does the KP18058_Current 14 30 command control, and what current values are safe for RGB and CW LEDs?

KP18058_Current 14 30 sets RGB current to 14 and CW current to 30. Allowed values run from 0 to 31, with 30 described as the default CW value and 31 as maximum. Use caution, because raising current can burn LEDs. [#21434389]

What safety risks should I know about when opening or probing the Lumary 110V downlight power board with a non-isolated LED supply?

The Lumary power board can expose dangerous mains-related LED circuitry while opened. The drawn schematic warning said there was no input-side LED regulation and marked it as a shock hazard. The same discussion identified the device as 110–120V only and criticized the low-cost non-isolated design. [#20659432]
ADVERTISEMENT