Jig for Programming Sonoff Basic Switches

by taste_the_code in Circuits > Microcontrollers

2542 Views, 28 Favorites, 0 Comments

Jig for Programming Sonoff Basic Switches

MVI_1098.MP4.00_00_11_19.Still001.jpg
Jig Mastery: Flash Sonoff Basic Switches with Tasmota Like a Pro! - DIY Jig
MVI_1088.MP4.00_01_56_06.Still002.jpg
MVI_1091.MP4.00_02_16_16.Still003.jpg

If you're like me, you're always on the lookout for ways to enhance your smart home experience. I'm currently checking out the Sonoff Basic smart switches, compact devices that can control your home appliances and devices. But the true fun begins when we tweak these gadgets to work with custom setups like Home Assistant by flashing them with custom firmware.

To do so I've made a DIY programming jig, that will help me to program these switches easily and without messing with wires.

This post is sponsored by PCBWay

PCBWay offers services for custom PCBs, PCBA, 3D printing, CNC machining, Injection molding, and more.

Check out their 2023 Christmas Big Sale to get access to discounts, lucky draws, tons of coupons, 50% OFF on selected items, blind boxes, and much more!

Supplies

MVI_1089.MP4.00_00_00_00.Still001.jpg
MVI_1089.MP4.00_00_37_19.Still002.jpg
MVI_1089.MP4.00_00_45_07.Still003.jpg

Tools and materials used in the video. Purchasing through the links below helps the channel at no extra cost to you!

Prepare the PCB

MVI_1084.MP4.00_00_22_23.Still001.jpg
MVI_1084.MP4.00_00_47_07.Still002.jpg
MVI_1084.MP4.00_00_53_21.Still003.jpg
MVI_1086.MP4.00_01_41_16.Still001.jpg
MVI_1081.MP4.00_01_22_00.Still001.jpg

To kick things off, let's prepare a PCB adapter that will make the programming of our Sonoff Basic switches a whole lot easier. This adapter will serve as a bridge between our USB to serial converter and the Sonoff Basic, ensuring the proper alignment and connection for flashing the firmware.

First up, I grab a piece of prototyping PCB – the size doesn't matter, as long as it can fit the connectors. I've chosen one of the smallest ones available. On one edge of the perfboard, I solder a four-pin male header. This will plug directly into the serial breakout pins on the Sonoff switch.

On the opposite side of the perfboard, I attach a female header, which will connect to our USB to serial adapter and I used the adapter for which I make the jig as a holder for the header.

Wire Up the PCB

MVI_1087.MP4.00_08_25_22.Still001.jpg

This is where things can get a little crafty. Based on the layout of your USB to serial adapter, you may need to rearrange the wiring on the perfboard. For instance, the ground on the perfboard should align with the ground on your USB to serial adapter, and the same goes for VCC, TX and RX.

Based on your adapter, this process will be different. What you will need to do is to ensure that on the male header pins the wiring is VCC, TX, RX, GND, starting from the pin nearest to you that will go into the square pad on the Sonoff.

Test the PCB Connections

MVI_1087.MP4.00_11_15_17.Still001.jpg

Once everything is soldered securely, I like to double-check the connections with a multimeter. This helps prevent any nasty surprises later on.

To do so, I checked each pin in continuity mode, making sure that it is connected to the right pin on the USB to serial adapter and not connected with any other pin.

Other Alternatives

MVI_1091.MP4.00_01_38_25.Still002.jpg
MVI_1092.MP4.00_00_19_06.Still001.jpg

Take a closer look at your USB to serial module. You might notice that the pins are "almost there" in the order that corresponds with Sonoff's serial breakout. You can "hack" the module to fit our needs by carefully bending certain pins. For example, if the 5V pin is where you need a 3.3V connection instead, you can bend the 5V pin out of the way to avoid accidentally supplying too much voltage to the Sonoff.

After gently bending the unnecessary pin, I insulate it and the board with some electrical tape to prevent it from making contact with other components. Now you're left with the pins you need - VCC, TX, RX, and GND - exposed and ready to be connected. Remember to match the VCC pin to the 3.3V output on your USB to serial converter, as the Sonoff Basic operates at this voltage level. 

This workaround is quick and dirty, but it gets the job done. Just remember to proceed with caution – we don't want to damage the USB converter or the Sonoff switch. And as always, double-check your connections before plugging anything in; precision is key in avoiding mishaps.

Next Steps

MVI_1100.MP4.00_00_46_02.Still001.jpg
MVI_1095.MP4.00_00_47_09.Still001.jpg
MVI_1092.MP4.00_01_02_20.Still002.jpg

Alright, we’ve finished setting up our Sonoff switches and found ways to connect them even without a special adapter. That means you can now use your switches with your favorite home automation setup and make your house smarter your way.

If you liked figuring this out with me and want to get more cool ideas for DIY projects or get better at making your home smart, make sure you hit that subscribe button on my YouTube channel. I've got lots more to share, and I'm always cooking up new things to teach and show you.

Thanks a bunch for hanging out with me, and if you’ve got any questions, or if there’s something you want to see next, just leave a comment below. Your thoughts really help, and I love chatting with you. So, let’s keep making things together, and I'll see you in the next Instructable.

Cheers!