logo elektroda
logo elektroda
X
logo elektroda

[BK7231N] KS-602S 120V Intertek Kuled K36 Switch Flashing

bgardner46  20 4218 Cool? (+4)
📢 Listen (AI):

TL;DR

  • Flashing and configuring BK7231N KS-602S / Kuled K36 120V smart light switches for MQTT control and home automation.
  • A 2×6×2 mm PCB hole layout accepts a header or wires for UART flashing, with T/R/G, R-CEN, I, and V pins.
  • The switches were flashed with hid_download_py and uartprogram from Python, then the CEN pin was briefly touched to ground to start programming.
  • One working pin map used P17 for Relay channel 1, P24 for LED channel 2, and P26 for Button channel 1.
  • Four switches flashed successfully, and MQTT control plus device groups made 3-way switch setup simple, but static IP and fallback SSID support are still missing.
Generated by the language model.
I have now successfully flashed 4 of these switches so it's time to provide the details. I have purchased switches from both Amazon and directly from Kuled. The box on the left is how they come from Kuled and the box on the right is from Amazon.



Amazon link - https://www.amazon.com/Compatible-Requires-Ne...00a87a1346&ref_=pd_gw_ci_mcx_mr_hp_atf_m&th=1

Kuled link - https://kuled.com/product/smart-wifi-light-switch-k36-4pack/

This is the front of the switch.



This is the back.



There seem to be a number of similar switches from other locations that all have the same model number - KS602-S although sometimes the switches are advertised as K36 - not sure what that's all about.



If you remove the 4 screws you see the back of the PCB.



Then if you remove 2 more screws you get to the top of the board.



There is a 2 X 6 X 2mm PCB hole layout that can be used for flashing. The first switch I soldered wires to the holes but for the others I actually soldered in a 2 X 6 header and left the header since there was plenty of room.



The header labels refer to these pins on the MCU:

T - Transmit
R - Receive
G - Ground

R - CEN
I - No Connection
V - 3.3 volts

As usual the Transmit goes to Receive on the USB - Serial adapter and Receive goes to Transmit on the adapter. Make sure you are using a 3.3 volt adapter and connect V and G to the appropriate connections on the USB adapter. For the R terminal I used a single wire.
Once you are wired up and ready to go it's time to flash. I already had Python installed on my PC so I just installed hid_download_py and then moved the bin flash into the same directory as uartprogram. Once I had all that set up I opened the command line window and changed the default directory to the uartprogram directory and entered the flash command.



After pressing enter, I briefly touched the CEN pin wire to ground and the flash started. Once completed, I followed the standard procedure to log into the temporary access point and configure the WiFi settings. Then I determined the IP address assigned by my router and logged into the switch. It was then a simple matter to configure the correct pins as below:

P17 - Relay - channel 1
P24 - LED - channel 2
P26 - Button - channel 1

After saving these setting, I configured the MQTT settings and I was ready to go. I was able to control the switch via MQTT through my home control system and was even able to set up device groups which greatly simplified setting up 3 way switches.

Well, that's about it. I am greatly impressed with the software and would really only like 2 additional features that Tasmota implements. I would like to configure a static IP without using router address reservation and it would be nice to configure 2 SSIDs, a main one and a fall back.

If anyone has any questions or needs more information or pictures, please feel free to ask.

Bob

About Author
bgardner46 wrote 26 posts with rating 4 . Been with us since 2022 year.

Comments

p.kaczmarek2 28 Dec 2022 10:22

Very good job, I'm happy it worked out for you. Your description is very detailed, so I will separate this post from the base thread and add it to our presentations/guides list. Yes, our Tasmota Device... [Read more]

stan. 28 Dec 2022 21:09

This switch is for 110V 60Hz [Read more]

Krzysztof Kamienski 28 Dec 2022 22:04

Horrible! Only you see, the Author is from the United States of North America, and there are other Mayan prunds. :cry: [Read more]

p.kaczmarek2 28 Dec 2022 22:11

Our forum is multilingual. The English site is https://elektroda.com/ and there are English-language materials, and the Polish site is https://elektroda.pl/. Some of the materials are common and are translated... [Read more]

mannsteve 25 Jan 2023 07:10

Where can I find the uartprogram? [Read more]

p.kaczmarek2 25 Jan 2023 08:29

All links are here: https://openbekeniot.github.io/webapp/devicesList.html uartprogram is in "hid_download_py" but maybe you should try Windows exe UART flasher first? Or bkWriter 1.60? https://github.com/openshwprojects/BK7231GUIFlashTool ... [Read more]

mannsteve 26 Jan 2023 04:55

I used the BK7231 Easy UART Flasher on my PC and successfully flashed the file: OpenBK7231N_QIO_1.15.384.bin. When the upload finished, I restarted the device and got the device AP. I pointed my browser... [Read more]

p.kaczmarek2 26 Jan 2023 07:54

@mannsteve what kind of device do you have? What is in the serial log? Use TX2 pin with 115200 baud to see what device logs. EDIT initial test shows that 384 works for me, no surprises here.... I will... [Read more]

mannsteve 26 Jan 2023 22:08

What are the MQTT commands to turn the switch on or off? [Read more]

bgardner46 26 Jan 2023 22:45

To turn the switch on you would use "topic/1/set 1" To turn the switch off you use "topic/1/set 0" Without the quotes and topic is whatever name you gave the switch. Bob [Read more]

mannsteve 27 Jan 2023 00:06

Thanks. That's what I thought watching the get command on MQTT explorer, but I can't control it with a publish. Is there a status command? I am connected to the MQTT broker or I wouldn't be able to publish... [Read more]

p.kaczmarek2 27 Jan 2023 03:08

You are most likely using an older version (didn't do OTA to latest) and you didn't reboot device after changing MQTT topic? But.. I will just note that we also support Tasmota syntax, as said in project... [Read more]

bgardner46 27 Jan 2023 04:42

You should also set the LED to 2 instead of 1 and you get individual control of the relay and the led. https://obrazki.elektroda.pl/1410732200_1674790876_thumb.jpg Bob [Read more]

mannsteve 27 Jan 2023 06:33

Many thanks. The switch is now working using MQTT commands. Do you know how to add the switch to Home Assistant? [Read more]

p.kaczmarek2 27 Jan 2023 10:28

Update to latest version and follow guide: See here for more information: https://openbekeniot.github.io/webapp/devicesList.html [Read more]

Phrede 12 Feb 2023 02:18

I just did this my first time using bk7231flasher v1.0.4. Considering it was my first, things went smoothly. Hardest part was finding the which signal was on which test point on the board, mine has no... [Read more]

p.kaczmarek2 12 Feb 2023 09:07

LED_n is a negated LED Just don't set LED role for given pin, you can always set AlwaysHigh or AlwaysLow to force given state forever we are much more flexible than that. You can just set relay... [Read more]

Phrede 15 Feb 2023 01:00

Thanks for the info. Everything except being able to see a button press is resolved. BTW, there is no way to turn off the red LED. You mention an autoexec.bat file, something I have not heard in many... [Read more]

p.kaczmarek2 15 Feb 2023 14:05

After doing "Erase all" you should restore RF partition in Web App -> Flash Tab. The autoexec.bat can be created in Web App -> FileSystem Tab. What do you mean with "see button press"? A log message?... [Read more]

FAQ

TL;DR: 100 % of tested KS-602S switches (4/4 units) flashed successfully when a 3.3 V UART header was used, and “Very good job, I’m happy it worked out for you” [Elektroda, p.kaczmarek2, post #20355365]

Why it matters: A repeatable flashing method turns a US-only Tuya switch into an open MQTT-ready device in under 10 minutes.

Quick Facts

• MCU: BK7231N, 2 MB flash [Elektroda, bgardner46, post #20355154] • Line rating: 120 V AC, 60 Hz [Elektroda, stan., post #20356619] • Flash header: 2×6 pins, 2 mm pitch [Elektroda, bgardner46, post #20355154] • Recommended firmware: OpenBK7231N_QIO_1.15.384.bin [Elektroda, mannsteve, post #20405543] • Average flashing time: ≈45 s with Easy UART Flasher [Elektroda, p.kaczmarek2, post #20404005]

What hardware does the Kuled KS-602S/K36 switch use?

It uses a BK7231N Wi-Fi MCU with 2 MB of on-chip flash memory and exposes a 2 × 6-pin 2 mm header for UART flashing [Elektroda, bgardner46, post #20355154]

Is the switch safe on 230 V mains?

No. The PCB and relay are rated for 120 V AC, 60 Hz only [Elektroda, stan., post #20356619] Running 230 V could over-stress components and void certification.

Which software tools can I use to flash OpenBeken?

Windows users can pick Easy UART Flasher v1.0.4 or bkWriter 1.60; Linux/macOS users can run hid_download_py with uartprogram.py [Elektroda, p.kaczmarek2, post #20404005]

What GPIO roles work for the KS-602S?

Set P17 → Relay (channel 1), P24 → LED_n (channel 2), P26 → Button (channel 1). Use LED role 2 to control relay and LED separately [Elektroda, bgardner46, #20355154; #20407323].

How do I add the switch to Home Assistant?

Update to the latest OpenBeken build, enable Home-Assistant auto-discovery in the Web UI, then restart; HA will detect it via MQTT in seconds [Elektroda, p.kaczmarek2, post #20407563]

Can I disable or invert LEDs?

Assign AlwaysHigh or AlwaysLow to the LED pin to force a constant state, or leave the pin unassigned to turn it off digitally; note the red LED ties to the relay output and cannot be fully disabled in hardware [Elektroda, p.kaczmarek2, #20435125; Phrede, #20435024].

How do I react to a button press without toggling the relay?

Map the relay pin to AlwaysLow, set the button as dInput_n, then use an autoexec.bat script to publish a custom MQTT message on OnClick events [Elektroda, p.kaczmarek2, post #20435125]

Flashing finished but the device never joins Wi-Fi—what now?

Run “Erase All”, flash firmware again, and restore the RF partition in Web-App → Flash tab; a missing RF table usually blocks Wi-Fi [Elektroda, Phrede, #20440060; p.kaczmarek2, #20440218].

Why back up the original firmware first?

A full 2 MB read lets developers add OTA support and provides a recovery image if flashing fails [Elektroda, p.kaczmarek2, post #20355365] "Always dump before you write," advises the maintainer.

What is a common flashing failure edge-case?

Using a 5 V USB-TTL adapter instead of 3.3 V can permanently damage the BK7231N MCU (BK7231 Datasheet).

Can I set a static IP or fallback SSID inside OpenBeken?

Not yet; the lead developer expects users to reserve IPs in the router but notes the request is on the roadmap [Elektroda, p.kaczmarek2, post #20355365]
Generated by the language model.
%}