logo elektroda
logo elektroda
X
logo elektroda

[W600 Chip] Configuring PWM for RGBCCT Lightbulb LED Channel Brightness Control

DanteBC 798 14
ADVERTISEMENT
  • #1 20884210
    DanteBC
    Level 4  

    Disassembled and successfully flashed an openbeken firmware for my lightbulb based on a W600 chip.

    By trial-and-error method, I managed to figure out five pins that are used for LED channels:
    red - pa5
    green - pb13
    blue - pb15
    WW - pb8
    CW - pb16

    I can activate those via LED pin mode just fine, but I feel like I need a PWM mode to actually control channel brightness. But it looks like I can only enable PWM mode on pins pb14-18. Maybe I need to use some other pin mode I'm missing. As far as I understand, there is no LED controller in this lightbulb because channels are controlled directly. Can anyone help me with this?
  • ADVERTISEMENT
  • #2 20884432
    p.kaczmarek2
    Moderator Smart Home
    It seems that not yet all PWM pins are enabled in hal_pins_w800.c, which is also used for W600:
    Code: C / C++
    Log in, to see the code


    I can try to enable remaining pins for you, would you be able to test new build once it's ready? I don't have W600 at hand, so it might take several attempts to get it right.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #3 20884444
    DanteBC
    Level 4  

    p.kaczmarek2 wrote:
    I can try to enable remaining pins for you, would you be able to test new build once it's ready? I don't have W600 at hand, so it might take several attempts to get it right.


    Sure. Let's try it. I prefer using OTA, so I don't have to desolder the chip again.
  • #4 20884639
    p.kaczmarek2
    Moderator Smart Home
    
    red - pa5
    green - pb13
    blue - pb15
    WW - pb8
    CW - pb16
    

    According to datasheet, PA5 is PWM_1, PB13 is PWM_2, PB15 is PWM_4, PCB8 is PWM_5 and PB16 is PWM_3 , so it should work.
    Can you download build files from this pull request (find "download build artifacts, unpack zip"), do OTA, and recheck?
    https://github.com/openshwprojects/OpenBK7231T_App/pull/1015
    Helpful post? Buy me a coffee.
  • #5 20884691
    DanteBC
    Level 4  

    As far as I see all Wxxx images are failed to build, therefore there are no images of them inside the artifacts zip. Can you check please?
  • #6 20884697
    p.kaczmarek2
    Moderator Smart Home
    Sorry, there must be some typo or something, I am helping now in about 4 threads and I am doing it in "round robin" manner, I haven't noticed it failing.
    Oh yes, it's a typo:
    Screenshot of a compilation error message indicating a typo in the code.
    I have put a dot instead of a comma. Let me fix this... and then try.

    Added after 1 [minutes]:

    When you test it, please test two things:
    - are the PWMs that worked before STILL working?
    - are new PWMs working?
    Please REBOOT between every try, just to be sure... later check without reboots. Again, I don't have this device, so I need your help with testing.

    Added after 9 [minutes]:

    EDIT: One more fix added
    Helpful post? Buy me a coffee.
  • #7 20884731
    DanteBC
    Level 4  

    While it builds, I've noticed that PWM works a bit strangely. It never fully turns the channel off. Even on 0 or toggle off, it still glows slightly.

    Gonna check the new build now. Thank you for your time. I appreciate your help so much.
  • ADVERTISEMENT
  • #8 20884734
    p.kaczmarek2
    Moderator Smart Home
    If you have time to test more, we can also fix this next issue as well. Maybe we need to turn off PWM entirely or smth.
    Helpful post? Buy me a coffee.
  • #9 20884736
    DanteBC
    Level 4  
    Sure thing. As long as you have time.

    Added after 13 [minutes]:

    Tested all 5 PWM channels separately and they all work well. Except for the not turning off part.
    One more question, how should I properly number the channels?
  • Helpful post
    #10 20884764
    p.kaczmarek2
    Moderator Smart Home
    That W600 build has finally succeeded, it seems. It should be ready for testing.
    Helpful post? Buy me a coffee.
  • #11 20884822
    DanteBC
    Level 4  

    Tested all 5 PWM channels separately and they all work well.
    Figured out the proper channel numbers too, so now I can set brightness, temperature, and color.
    Everything works, except for the not turning off part.
  • Helpful post
    #12 20884872
    p.kaczmarek2
    Moderator Smart Home
    Very well, it went easier than expected. Let me merge this branch and now let's look into the second issue.

    Still, I am suprised that the code below does not work:
    Code: C / C++
    Log in, to see the code

    Let's try to insert a conditional pwm_stop here (if value is 0):
    https://github.com/openshwprojects/OpenBK7231T_App/pull/1016
    Again, wait for the build to finish and check, also watch for flickering when adjusting PWM value (I am not sure if this platform likes repeated start calls)
    Helpful post? Buy me a coffee.
  • #13 20884900
    DanteBC
    Level 4  

    Tested the new build and now everything works as it should! Channels work exactly as they should and 0 PWM actually turns off the channel. Color channels do not interfere with each other either. Thank you so much for your work!
  • #14 20884917
    p.kaczmarek2
    Moderator Smart Home
    You're welcome, and now.. once you have this bulb fully working, can you tell me whether it's present on our list?
    https://openbekeniot.github.io/webapp/devicesList.html
    If not, consider posting a short teardown/guide (maybe some photos or marking from package, info where it was bought, etc...)
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #15 20884951
    DanteBC
    Level 4  

    It's not present there. I'll make a few pictures of the insides, while it's in the disassembled state, and a few assembled too. I don't have the packaging as it was bought quite a while ago. But I'll provide as much info as I can.

Topic summary

The discussion revolves around configuring PWM for an RGBCCT lightbulb utilizing a W600 chip after flashing it with openbeken firmware. The user identified the pins for the LED channels and sought assistance in enabling PWM mode for brightness control. Responses indicated that not all PWM pins were enabled in the firmware, and a collaborative effort ensued to modify the code. After several iterations, the PWM channels were successfully tested, resolving issues with channel brightness control and ensuring that a PWM value of 0 effectively turned off the channels. The user also agreed to document the lightbulb for inclusion in a device list.
Summary generated by the language model.
ADVERTISEMENT