Elektroda.com
Elektroda.com
X

[BK7231N / CB3S] Teardown WiFi Smart Power Strip UK

gcole 588 7
  • Here is a teardown for a generic WiFi Smart Power Strip UK Model no. SM-SO301K that I purchased by mistake from Amaozn UK Link to Amazon UK

    [BK7231N / CB3S] Teardown WiFi Smart Power Strip UK

    I already have the Zigbee version and it works well with Home Assistant so I thought I'd try OpenBK with this one.

    [BK7231N / CB3S] Teardown WiFi Smart Power Strip UK

    Disassembly was simple, rubber bungs on the back covering 8 small screws.

    ****NOTE****
    Make sure you disconnect the device from any mains supply before opening the case and do not be tempted to plug it back in once you have removed the cover, ensure safe electrical working practices are carried out at all times.

    [BK7231N / CB3S] Teardown WiFi Smart Power Strip UK

    The cover just prises off, there was no glue or concealed catches.

    [BK7231N / CB3S] Teardown WiFi Smart Power Strip UK

    This is the main PCB and I have identified all of the relevant parts, you can see the CB3S module in the centre it uses the BK7231N chip.

    There are four mains outputs, one 5V USB output, two separate LED indicators (red and blue) and one button input.

    [BK7231N / CB3S] Teardown WiFi Smart Power Strip UK

    I temporarily soldered wires to the +3v3, Gnd, TXD and RXD pins on the CB3S module and attached them to a serial UART plugged into my Windows computer.
    I downloaded the BK7231 GUI flasher tool from here, unzipped it and ran it.
    I then clicked the button 'Download latest from web' and after downloading, selected that file to flash to the module.
    Ive done this before so I selected the COM port of my Serial UART and opted to 'Do firmware write (no backup!)'
    Once the flash procedure started I shorted CEN (Pin 3) to Gnd for a short pulse and the flash procedure continued to completion.

    [BK7231N / CB3S] Teardown WiFi Smart Power Strip UK

    Head over to https://github.com/openshwprojects/BK7231GUIFlashTool for a detailed overview of how this tool works.

    Confident that the procedure had worked, I desoldered my temporary wires and reassembled the device before plugging into the mains supply.

    Once I'd got the WiFi settings completed and connected to my AP, I then set up the config as follows:

    [BK7231N / CB3S] Teardown WiFi Smart Power Strip UK

    It worked great!

    Well it didn't entirely, I found a bug with the Btn_tgl_all function but that was fixed overnight once I'd raised it on guthub.

    Thanks for the amazing response!

    Cool? Ranking DIY
    About Author
    gcole
    Level 3  
    Offline 
    gcole wrote 5 posts with rating 1. Been with us since 2022 year.
  • #2
    p.kaczmarek2
    Moderator Smart Home
    There was indeed a little logical mistake in Toggle All button which manifested only when Relay channels are indexed starting from 1 and not 0, but it's now indeed fixed.
    Very nice teardown, it's interesting to note that we had another power strip teardown recently, but the one below is using TuyaMCU:
    [CB2S/BK7231N] TuyaMCU AOFO Smart Power Strip C733
    So basically it looks like we have two different approaches to creating that kind od device from manufacturers. Some of them are using just WiFi module GPIOs, and some are integrating external MCU and TuyaMCU protocol...

    Btw it seems your CB3S has still some unused GPIO, so it should be possible to connect some extras in the future, like a sensor or something, although I am not sure if such modification would make much sense in this case.

    Btw can you also copy here JSON template from Web Application?
  • #3
    gcole
    Level 3  
    Here is the json config

    {
      "vendor": "Generic",
      "bDetailed": "0",
      "name": "WiFi Smart Power Strip",
      "model": "SM-SO301K",
      "chip": "BK7231N",
      "board": "CB3S",
      "keywords": [
        "Mains Power Strip",
        "USB Power Supply",
        "4 Gang"
      ],
      "pins": {
        "6": "Rel_n;2",
        "7": "Btn_Tgl_All;0",
        "8": "Rel_n;1",
        "10": "Rel_n;6",
        "14": "Rel;5",
        "21": "WifiLED;0",
        "23": "Rel_n;1",
        "24": "Rel_n;3",
        "26": "Rel_n;4"
      },
      "image": "https://obrazki.elektroda.pl/4535041600_1678464108_thumb.jpg",
      "wiki": "https://www.elektroda.com/rtvforum/topic3963570.html"
    }
  • #4
    p.kaczmarek2
    Moderator Smart Home
    Thank you, the device has been added to our list.
    [BK7231N / CB3S] Teardown WiFi Smart Power Strip UK
    https://openbekeniot.github.io/webapp/devicesList.html
    If you have any other devices, feel free to submit them.
  • #5
    gcole
    Level 3  
    Ive got some more devices coming soon so I will definitely add more in the future.

    I have a question.

    Looing at scripts and so on I'm wondering if tehre is a way to set up the behaviour in the following way.

    Chanels 1 to 6 are relay outputs, I would like the following behaviour.

    When any of Chanels 1 to 5 are set to on, chanel 6 is set to on
    When Channels 1 to 5 are all set to off, chanel 6 is set to off.

    Effectively channel 6 is an indicator that a relay is set to on.

    If you can point me in the right direction I will appreciate it.
    Thank you.
  • #6
    p.kaczmarek2
    Moderator Smart Home
    The similiar behaviour is present in one of our automatic firmware self-tests, designed to check the scripting functionality after each development iteration.
    https://github.com/openshwprojects/OpenBK7231...rc/selftest/selftest_demo_buttonToggleGroup.c
    Here's a related code fragment:
    Code: c
    Log in, to see the code

    You can alter it to check if any other channel is on and then set a specific channel to 1 or 0 and then add it as a handler to all channels expect that one
  • #7
    gcole
    Level 3  
    I put this in an autoexec.bat file and it works exactly as expected, once again thank you!

    alias set_led_on backlog setChannel 6 1
    alias set_led_off backlog setChannel 6 0
    alias myToggle if $CH1||$CH2||$CH3||$CH4||$CH5 then set_led_on else set_led_off
    addEventHandler OnChannelChange 1 myToggle
    addEventHandler OnChannelChange 2 myToggle
    addEventHandler OnChannelChange 3 myToggle
    addEventHandler OnChannelChange 4 myToggle
    addEventHandler OnChannelChange 5 myToggle