logo elektroda
logo elektroda
X
logo elektroda

Another Smart Switch easy to run locally with Home Assistant - ATLO-B1-Tuya

p.kaczmarek2 1440 0
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • Close-up of a relay board with WiFi module and electronic components. .
    Here are the firmware change instructions for another budget WiFi controlled relay. The product presented here normally works with the Tuya cloud, but here I will show how it can be freed from the cloud and paired with Home Assistant. The unit discussed here appears under the ATLO-B1-Tuya model and already belongs to the newer series of Smart Switches, as it uses the BK7231N. The gadget itself is available to buy in two versions - a version with energy measurement (based on the BL0937), and a regular version, here I will show the latter.

    Let's start with the packaging, the unit shown here I had from a reader, I changed the firmware for him on request throughout the set of devices.
    Box of WiFi Smart Switch for remote control. .
    Packaging of ATLO-B1-Tuya Wi-Fi relay. .
    You can see that the equipment was bought in our country, probably for a few tens of zlotys, although it would have been cheaper from China.
    Contents - they even gave screws for fixing:
    White Wi-Fi Smart Switch with instructions and a bag of screws. .
    Leaflet with user manual for ATLO-B1-Tuya WiFi relay. .
    Instruction card with ecological labels and certifications. .
    Test with Tuya I skip, it's time to look inside and change the firmware.
    White WiFi Smart Switch model ATLO-B1-Tuya with open casing parts. .
    Disassembled WiFi relay housing with visible PCB and accessories. .
    Inside sits a relay that only cuts off one wire - assumed to be a phase, but you know, it depends how you connect. Apart from that, we have a non-isolated power supply (step down) and a 3.3V LDO regulator and WiFi module.
    PCB of a relay with electronic components on a white base. .
    Printed circuit board with electronic components of a WiFi relay on a white background. .
    Electronic circuit of ATLO-B1-Tuya relay on a white casing with visible electronic components. .
    The input to the inverter is protected by an F1 fuse, next to this we also have a varistor, and then an incomplete filter (the chokes are omitted - e.g. L3 is missing). In the plans there was also a fuse F2, the one from the phase going to the device, but it was omitted.
    Close-up of a relay circuit board with visible electronic components. .
    The step-down converter itself (which converts these rectified 230V to 5V for the relay) is based on a BP2525. Separately further down we have the AMS1117-3.3V.
    Close-up of a PCB with a WiFi module. .
    There is still room on the board for the aforementioned BL0937 along with a resistor/bypass for current measurement.
    Close-up of a circuit board with component and port markings. .
    You can also see the bold current paths from 230V:

    Printed circuit board of a budget WiFi relay .

    The firmware change is done according to the instructions of our flasher:
    https://github.com/openshwprojects/BK7231GUIFlashTool
    We prepare a USB to UART converter as standard, on the other hand we don't need a 3.3V power supply/stabiliser as you can feed 5V to the input of the one on the board:
    WiFi relay board with electronic components and CB2S module. .
    Circuit board of a relay with electronic components. .
    You can't feed 5V into the CB2S power supply, because then you will damage it.
    We also need to add wires to the RX1 and TX1 pads from CB2S:
    PCB schematic with pin labels and dimensions for CB2S module. .
    I first apply flux, then add a bit of lead binder and solder the previously whitened wires too.
    Close-up of a circuit board with soldered wires. .
    A circuit board with electronic components and wires connected to a breadboard. .
    If you have any problems, you can take a look at our Electrode playlist and watch videos about the BK7231 there:
    https://www.youtube.com/playlist?list=PLzbXEc2ebpH0CZDbczAXT94BuSGrd_GoM

    Plug everything in, start the flash read in the flasher and do a power cycle, i.e. disconnect and connect the 5V power cable. The flasher should read the batch including the configuration:
    Screenshot of a tool for extracting Tuya device configuration. .
    JSON Tuya:
    Code: JSON
    Log in, to see the code
    .
    OBK template:
    Code: JSON
    Log in, to see the code

    GPIO verbal description:
    
    Device seems to be using CB2S module, which is BK7231N chip.
    - Relay (channel 1) on P26
    - WiFi LED on P8
    - TglChannelToggle (channel 1) on P6
    - Pair/Toggle All Pin on P24
    
    .
    Instructions for uploading the template:


    .
    Instructions for pairing with HA:


    .

    Operation successful - patient disconnected from the cloud. Can work with HA as well as being freely scripted, configured and even able to handle additional sensors, buttons and relays. Details on Github of the project . You can also take a look at our list of device templates and on Youtube Elektrodam.com .
    If you have any questions, I'm happy to help - the firmware presented here also supports other, less popular chips, so even if your switch is not based on BK, it's still probably possible to change the firmware.

    Cool? Ranking DIY
    Helpful post? Buy me a coffee.
    About Author
    p.kaczmarek2
    Moderator Smart Home
    Offline 
    p.kaczmarek2 wrote 11838 posts with rating 9933, helped 566 times. Been with us since 2014 year.
  • ADVERTISEMENT
ADVERTISEMENT