Elektroda.com
Elektroda.com
X

Light switch from the USA - Gosund Smart Switch SW5-A-V2.1 - BK7231T

p.kaczmarek2 4575 14
This content has been translated flag-pl » flag-en View the original version here.
  • Light switch from the USA - Gosund Smart Switch SW5-A-V2.1 - BK7231T
    Hello, here I will present the short teardown and OpenBeken programming guide for Gosund Smart Switch SW5-A-V2.1 with an unusual BK7231T module inside, which I am going to desolder with hot air in order to make high res photo of pad. The switch was donated to me by Jennifer from USA - thank you!

    Package from Jennifer
    The package was sent to me from the US on March 22 via the USPS (US Postal Service). It was marked as "Gifts", declared value 0.5 $.
    The postman brought it to me on May 4, I had to pay PLN 8.5 of the postage:
    Light switch from the USA - Gosund Smart Switch SW5-A-V2.1 - BK7231T Light switch from the USA - Gosund Smart Switch SW5-A-V2.1 - BK7231T Light switch from the USA - Gosund Smart Switch SW5-A-V2.1 - BK7231T Light switch from the USA - Gosund Smart Switch SW5-A-V2.1 - BK7231T Light switch from the USA - Gosund Smart Switch SW5-A-V2.1 - BK7231T
    Light switch from the USA - Gosund Smart Switch SW5-A-V2.1 - BK7231T
    This is not the first time such a fee. For the package with garden double plug with BK7231T from @strigona , I also had to pay PLN 8.5.
    Without delay, I started disassembling it.

    The interior of Gosund Smart Switch SW5-A-V2.1
    The housing is held by four screws. After that, you can remove the back plate.
    Light switch from the USA - Gosund Smart Switch SW5-A-V2.1 - BK7231T
    Here you can see something unusual, an external 2.4GHz WiFi antenna. It's not usually used, modules like ESP12F (TYWE3S), TYWE2S, WB2S or WB3S (regular) don't have it.
    Light switch from the USA - Gosund Smart Switch SW5-A-V2.1 - BK7231T Light switch from the USA - Gosund Smart Switch SW5-A-V2.1 - BK7231T Light switch from the USA - Gosund Smart Switch SW5-A-V2.1 - BK7231T
    Fusible resistor, a filter from two 400V 3.3uF capacitors (by the way - 400V in a switch for 120V? 120V mains is used in USA, and in Poland I have 230V mains) and a choke (the green one), a large choke (black) from a transformerless power supply ...
    Light switch from the USA - Gosund Smart Switch SW5-A-V2.1 - BK7231T
    Interesting fact - this 16A fuse, more precisely 16A250V, protects the entire system and the lamp connected via the relay. This fuse is directly connected to the L-in. I don't see such things in other smart switches, there is usually only a fusible resistor that protects the power supply only, not the relay light bulb.
    Light switch from the USA - Gosund Smart Switch SW5-A-V2.1 - BK7231T Light switch from the USA - Gosund Smart Switch SW5-A-V2.1 - BK7231T
    Here you can see the MB10F rectifier bridge, followed by the already mentioned Pi filter, and a bit further the transformerless converter controller powered by some SMD chip with IADGN label:
    Light switch from the USA - Gosund Smart Switch SW5-A-V2.1 - BK7231T
    IADGN is an SMD code, I don't know the full part name, but I can see you can buy replacement easily:
    Light switch from the USA - Gosund Smart Switch SW5-A-V2.1 - BK7231T
    Next you see the LDO regulator AMS 1117 3.3V (it provides 3.3V for the WiFi module) and you can also see the decicated programming and debugging pads. They will be useful for us:
    Light switch from the USA - Gosund Smart Switch SW5-A-V2.1 - BK7231T
    On the other side, there is also a transistor marked 1AM (probably MMBT3904) that activates the relay together with a "free-wheeling diode" SMD 7A diode connected in parallel to the relay coil, removing sudden voltage spikes when switching.
    Light switch from the USA - Gosund Smart Switch SW5-A-V2.1 - BK7231T
    There is room here for an alternative WiFi module. Does anyone know which module fits here?
    Light switch from the USA - Gosund Smart Switch SW5-A-V2.1 - BK7231T

    Programming Gosund Smart Switch SW5-A-V2.1
    The procedure turned out to be very simple.
    Same as here:
    Garden Tuya CCWFIO232PK Double Relay - BK7231T - Programming
    Just connect 5V to the AMS1117-3.3V input from a separate power supply in order to be able to reboot the system (cut off the power for a moment) without overloading the USB port with inrush current spike, connect RX and TX from the USB to UART converter based on CH340 in 3.3V mode and connect all ground signals together.
    I used a USB cable to connect the second 5V (it was a micro USB, but the connector was damaged so I cut it off):
    Light switch from the USA - Gosund Smart Switch SW5-A-V2.1 - BK7231T
    Soldering the 5V power supply (thanks to the 5V power supply, the relay will also work, which will allow us to immediately determine which pin it is connected to, by testing the pins again):
    Light switch from the USA - Gosund Smart Switch SW5-A-V2.1 - BK7231T
    RX and TX wires soldering:
    Light switch from the USA - Gosund Smart Switch SW5-A-V2.1 - BK7231T
    The programming procedure is as follows:
    1. in bkWriter 1.60 run read or write
    2. Disconnect the 5V power supply for a while, reconnect it
    3. bkWriter should start reading or writingthe firmware
    Sometimes it takes several tries to get it right, it's also worth checking different baud rates.

    Configuration in OpenBK
    This switch has quite a rich pin configuration options. It has a separate green LED which can be used to show WiFi status, a separate red LED for relay state, a button and a relay. Other manufacturers combine the signal controlling one diode and the relay together, but this is not the case here. So you can choose whether, for example, the red diode will be lit when the relay is turned off or if the relay is turned on. I personally prefer that it is lit when relay is turned off, because then at night it is easier to find the switch.
    Final pin configuration:
    Light switch from the USA - Gosund Smart Switch SW5-A-V2.1 - BK7231T


    An example of scripting a switch and a light in OpenBeken
    I think it is worth showing the additional possibility that I recently implemented in my OpenBeken.
    Prelimary event scripting and command systems have been added as an alternative to automation and scenarios found in Tuya or there in Home Assistant. My scripting system does not require an external server.
    So, for a demonstration, we just need:
    - a Smart WiFi bulb with OpenBeken (but Tasmota will also be compatible!) with IP reservation made on the router
    - a switch, just like the one from this topic
    First, we reserve our IP lamp in the router settings:
    Light switch from the USA - Gosund Smart Switch SW5-A-V2.1 - BK7231T
    Then, on the switch, we have to set the so-called "event handler", ie handling the event on the button device.
    The following command is used for this:
    
    setEventHandler [EventName] [Argument] [Command]
    

    For example, for clicking a button on pin 8:
    
    addEventHandler OnClick 8 [Command]
    

    (pin 8 must have the role Button set)
    As "command" we want to send the POWER state switching command via Tasmota HTTP (OpenBeken supports this protocol) to the IP address of the lamp.
    Sending such a command looks like this (you can try to call it from the OpenBeken console):
    
    SendGet http://192.168.0.112/cm?cmnd=Power0%20Toggle
    

    So, the complete command for handling an event with sending a Power Toggle looks like this:
    
    addEventHandler OnClick 8 SendGet http://192.168.0.112/cm?cmnd=Power0%20Toggle
    

    You can type this in the console, but then it won't save and the event handler will be lost after rebooting the device.
    For this reason, it's better to set it up in one of the two available places.
    1.as "short startup command" in Config (up to 512 characters, you can give many commands there by using the backlog - syntax like in Tasmota)
    Light switch from the USA - Gosund Smart Switch SW5-A-V2.1 - BK7231T
    2. as a command from the "autoexec.bat" file in LittleFS in the OpenBK JS panel
    Light switch from the USA - Gosund Smart Switch SW5-A-V2.1 - BK7231T
    (to create a file, drag it to the field "drop file here". Then you can edit it from the browser. LittleFS at the moment is cleared during OTA execution, so you should have a copy of the files)
    Demonstration:
    [video: ce9be6a240] https://filmy.elektroda.pl/7_1652038982.mp4 [/ video: ce9be6a240]
    It works. This is a substitute for "Tasmota Group", which will also be supported by me soon.


    Module identification with BK7231T
    I also decided that it is still worth identifying what specific module is in this device.
    It is not marked on the outside, so I was not able to identify it without desoldering.
    The pad markings must be on the bottom silkscreen, so I decided to unsolder the module with hot air gun (GJ-8018LCD):
    Light switch from the USA - Gosund Smart Switch SW5-A-V2.1 - BK7231T
    First, I also desoldered the button so as not to melt it.
    In order to make desoldering easier, I added lead tin and flux:
    Light switch from the USA - Gosund Smart Switch SW5-A-V2.1 - BK7231T
    Ready, after long and even heating:
    Light switch from the USA - Gosund Smart Switch SW5-A-V2.1 - BK7231T
    The module turns out to be Z2-B-V1.0. Here is the silk screen photo:
    Light switch from the USA - Gosund Smart Switch SW5-A-V2.1 - BK7231T
    Before soldering it back in place, I cleaned the PCB and pads:
    Light switch from the USA - Gosund Smart Switch SW5-A-V2.1 - BK7231T
    During soldering:
    Light switch from the USA - Gosund Smart Switch SW5-A-V2.1 - BK7231T
    After soldering it back in place, the switch is still working.

    Summary
    Thanks again @echojjj for sending me this switch for review. It was really interesting!
    Programming with OpenBeken turned out to be very easy as all required signals are routed out to the pads.
    The switch turned out to be useful even in Poland, because it works on 230V (I checked in practice).
    The BK module from inside turned out to be a novelty for me, even the search engine is silent when I enter "Z2-B-V1.0", and thanks to desoldering it from the board, I got to know the role of its outputs, which may be useful in the future when reworking other devices.
    By the way, I also presented a simple automation in OpenBeken, which can be implemented without the need to involve an external Home Assistant server.
    PS: Is this Z2-B-V1.0 footprint not compatible with some ESP module, maybe ESP32? I haven't had time to check yet, but maybe someone knows?

    Cool? Ranking DIY
    About Author
    p.kaczmarek2
    Moderator Smart Home
    Offline 
    p.kaczmarek2 wrote 4858 posts with rating 5193, helped 236 times. Been with us since 2014 year.
  • #2
    pawelr98
    Level 39  
    Lest it turn out that this work on 230V is only for a time.

    At 120V, the working conditions for semiconductors are "light" compared to our backyard.
  • #3
    p.kaczmarek2
    Moderator Smart Home
    The marking on the PCB behind the rectifier bridge and capacitor says "380V". The parameters of the bridge and capacitors also confirm this.
    But basically I have nowhere to put this type of switch, I will probably eventually convert it to this one powered by 5V and additionally attach it somewhere in the workshop (e.g. as a second upper light switch at the desk).
  • #4
    BOOM i ZONK
    Level 21  
    U1 seems to be MP150.
  • #5
    Krzysztof Kamienski
    Level 43  
    After all, there is a transformerless power supply based on capacitive reactance. Reduce its capacitor value by 1/3, because you will destroy the zener diode and the whole circuit. It has not yet happened just because in the USA it is 60Hz and in PL 50Hz.
  • #6
    BOOM i ZONK
    Level 21  
    Krzysztof Kamienski wrote:
    After all, there is a transformerless power supply based on capacitive reactance. Reduce its capacitor value by 1/3, because you will destroy the zener diode and the whole circuit. It has not yet happened just because in the USA it is 60Hz and in PL 50Hz.


    Where do you see this capacitor and the zener diode. There is a converter on the MP150.
  • #7
    p.kaczmarek2
    Moderator Smart Home
    I'm afraid @BOOM i ZONK is right. By the way, I haven't met a single IoT device with a 'capacitive dropper' yet. They were massively used in LED lamps (but now also less and less) and in other cheapest products, but in the 'smart' ones I always see either a super simple flyback, or just something a la MP150. Or BP2525. And so on.
  • #8
    nl0
    Level 2  
    Re-flashed 4 of those, using your instructions. The only thing I added was a normally-open button between the ground and CH_EN pad, pressing it right after the python script started and immediately releasing.

    Great work, thank you!
  • #9
    p.kaczmarek2
    Moderator Smart Home
    Thank you for using OpenBK.

    In a meantime, I've got a donation from Canada - a two interesting stair switches (3-way configuration):
    Light switch from the USA - Gosund Smart Switch SW5-A-V2.1 - BK7231T Light switch from the USA - Gosund Smart Switch SW5-A-V2.1 - BK7231T Light switch from the USA - Gosund Smart Switch SW5-A-V2.1 - BK7231T Light switch from the USA - Gosund Smart Switch SW5-A-V2.1 - BK7231T
    Next teardown/guide coming soon.
  • #10
    nl0
    Level 2  
    p.kaczmarek2 wrote:
    Thank you for using OpenBK.

    Thank you for making it.

    p.kaczmarek2 wrote:
    In a meantime, I've got a donation from Canada - a two interesting stair switches (3-way configuration)
    Next teardown/guide coming soon.

    I'm using several SS01 and SS01S, transplanted the module.

    Purchased Dual Dimmer Switch, will look inside it. Could be a Gosund.
  • #11
    abcimatree
    Level 2  
    Thanks for the guide. For me, bkWriter 1.60 could only read the device and would always fail writing. I had to flash it using python (hid_download_py).
  • #14
    p.kaczmarek2
    Moderator Smart Home
    It was released 2 days ago and I still wanted few more people to test it.
  • #15
    p.kaczmarek2
    Moderator Smart Home
    UPDATE
    In the topic I mentioned SendGET command:
    p.kaczmarek2 wrote:

    Sending such a command looks like this (you can try to call it from the OpenBeken console):
    
    SendGet http://192.168.0.112/cm?cmnd=Power0%20Toggle
    

    So, the complete command for handling an event with sending a Power Toggle looks like this:
    
    addEventHandler OnClick 8 SendGet http://192.168.0.112/cm?cmnd=Power0%20Toggle
    

    Now we also have SendPost command. Update your OBKs please.

    Here are examples of both commands, first GET:
    
    backlog setChannel 10 13; setChannel 11 87; SendGET http://localhost:3000/?a=$CH10&b=$CH11
    

    Then sending JSON via POST:
    
    backlog setChannel 10 13; setChannel 11 87; SendPOST http://localhost:3000/ 3000 "application/json" "{ \"a\":$CH10, \"b\":$CH11 }"
    

    This can be used even to send measurement data to database and create graphs, power usage history and much more.