Flashing the Sonoff S31 with Tasmota using a Mac (no soldering!)

Sonoff S31 with mini grabber hooks attached

Flashing the firmware on the Sonoff S31 can seem intimidating at first. You have to take it apart, exposing the electronics inside, then connect your computer directly to tabs on the PC board using a serial breakout device like the Sparkfun Serial Basic. But it’s not that hard. And you can do it without soldering. I managed to do it using four mini grabber test hooks on male jumper wires that came in a 10-piece set that I got on Amazon.

Step one: make sure your USB breakout device works

There are a number of serial breakout devices out there that will work for this, but I’m using the Sparkfun Serial Basic. Sparkfun has a good guide on how to hook these up to various sorts of machines, including the Mac.

Note: you may need drivers.

You can check to see if your device has a working driver by plugging it into one of your USB ports, then typing:

ls /dev/cu*

You should get something like this:

The device “wchusbserial1420” is my SparkFun Serial Basic. If you don’t recognize your breakout device, try unplugging it, then repeating the directory list command. (ls /dev/cu*) If nothing changes, you probably need a driver. Plugging the device into your usb should cause a new driver to show up in this directory.

If you’re using a SparkFun device, or anything else that has the CH340 chip (which you probably are), SparkFun has a good how-to page on installing CH340 drivers, along with downloads for all the familiar OSes.

Once you’re confident your breakout device works, just unplug it for now and set it aside.

Step two: get your S31 ready

Use a sharp blade to remove the plastic end cap. Once you get it separated from the rest of the unit, you should be able to just pop it off.

Slide the rounded corner piece out. They should slide out easily.

Using a small Phillips screwdriver, remove the three screws. (There’s one on the top and two on the bottom.)

Remove the plug/circuit board assembly from the plastic housing.

Locate the side of the unit with the small circuit board that has seven small circular tabs along its edge. This is the device’s serial port. The little tabs are the connection points where you’ll hook up the wires from your serial breakout device.

Step three: connect your wires

Both the S31 and your breakout device will have six connection points. But we will only be using four: VCC, TX, RX, and GND. VCC is your supply voltage. GND is your ground. The TX and RX terminals are the ones that transmit and receive your data. Be sure to connect the TX on your breakout device to the RX on the S31, and vice versa. If you connect TX to TX and RX to RX, no data will transfer.

The Sparkfun Serial Basic has female header sockets (they’re on the back of the board, the opposite side of what’s pictured here.) You’ll need four leads with male header pins.

Here I’ve got my yellow lead plugged into the board’s RX1 socket; the green into TX0; the red into VCC; and the black into GND.

It doesn’t matter what color leads you use, so long as you can remember what’s plugged into what. I find it helpful to always use red for power and black for ground when possible.

Now connect the other ends of your leads to the S31. As you can see in the picture, these mini grabber hooks do a nice job of making contact with the little tabs on the PC board.

You don’t have to use mini grabber hooks. You might get away with alligator clips if you have any that are small enough. Anything that keeps the leads in constant contact with the pads will work. (Sticky tape might do the job, but I’ve never tried.)

Soldering will always work, of course. That’s what all the YouTubers say to do, and that’s what I did the first time. But it’s no fun soldering something you’ll just have to un-solder in a few minutes, so I’m trying to teach a method that doesn’t require it.

Now you should be ready to begin the flash procedure. You might want to double-check to make sure your grabber hooks are on the appropriate tabs, and that your TX and RX leads go to their respective opposites on the other device.

Go ahead and plug your USB cable into your breakout device. But don’t plug the other end into the computer just yet.

Step four: flash the firmware

Time for the moment of truth. You’re going to need to put the S31 into “programming mode” in order to flash the firmware. To do this, locate the button in the center of the little PC board to which you just attached your grabber hooks. You’re going to want to press this button and hold it down while plugging your USB cable into your computer. Once it’s in, keep holding the button down for a few seconds, then release.

You should now have an established serial connection. Remember, you can always check by opening a terminal window and typing ls /dev/cu*, then looking for /dev/cu.wchusbserial1420 (or whatever your breakout device is) in the result.

We’ll flash the S31 using the Tasmota Web Installer and Chrome, because that’s super easy.

There are a number of other flashing tools that will work for this, and there’s a nice list of them with links on the Tasmota Getting Started page. But the web installer should work fine for our purposes.

In the drop-down list you’ll see lots of options, like different languages, special version of Tasmota, etc. Just select the plain old “Tasmota” at the top of the list.

With your S31 all hooked up and your breakout device now plugged into your computer, go ahead and click “connect.”

You’ll be prompted to select a serial port. Select the USB serial option. (In my case, cu.wchusbserial1420.) Then click “connect.”

Now it’s going to ask you if you want to install Release Tasmota (English). Go ahead and click on that.

Next, it’s going to ask if you want to erase the device. If you decline to check this box, I think it gives you the option of saving the old firmware. I don’t see any reason to do this.

Just check “erase device,” then click “next.”

One more confirmation, then the installer goes to work.

Click “install.”

You’ll see something like this on your screen.

The LEDs on your breakout device will do a dance.

Then, just like that, you’ll be done.

Click “next” if you like (it really doesn’t matter), then unplug your USB cable from your computer. Disconnect your leads from your S31 and breakout device.

Now all you need to do is put the S31 back together, then configure Tasmota.

Next steps

If you have not set up a Tasmota device before, there are good instructions under the “Initial Configuration” section of Tasmota’s Getting Started Page. Once your device is up and running and accessible via WiFi, you might want to Configuration > Configure Module > and select the Sonoff S31 setting. Try plugging in a lamp or something, then use the web interface to switch it on. In a moment, you should see the plug’s energy monitoring details on your screen. In my opinion, that’s the coolest thing about the S31.

1 comment

  1. I’ve installed Tasmota on a bunch of Sonoff devices, always with soldering and PyFlasher and flywires and so on… I didn’t have any little gripper clips to exactly follow your process so I soldered some pins. I did not know about the online Tasmota installer until I found your page and it worked better than I could possibly have imagined. It’s bookmarked and I have a bunch of Sonoff basics waiting for my mini hook clips to arrive on Sunday… Thanks for the great addition to the Tasmota/Sonoff knowledgebase.

Leave a comment

Your email address will not be published.