logo elektroda
logo elektroda
X
logo elektroda

Configuring BK7231N Smart Plug with OpenBK7231T Firmware: LED & Power Metering Issues

vitya123 882 17
ADVERTISEMENT
  • #1 21290161
    vitya123
    Level 6  
    Dear All,
    I just got a new smart plug which, obviously, I converted to this awesome firmware.
    The upgrade went smoothly. Now I need to configure it, and this is where I need some help: All the examples in the examples contain a (removable) module, but mine doesn't. It simply has a single board that has everything from the BK7231N chip, through the BL0937, to the relay, etc. on it. None of the example configs work.
    By tracing the LEDs, the BL0937 lines (SEL, CF, CF1) I came to the conclusion that my module is connected like this:

    BK7231N pin - function
    15 - BL0937 SEL
    23 - BL0937 CF1
    22 - BL0937 CF
    16 - LED#1 (red)
    24 - LED#2 (blue)
    8 - relay

    However, when configuring the device with these settings, I have a number of problems:
    1. blue LED is always on, cannot change it.
    2. red LED follows the state of the relay, cannot set it on its own.
    3. there is no power metering AT ALL.
    4. the button gets detected, but it doesn't switch the relay on/off

    I wonder if there is a fundamental error I am overlooking... This is my config:

    {
      "vendor": "Tuya",
      "bDetailed": "0",
      "name": "Full Device Name Here",
      "model": "enter short model name here",
      "chip": "BK7231N",
      "board": "TODO",
      "flags": "1024",
      "keywords": [
        "TODO",
        "TODO",
        "TODO"
      ],
      "pins": {
        "8": "Rel;0",
        "15": "BL0937SEL;0",
        "16": "WifiLED_n;0",
        "22": "BL0937CF;0",
        "23": "BL0937CF1;0",
        "24": "LED_n;0",
        "26": "dInput_NoPullUp;0"
      },
      "command": "",
      "image": "https://obrazki.elektroda.pl/YOUR_IMAGE.jpg",
      "wiki": "https://www.elektroda.com/rtvforum/topic_YOUR_TOPIC.html"
    }


    Here are a couple of pics of my board:
    Close-up of a circuit board with an integrated circuit and electronic components. Close-up of a circuit board with a visible integrated circuit and electronic components.

    Once I figure this out I will post a full write up on it.
  • ADVERTISEMENT
  • #2 21290212
    divadiow
    Level 35  
    how did you flash it to OpenBeken? If you used UART did you take a backup of the factory firmware?
  • #3 21290219
    vitya123
    Level 6  
    >>21290212
    Yes, I flashed it using UART. And yes, I took a backup of the factory firmware. Although I have to say, I have never powered it on using the original firmware, I went straight for OB.
  • ADVERTISEMENT
  • #4 21290223
    divadiow
    Level 35  
    what did Easy Flasher say about extracting the config from the backup?

    eg

    Screenshot of Easy Flasher software showing the extraction of configuration from a Tuya binary file.
  • #5 21290230
    vitya123
    Level 6  
    >>21290223
    Unfortunately this: "Failed to extract keys" :(

    I also tried to do it with the file downloaded from the web app - Download Tuya GPIO config from 0x1EE000, but got the same result - Failed to extract key.
  • ADVERTISEMENT
  • #6 21290231
    divadiow
    Level 35  
    I'd be happy to flash the backup to check boot logs if you're willing to share. sometimes the pin assignments are confirmable in the plan text output
  • #7 21290259
    vitya123
    Level 6  
    yeah, sure, I'd be happy to share it. :) Sending you the link to it in a private message.
  • #8 21290260
    divadiow
    Level 35  
    just checking you've rebooted since config and you have the BL0937 driver running
    Screen showing active drivers with one BL0937 driver.
  • ADVERTISEMENT
  • #10 21290265
    divadiow
    Level 35  
    vitya123 wrote:
    Hmmmm... what does this mean?

    on the main web gui it should have the drivers running listed
    Dashboard of the OpenBK_BK7231N_Fridge_Tuya_Plug displaying parameter summary.
  • #11 21290282
    vitya123
    Level 6  
    It says:
    0 drivers active, total 36
  • #12 21290286
    divadiow
    Level 35  
    boot log

    Code: Text
    Log in, to see the code


    area of interest:

    Code: Text
    Log in, to see the code


    which looks like your template might need to be
    Code: JSON
    Log in, to see the code


    are you sure there are two LEDs?
  • #13 21290324
    vitya123
    Level 6  
    Well, I tried your config (just to confirm: webapp - import, right?), but the situation hasn't improved...
    I can toggle the relay from the UI, but no sign of the power monitoring features:
    Screenshot of the OpenBK7231N user interface showing system information and a toggle option.

    About the LEDs: I have 2: a blue one, that seems to be always on, and a red one that comes on when the relay is on.
  • #14 21290333
    divadiow
    Level 35  
    >>21290324
    vitya123 wrote:
    just to confirm: webapp - import, right?

    yes. the BL0937 driver should start automatically on reboot with configured pins. if not, run "startdriver bl0937" in the startup command text or in an autoexec.bat

    Screenshot of the settings interface for the OpenBK_BK7231N_Fridge_Tuya_Plug device, where a startup command can be entered.
  • #15 21290335
    vitya123
    Level 6  
    I also notice a very weird thing now:
    When I press the button, the relay toggles just fine. However, when I'm in the webapp-GPIO finder, the button toggles ALL the GPIOs...
    GPIO Doctor Pins interface with a list of pins and buttons for setting outputs and inputs. Web interface of an application for managing GPIO with active Set Output Low settings and High status. Screenshot of GPIO Doctor Pins interface with buttons to set outputs high. Web app interface for managing GPIO outputs with visible buttons to set outputs to high.
  • #16 21290337
    divadiow
    Level 35  
    Code: JSON
    Log in, to see the code


    switch relay and button channels to 1 to change that behaviour
  • #17 21290360
    vitya123
    Level 6  
    Done and dusted - all working as I expect them to. Thank you for your help!!!!

Topic summary

The discussion revolves around configuring a smart plug utilizing the BK7231N chip with OpenBK7231T firmware. The user successfully flashed the firmware but encountered issues with LED behavior, power metering, and relay control. Despite following example configurations, the blue LED remained constantly on, the red LED only indicated relay status, and power monitoring features were non-functional. The community provided troubleshooting steps, including checking driver activation, rebooting, and adjusting GPIO settings. Ultimately, the user resolved the issues by modifying the relay and button channel configurations, leading to successful operation of the device.
Summary generated by the language model.
ADVERTISEMENT