MicroPython RGBWW Smart Bulb code for MQTT
subDesTagesMitExtraKaese f26ac0d7ce added default values to config | %!s(int64=3) %!d(string=hai) anos | |
---|---|---|
.vscode | %!s(int64=3) %!d(string=hai) anos | |
W60X_MicroPython_1.10_B1.3_IMG | %!s(int64=3) %!d(string=hai) anos | |
images | %!s(int64=3) %!d(string=hai) anos | |
.gitignore | %!s(int64=3) %!d(string=hai) anos | |
README.md | %!s(int64=3) %!d(string=hai) anos | |
boot.py | %!s(int64=3) %!d(string=hai) anos | |
config.py | %!s(int64=3) %!d(string=hai) anos | |
dev-requirements.txt | %!s(int64=3) %!d(string=hai) anos | |
leds.py | %!s(int64=3) %!d(string=hai) anos | |
main.py | %!s(int64=3) %!d(string=hai) anos | |
micropy.json | %!s(int64=3) %!d(string=hai) anos | |
requirements.txt | %!s(int64=3) %!d(string=hai) anos | |
umqttsimple.py | %!s(int64=3) %!d(string=hai) anos |
tested on a Tuya WinnerMicro W600-B800 Smart Bulb
erase secboot and old image
python3 -m w600tool -e -p /dev/ttyUSB0
connect PA0 (BOOT) to GND and reset chip by pulling RST low
flash MicroPython firmware
python3 -m w600tool -p /dev/ttyUSB0 -u W60X_MicroPython_1.10_B1.3_IMG/wm_w600.fls
Opening device: /dev/ttyUSB0
Erasing secboot
Switched speed to 2000000
Uploading W60X_MicroPython_1.10_B1.3_IMG/wm_w600.fls
0% [##############################] 100% | ETA: 00:00:00
Total time elapsed: 00:00:15
Reset board to run user code...
disconnect PA0 (BOOT) and reset the device
test Python shell with screen /dev/ttyUSB0 115200
(press CTRL-A
+ k
to quit)
__ __
\ \ /\ / /
\ \ / \ / /
\ \/ /\ \/ /
\ / \ /
/ /\ / /\
/ /\ \/ /\ \
/ / \ / \ \
/_/ \/ \_\
WinnerMicro W600
MicroPython v1.10-284-g2eee4e2-dirty on 2019-11-08; WinnerMicro module with W600
Type "help()" for more information.
>>>
In the python shell, connect to wifi and start FTP server:
>>> import easyw600
>>> easyw600.scan()
>>> easyw600.connect("<SSID>", "<PASSWORD>")
conneting...
connected, ip is 192.168.1.234
>>> easyw600.ftpserver()
ftpserver is running.
ftp server port is 21, username is root, password is root
Copy python files to the board. For example via ftp://root:root@192.168.1.234
Reset the uC
Create wifi_config.py
with following content:
WIFI_SSID="<SSID>"
WIFI_PASSWD="<PASSWORD>"
This can also be done via the Python shell:
>>> f = open("wifi_config.py")
>>> f.write('WIFI_SSID="<SSID>"\n')
>>> f.write('WIFI_PASS="<PASSWORD>"\n')
>>> f.close()
Reboot the M600 and connect to bulb via FTP without username and password