Monday, 20 April 2026

How to use an ESP32-C6-GEEK as a WiFi Light Switch

 I wanted to allow WiFi controlled lights to be turned ON/OFF easily if someone presses a switch.


To do this I used an ESP32-C6-GEEK running micropython to monitor is GPIOx line and publish ON or OFF to MQTT topic XXX


I also made it into a presence sensor and issue an ON every 20 secs if there is WiFi disturbances


First, I went to https://micropython.org/download/ESP32_GENERIC_C6/ and downloaded the image to my board using my laptop


You can connect to the device by plugging it into the laptop and following the instructions at https://circuitpython.org/board/seeed_xiao_esp32c6/ to flash it.


I need the code to connect to WiFi SSID: Tenda_D98860 and then to the Tola Park MQTT broker. After this it should send a status every 30 secs of its uptime in seconds

Then if GPIOx goes low it should turn on teh light by posting ON to MQTT topic ...




No comments:

Post a Comment