Elektroda.com
Elektroda.com
X

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

swpharis 1443 39
  • Remove diffusing filter.
    Undo 3 screws.
    Unplug ribbon cable from LED board.
    Gently pry off back cover with small flat tool. Plastic is very soft/brittle.
    CB2L module is soldered to power board.

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

    Cool? Ranking DIY
    About Author
    swpharis
    Level 5  
    Offline 
    swpharis wrote 17 posts with rating 8, helped 1 times. Been with us since 2023 year.
  • #2
    p.kaczmarek2
    Moderator Smart Home

    I haven't seen such mounting of CB2L module yet. Do you have a configuration for this device? Or maybe at least a flash dump, so I can extract GPIOs?
  • #3
    swpharis
    Level 5  
    Best way to dump flash on OSX? I was able to build the BK GUI Flash tool in mono with errors, but it crashes when launched.
  • #4
    p.kaczmarek2
    Moderator Smart Home

    I don't know this system much. Maybe Python's hid_download_py can work. You can see CB2S (very similar to CB2L) dumping in this video:
    https://www.youtube.com/watch?v=PKkiqDNFIx8
  • #5
    swpharis
    Level 5  
    Python does work - someone posted earlier - https://www.elektroda.com/rtvforum/topic3984791.html

    Issue was with forms.
    System.Windows.Forms.dll
    "The Carbon driver has not been ported to 64bits, and very few parts of Windows.Forms will work properly, or at all"

    Was able to get the app working in VM.

    Continuing breakdown and UART flashing -
    Wire up power to extension pins and grab TX, RX, and CEN off the back of the board.

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

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

    CEN can be grounded to the large ground pad on the board.

    Below is the dump information:
    Device configuration, as extracted from Tuya:
    - LED Green (Channel 2) on P24
    - LED Cool (Channel 4) on P8
    - LED Blue (Channel 3) on P6
    - LED Warm (Channel 5) on P7
    - LED Red (Channel 1) on P26
    Device seems to be using CB2L module, which is using BK7231N.
    And the Tuya section starts, as usual, at 2023424

    And JSON:
    Code: json
    Log in, to see the code
  • #6
    swpharis
    Level 5  

    Just got a single pack of one of these and it uses a different module. There isn't consistency. Configuration values are the same. Module firmware from Lumary before flashing was 2.3.x in the Tuya app.

    Selected by firmware and it flashed OTA like normal.
  • #8
    swpharis
    Level 5  
    p.kaczmarek2 wrote:
    Can you post Tuya Config? So you got BK7231T version that time?
    [BK7231N/CB2L] Lumary 5/6 Inch Downlight - OpenBeken driver for KP18058esp LED controller

    Already flashed it. Yes it was WB2L with newer firmware.

    Manufacturer date was sept. 21. Manf date on others was Dec. 21

    Added after 1 [hours] 29 [minutes]:

    Plot thickens. Manf date 2022, Aug. Completely new revision of the board. Could not configure the pins the same. Light wouldn't work. Opened it to see what was going on.

    Module CB2L

    Had to cut the board to expose the back of the module for the pins.

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

    And cannot find tuya config

    Backup 2MB created, now will attempt to extract Tuya config.
    Failed to extract Tuya keys - magic constant header not found in binary
    Sorry, failed to find Tuya Config in backup binary.

    Bin attached
  • #9
    p.kaczmarek2
    Moderator Smart Home
    There are PWM-SDA and PWM-SCL markings on the board. This indicates a "I2C-like" LED driver such as BP5758, SM2135, etc. Please see where are the SDA/SCL signals going. What is the name of the chip? It should be in SOIC8 case or similiar.
  • #10
    swpharis
    Level 5  
    It’s a KP18058esp.

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

    Added after 1 [hours] 45 [minutes]:

    Pinned it out.

    [BK7231N/CB2L] Lumary 5/6 Inch Downlight - OpenBeken driver for KP18058esp LED controller
  • #12
    swpharis
    Level 5  
    Can you explain more what you are asking please?
  • #13
    p.kaczmarek2
    Moderator Smart Home
    KP18058 looks like one of those "I2C-like" LED driver chips, where only two digital lines (SDA and SCL) are used to control 5 channels of LEDs. The problem is, KP18058 doesn't seem to be well known. There are only few google results for that. It seems it has a product page here:
    http://www.kiwiinst.com/productinfo/1248723.html
    [BK7231N/CB2L] Lumary 5/6 Inch Downlight - OpenBeken driver for KP18058esp LED controller
    It seems that only full datasheet is available per request:
    http://www.kiwiinst.com/productinfo/1248723.html

    That basically means we don't have KP18058 support in OpenBeken and currently don't know how to add it.

    But, maybe, it has the same protocol as SM2135, or BP5758, SM2235, or BP1658CJ:
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/drivers.md
    So I've been thinking maybe you can try to check if any of those drivers are working for your chip. For SM2135, set the two pin roles in config module, then reboot your device, and check if RGB control works. Do the same for other LED drivers.

    If KP18058 is indeed a separate chip with yet another protocol ,then we need to either get the datasheet or two wire communication capture sample for analysis, so I can write a driver for that.

    Can you provide more information where was your device bought?
  • #14
    swpharis
    Level 5  
    More info on this setup - (third revision with SDA). I had a wiring issue in original read.
    Read @ 115200
    Write @ 921600
    Other rates fail.

    I corrected and the results of read are below:
    Code: json
    Log in, to see the code


    Device configuration, as extracted from Tuya:
    - UnknownDAT on P8
    - UnknownCLK on P7
    - LED remap is 1 2 0 3 4
    Device seems to be using CB2L module, which is using BK7231N.
    And the Tuya section starts, as usual, at 2023424
  • #15
    p.kaczmarek2
    Moderator Smart Home
    Thanks, this is also helpful, but we still need an insight into the two wire protocol of that device.

    Can you tell us where it was bought?

    I've spoken to @DeDaMrAz and he seems to be eager to buy one piece just to hook up logic analyzer to it and check the protocol.
  • #16
    swpharis
    Level 5  
    p.kaczmarek2 wrote:
    Thanks, this is also helpful, but we still need an insight into the two wire protocol of that device.

    Can you tell us where it was bought?

    I've spoken to @DeDaMrAz and he seems to be eager to buy one piece just to hook up logic analyzer to it and check the protocol.


    Amazon
    https://www.amazon.com/gp/product/B09Y5RPSF4/ref=ppx_yo_dt_b_asin_title_o09_s00?ie=UTF8&psc=1

    Be aware there are different listings for what seem to be the same light. This listing is the one with the SDA board.

    The single one 6" is here:
    https://www.amazon.com/gp/product/B0BB17CR86/ref=ppx_yo_dt_b_asin_title_o09_s00?ie=UTF8&th=1

    Notice the hard bend in the bracket.

    Added after 11 [minutes]:

    p.kaczmarek2 wrote:
    But, maybe, it has the same protocol as SM2135, or BP5758, SM2235, or BP1658CJ:
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/drivers.md
    So I've been thinking maybe you can try to check if any of those drivers are working for your chip. For SM2135, set the two pin roles in config module, then reboot your device, and check if RGB control works. Do the same for other LED drivers.

    I have tried the three available drivers and none work. If I can assist let me know. I do not have a spectrum analyzer.
  • #18
    p.kaczmarek2
    Moderator Smart Home
    Please stand by @swpharis , we will need your help with testing once @DeDaMrAz does packets capture. I wonder how the protocol looks like. Some such LED drivers are using 8 bits per channel, giving us 256 possible options per color, but others are also 10-bit (1024 options per color).
  • #19
    swpharis
    Level 5  
    p.kaczmarek2 wrote:
    10-bit (1024 options per color)
    I think it's going to be 1024

    Google translated from Chinese.:
    KP18058 is a high-precision five-channel full-pressure LED linear constant current moderation chip, which can be independently set by the I2C (Inter-Integrated-Circuit Bus) interface 5 street currents to support various modes of light adjustment. The CW channel is an analog light-tuning method. The RGB channel supports analog lighting and chopping wave lighting, while supporting 1024 gray-order lighting per road to meet the lighting needs in various settings.
  • #20
    DeDaMrAz
    Level 13  
    I received one light type but unfortunately it has TYWE2S module and no KP LED controller :/ awaiting for the other one to arrive.
  • #21
    swpharis
    Level 5  
    I can mail you one of mine.
  • #23
    DeDaMrAz
    Level 13  
    It finally arrived!! Can confirm CB2L module inside and that KP18058ESP driver IC is inside. It will take some time to get to it and figure out the protocol but now we can at least work on this :)

    Looking forward to figuring this out - just reporting some progress, please be patient.

    [BK7231N/CB2L] Lumary 5/6 Inch Downlight - OpenBeken driver for KP18058esp LED controller
  • #24
    swpharis
    Level 5  
    Great news!

    I have 4 of these waiting to be tested and installed.
  • #25
    DeDaMrAz
    Level 13  
    @swpharis Have you tried with BP5758 driver maybe?

    Open your webapp and go to config and set up those pins as in the picture and report back please.

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

    EDIT: ignore the channels setup, they all may be set to 0

    Added after 2 [hours] 27 [minutes]:

    This is the power board schematics.

    CAUTION!!! - no regulation on input side for LED's whatsoever!!! SHOCK HAZARD!!!


    [BK7231N/CB2L] Lumary 5/6 Inch Downlight - OpenBeken driver for KP18058esp LED controller
  • #26
    p.kaczmarek2
    Moderator Smart Home
    Very good job with drawing the schematic, @DeDaMrAz . It looks like a classic Tuya IoT device circuit, though.
    A fusible resistor at the input, sadly (as often) without a varistor, not much interference filters except their classic "inductor between two 400V caps" filter, then a step down (non isolated) converter (again, usual, I have never seen Tuya product with capacitive dropper, it seems those droppers are less and less used), and finally, CB2S with I2C lines (with pull up resistors) connected to the "I2C" LED controller.

    Hmm C5 is for 200V while C2 and C1 are for 400V?
  • #27
    DeDaMrAz
    Level 13  
    p.kaczmarek2 wrote:
    Hmm C5 is for 200V while C2 and C1 are for 400V?


    My best guess is because this is a 110-120V ONLY device that is why 200V but bad design overall, regardless of it being a "classic" and low cost I don't like it at all.
  • #28
    swpharis
    Level 5  
    Were you able to get it to work with the BP5758 driver? I am not able to get it to function. Maybe I am doing something wrong? [BK7231N/CB2L] Lumary 5/6 Inch Downlight - OpenBeken driver for KP18058esp LED controller
  • #29
    DeDaMrAz
    Level 13  
    swpharis wrote:
    Were you able to get it to work with the BP5758 driver? I am not able to get it to function. Maybe I am doing something wrong? [BK7231N/CB2L] Lumary 5/6 Inch Downlight - OpenBeken driver for KP18058esp LED controller


    It was just a thought, because they looked very, very similar. Thanks for trying but unfortunately you will have to wait for the protocol to be decoded - we will try probably this weekend.
  • #30
    DeDaMrAz
    Level 13  
    We are on it, figuring out the commands and comparing it to known ones will be a process but we are on it now :)


    Power on via Tuya smart APP:

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

    Power off via the app:

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