logo elektroda
logo elektroda
X
logo elektroda

[BK7231N] LVWIT B22 Bayonet WiFi LED Bulb,1521Lm,Tuya Smart Bulb B22 ,12W (Amazon.co.uk)

djbenson 2016 11
ADVERTISEMENT
  • #1 20395170
    djbenson
    Level 3  
    Hi all

    I recently purchased a pack of LVWIT branded B22 bulbs from Amazon UK. I knew I was risking them not being compatible with Tasmota (the older devices were so it's a gamble) and they turned out not to be.

    I have successfully, after a lot of trial and error, managed to flash all the bulbs with OpenBeken and, using the Aubess WiFi Smart LED Light Bulb 15W E27 RGBCW profile managed to get some basic functions of the light to work (it will switch on and off but the colour mapping isn't right).

    I'm a total newbie to this but I have looked at the forums, GitHub and Reddit and can't find the answer to my question - how do you go about working out the pin mapping? Is it necessary to open one of the bulbs or can it be achieved with trial and error? I've tried opening one of the bulbs but they are very well glued.

    [BK7231N] LVWIT B22 Bayonet WiFi LED Bulb,1521Lm,Tuya Smart Bulb B22 ,12W (Amazon.co.uk)

    Product Link: https://www.amazon.co.uk/dp/B083DNGQKD
  • ADVERTISEMENT
  • Helpful post
    #2 20395408
    p.kaczmarek2
    Moderator Smart Home
    Hello @djbenson
    There are two ways to determine bulb pin mapping.
    If your device is using PWM function to control RGBCW channels, then you can just try guessing - there is not many options, as there is only 6 PWM pins in BK7231:
    SymbolI/O typeFunction
    PWM5I/OGPIOP_26, which is connected to the P26 pin on the internal IC
    PWM4I/OGPIOP_24, common GPIO, which is connected to the P24 pin on the internal IC
    PWM0I/OGPIOP_6, which is connected to the P6 pin on the internal IC
    PWM1I/OGPIOP_7, which is connected to the P7 pin on the internal IC
    PWM3I/OGPIOP_9, common GPIO, which is connected to the P9 pin on the internal IC
    PWM2I/OGPIOP_8, which is connected to the P8 pin on the internal IC


    If your device is using a "I2C" driver like SM2135, SM2235, BP1658, BP5758, then it's harder, as any two arbitrary IOs can be used....

    You can find out what driver is your LED using usually just by taking off the dome and looking at the PCB.

    You can always try matching templates from here:
    https://openbekeniot.github.io/webapp/devicesList.html
    This list is available also from within OBK firmware.
    Helpful post? Buy me a coffee.
  • #3 20395596
    djbenson
    Level 3  
    Thanks.

    I've no idea whether it's PWM or not, but does the fact that I've used another bulb profile which maps PWM and it kinda works suggest this is a PWM bulb?

    Is there any benefit to opening one of the bulbs? Will it give me any answers or is the time best spent using trial and error with the PWM mapping?

    I'm on a different laptop to last night but the profile I used resulted in something like this when I used the webapp;

    PWM-Red: Worked, dimming worked, the brightness seems quite poor but this could be standard for this bulb
    PWM-Green: Mapped to warm white, dimming worked
    PWM-Blue: Does nothing
    PWM-Cool White: Mapped to blue, dimming worked, the brightness seems quite poor but this could be standard for this bulb
    PWM-Warm White: Mapped to green, dimming worked, the brightness seems quite poor but this could be standard for this bulb

    This is the mapping from the previously mentioned bulb profile;
    [BK7231N] LVWIT B22 Bayonet WiFi LED Bulb,1521Lm,Tuya Smart Bulb B22 ,12W (Amazon.co.uk)
  • ADVERTISEMENT
  • Helpful post
    #4 20395651
    p.kaczmarek2
    Moderator Smart Home
    Good job, so it's PWM. Please rearrange the channel indices so Red is 1, Green is 2, Blue is 3, Cool is 4, Warm is 5.

    As I have already mentioned, there are 6 possible PWM pins on BK7231 devices.
    If you already know that in your case PWM-Blue (P6?) does nothing, then by the process of elimination (your screenshots shows PWMs on 6, 7, 8, 24 and 26), there is a fair chance that missing PWM is on P9:
    Quote:

    PWM3 I/O GPIOP_9, common GPIO, which is connected to the P9 pin on the internal IC

    Remember to unset PWM role for old pin (P6 in your case?) while setting a new PWM role for pin you want to check (P9, I think?).
    Helpful post? Buy me a coffee.
  • #5 20395736
    djbenson
    Level 3  
    I'm so close to getting this right but cannot get warm white and cold white to work independently.

    The working mapping so far is;

    [BK7231N] LVWIT B22 Bayonet WiFi LED Bulb,1521Lm,Tuya Smart Bulb B22 ,12W (Amazon.co.uk)

    Working:

    Red
    Green
    Blue
    Warm White

    Not Working:

    Cold White

    No matter what value I put in 6 or 9 it doesn't respond.
  • Helpful post
    #6 20395785
    p.kaczmarek2
    Moderator Smart Home
    @djbenson , this could mean one thing.

    Your bulb might be using a simple PWM controls for RGB, but for CW, it's using alternate control mode.
    Please select this flag:
    [BK7231N] LVWIT B22 Bayonet WiFi LED Bulb,1521Lm,Tuya Smart Bulb B22 ,12W (Amazon.co.uk)
    By default, in CW (CCT) mode, you have two channels (two PWMs) - first PWM controls brightness of Cool LEDs, second of Warm LEDs.
    In alternate mode, the PWM roles are different - first PWM controls brightness, and second one controls temperature.
    It may be possible that your device is using that type of control.

    Please set that flag and try again, with both old PWM pin and new PWM pin.

    Futhermore, it's possible that you will be still getting inverted results. In this case, there are two things to do:
    1. swap pwm channel fourth and fifth (fourth in alternate mode controls brightness, fifth controls temperature)
    2. change one of PWM roles to PWM_n - this is needed, when, for example, you get inverted Cool and Warm values.

    Considering there are 6 available PWMs and you already got 4 correctly, there are not many options to choose from. You should be able to figure it out quickly.

    This may seem counterintuitive, but if your device is using that "alternate PWM mode", then in Raw PWMs [Debug] mode, one slider will control brightness and second temperature of CCT lighting.

    Dodano po 2 [minuty]:

    djbenson wrote:

    No matter what value I put in 6 or 9 it doesn't respond.

    I think it DOES respond, but you just don't see it - because 6 or 9 might be an alternate pin that controls the temperature that can be dimmed by pin 7 on your screenshot, I guess.
    I think that you might realize quickly that if you set PWM to 100% on 6 (or on 9) your PWM on pin 7 starts to control the brightness of not warm, but now cool channel.
    That's what I described above - alternate CW control.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #7 20395917
    djbenson
    Level 3  
    Bingo!! We got it! :)

    Thank you so much for the help - I think this is a fully functional config now;

    Pin Assignment:

    6 PWM_n 4
    7 PWM 5
    8 PWM 1
    24 PWM 2
    26 PWM 3

    Flags:

    Flag 8 - [LED] Alternate CW light mode (first PWM for warm/cold slider, second for brightness)

    Added after 6 [minutes]:

    A couple more questions if I may;

    1) How do I get this device into the device database so that others can use these bulbs? I also have more to set up so can test that they work when configured via the webapp

    2) Is there any way to set a startup behavior template? In our house I am training people not to touch physical light switches unless there is an issue in which case power cycling the device should result in it coming on full brightness/cold white - I have my Zigbee bulbs configured this way using the "Startup Behavior" settings in Home Assistant. I know you can configure the "last known state" as a behavior but any way to have a default like I describe?

    3) Should changes on the main page of the switch, the webapp and Home Assistant track each other? Ultimately the bulb will only ever be controlled by HA but it would be nice if they kept in sync.
  • #8 20395993
    p.kaczmarek2
    Moderator Smart Home
    djbenson wrote:

    1) How do I get this device into the device database so that others can use these bulbs? I also have more to set up so can test that they work when configured via the webapp

    If you can, do a pull request here:
    https://github.com/OpenBekenIOT/webapp/blob/gh-pages/devices.json
    If not, I will do it myself soon.

    djbenson wrote:

    2) Is there any way to set a startup behaviour template? In our house I am training people not to touch physical light switches unless there is an issue in which case power cycling the device should result in it coming on full brightness/cold white - I have my Zigbee bulbs configured this way using the "Startup Behaviour" settings in Home Assistant. I know you can configure the "last known state" as a behaviour but any way to have a default like I describe?

    So you want to set the full brightness cold white on start?
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/commands.md
    Do in short startup command:
    
    backlog led_dimmer 100; led_temperature 500
    

    (or in autoexec.bat in LittleFS)

    djbenson wrote:

    3) Should changes on the main page of the switch, the webapp and Home Assistant track each other? Ultimately the bulb will only ever be controlled by HA but it would be nice if they kept in sync.

    The changes on HA tracks the changes on OBK WWW page and vice versa. There might be just a little lag when it comes to refreshing OBK web page.
    Helpful post? Buy me a coffee.
  • #9 20396044
    djbenson
    Level 3  
    @p.kaczmarek2

    Done! Hopefully I've filled in the JSON correctly. Thanks so much for your help with this.
  • #10 20401643
    djbenson
    Level 3  
    Hi @p.kaczmarek2

    I have a problem with three out of the four bulbs I've flashed. For some reason, the first one I set up is the only one which will execute the startup command, the other three bulbs do not, but do they respond to the command when I use the "Execute Custom Command" option with the identical startup command (backlog led_dimmer 100; led_temperature 238).

    Any ideas?

    I tried putting the equivalent values in the startup screen (4=24, 5=100) which matches the values shown on screen of the "working" bulb but these other three bulbs do not want to execute startup commands.
  • #11 20402032
    p.kaczmarek2
    Moderator Smart Home
    Can you describe the issue more in depth, what exact bulb configuration, is it possible that the problematic bulbs are for example the ones with I2C-style drivers and the working one is PWM?
    Or maybe your HA remembers last state and somehow overwrites it on connect? Can you try with HA disabled?
    Or maybe you have also enabled "remember last state" and it conflictS?
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #12 20402242
    djbenson
    Level 3  
    I think I've resolved the issue - the difference between the first bulb and the other three (which are identical, they are all flashed to the same firmware, the same pin configuration and for the most part behave the same), is that I had set flag 23. Setting flag 23 on the remaining 3 bulbs ensures that a reboot/cold boot does what I need it to do - all four bulbs are now turning on to the desired brightness/temperature.

    Would it be possible to get/set startup parameters via Home Assistant? i.e. have the controls in HA and the bulb would get and store the values from HA which would be applied on next cold boot? As I mentioned above this is how the Zigbee bulbs work. It's no hardship setting the values directly on the bulb but it would be really handy to be able to apply the settings in Home Assistant.

Topic summary

The discussion revolves around the compatibility and configuration of LVWIT B22 WiFi LED bulbs with OpenBeken firmware. The user initially faced challenges with pin mapping and functionality after flashing the bulbs, which were not compatible with Tasmota. Through trial and error, they managed to achieve partial functionality using PWM mapping for RGB and white channels. The conversation includes detailed guidance on determining pin mapping, adjusting PWM settings, and troubleshooting issues with cold and warm white functionality. The user successfully configured the bulbs to operate as desired and sought advice on contributing to the device database and setting startup behaviors via Home Assistant.
Summary generated by the language model.
ADVERTISEMENT