Today we will learn how to change the firmware on the Sonoff Basic wifi switch so we can integrate it with our projects in Node-Red.

To do this we will need the following:

You might need to install some drivers for the serial adapter. Download and install them from here.

To open the device, simply insert a screw driver between the cover and the back plate and twist gently to prop it open, as shown in the picture below.

Once open, you will see the connectors needed, marked in the picture below.

Please ensure that all cables are connected to the correct place on the board.

To put the device in flashing mode, please hold the reset button pressed down, connect the pins then release the button. The device will show no flashing light until the firmware is uploaded and the device is rebooted.

When ready, use nodeMCU-flasher to upload the sonoff basic firmware which can be found here.

On the first tab, please select the COM port for your device.



On the second tab, please select the sonoff-basic.bin firmware file.

And on the advanced tab, please ensure settings are matching:

When the upload is done, please reset the connections to reboot the board, after that it will create an access point for you to connect to (the led should be flashing green). Search for a “sonoff-…” open wifi network and connect to it. Open your favorite browser and type http://192.168.4.1

You will get a wifi setup page as shown in the picture below. Enter your wifi network details and click save.


For further configuration you will have to find your device on your network. You can scan the entire network or take a look at the dhcp list on your router.

Once you have found the IP of your device, connect to it using a browser to get to the GUI.

Go to Configuration -> Configure MQTT and set the following:

  • Host: mqtt.iotwithus.com
  • Port: 1883
  • Client – leave it on default
  • User – leave it on default
  • Password – leave it on default
  • Topic – here is a little tricky – enter a unique id for your bridge, some random 20-30 characters should do the job. Find a random string here, use it without quotes.
  • Full Topic: %topic%/%prefix%/

Click save!

Should look something like this:

That’s it, you should now be able to use the switch in Node-Red by using the set MQTT server and topic.

Amazon