Universal ESP-WiFi-device flasher

Quick and easy way to flash all those WiFi switches/sensors/whatever.

Public Chat
Similar projects worth following
Look around for WiFi remote switch sockets, sensors, gateway devices, you'll likely find ESP8266 / 8285s inside (sometimes also ESP32, but not that often as that's usually overkill). This is nice, as pretty much always we can forget the restricted propietary services their manufacturers offer and flash our software in to make them do exactly what we want.
However, the process of flashing using your generic USB UART and a handful of wires isn't that convenient, as the devices rarely have a suitable flashing header inside, and even then you'll need to keep GPIO zero grounded while booting up the device for flashing, all which generally require a lot of dexterity and/or soldering inside the device, which likely won't happen before removing every single screw and piece of casing.
I did that and got fed up before finishing the first one - the idea of how this should be done already forming, that's how engineers think.

Using the device:

- Fire up your favourite flashing program, like Arduino IDE or Tasmota-Pyflasher

- Plug the UART cable/PCB to the device

- Plug an adapter to the device's Gnd-Tx-Rx-Vcc pins, if needed (many devices don't)

- Plug the GPIO 0 wire to the device and target/adapter, if needed (some have a button for GPIO 0)

- Connect the rest of pins to target, at least test fitting before connecting power

- When connected OK, hold it and plug in USB (for the next ones you already know how it works so can keep it connected)

- Switch ESP to flashing mode: press down power button (LED should go off), press down GPIO zero button, release power button (LED should shine again), release GPIO zero button.

- Start flashing

- After flashing, the device can be switched to normal mode by pressing the power button for a second or so to empty capacitors. Most WiFi switches don't serial output though, these you'd generally unplug, assemble and plug to wall.

  • 1 × Dual side dotted proto PCB. Piece of about 5x10 dots.
  • 1 × 2.54 mm header male Sections of 5 + 4 + 3
  • 1 × LED, any small enough one I preferred SMD but if you can fit through-hole then fine.
  • 1 × LED current limiting resistor 100-220 ohm or so, according to diode voltage drop (start from 220, decrease if too dim)
  • 2 × Button switch For power and GPIO zero.

View all 13 components

  • 1
    Get parts, plan
    Universal ESP Flasher - front, annotated
    Universal ESP Flasher - back, annotated

    This device is something that a random MCU hacker could assemble from parts lying around, so find suitable parts, find their pinouts (regulator, FET, UART) and plan how they shall be placed on the PCB.

    - I recommend dedicating one edge to ground, to keep it clear which end is ground.

    - RX/TX traces according to the UART, I used an FTDI cable but use what you have.

    - I included both female and male headers for UART; male for home/office use, where I have FTDI cables around, and female for PCB UARTS in my EDC (EveryDay Carry) box.

    - Convenient to have the target end just 4 holes wide to allow it fit tight places (my through hole LED resistor is already PITA)

    - GPIO zero could be the fifth pin in the row, but then the header wouldn't fit Sonoff Basic style four hole layout (sure could have an adapter for that)

    - Many USB UART cards/cables do provide also 3.3 Volts, but their regulators may not be up to the task of flashing ESP chips, and nobody wants "almost perfectly" flashed devices. If you know your UART has beefy enough 3V3, and only use that, you'll probably be fine without the LDO.

    - This MCP1825S LDO (Low DropOut) regulator has a convenient in-gnd-out layout, AMS1117 (which your target device very likely contains, it's cheap) is slightly more awkward. I don't like the power hungry AMS1117 but in this kind of application bad efficiency wouldn't really matter.

    - Most LDOs don't mind their input and output being shorted as they don't sink too high output, but just be happy that it's high enough. This was used to add 5V output option; adding a jumper to two of the header pins will change output to 5V, should something require that (most devices don't). I'd suggest investigating and testing if your LDO allows shorting In & Out.

    - LED I originally didn't have but never remembered which button was which, the LED clearly shows it. And warns there's power on, preferably power down before attaching target device

    For firmware and flashing software there are various options; for "production" devices I have been using Tasmota firmware and Tasmota-PyFlasher or Tasmotizer for flashing, but also ESPurna, ESPHome, ESPEasy, Homie (and others I forgot or haven't heard about) have their strengths, check some comparisons to find out the one (or two) for you. For ultimate flexibilit you can of course write your code, there a framework library like ESPHomeLib might help concentrating on getting the task done.

    As I'm most familiar with Tasmota and that I have flashed in all the devices mentioned, I'm including device templates for Tasmota.

  • 2
    Schematics, assembly instructions etc
    For now the schematics:
  • 3
    Flashing BlitzWolf BW-SHP6 15A / Pro

    BlitzWolf BW-SHP6 Pro (15A version of the original 10A SHP6) is an excellent WiFi switch with power measurement. I don't much care about the switch functionality but current monitoring is extremely useful in home automation - to notify, when a washing machine is ready, alert if fridges are working abnormally (like if someone needed the cellar freezer's socket "temporarily" for something else, which has happened), to record washing machine power usage cycle to figure out when would be the best time to run them with solar power, to monitor when a pump somewhere in your cellar runs, to have feedback, if a device switched on really runs..). The 15A version BTW has more accurate current, at least on low currents; with no current the 10A one shows a wildly varying 0 - 6 Watts sawtooth, but the 15A measures rather stable 0 W, with random spikes of 1W.

    Anyway, the 10A version basically required a printed jig for flashing, but in this 15A version the pads are inconveniently close together for a printed jig, sure it's possible, but saw another way not requiring tedious slow speed printing:

    Just five pogo pins soldered to a female header, whose pins are bent against the pogos to support them. Easily available parts (just be sure to get pointed pogos, not crown), easy assembly, makes a tiny adapter fitting any EDC electronics box, quick and easy to use. This works fine, but the 3D printed ones (a good looking one I saw in Thingiverse) may be more convenient for those who need to flash lots of sockets (I got less than a dozen), and those who totally shouldn't be disassembling mains powered equipment.

    Timed flashing of five such devices in boxes - the whole process of "opening box-unscrewing-removing the transparent piece-removing the pink foam if needed-connecting flasher-flashing-putting back the pink foam if removed-putting back the transparent piece-turning the screw back" took 75-90 seconds per device (mostly depending on in which position the screw happened to be, when screwing back), of which the actual flashing (Tasmota 8.3.1) took 54-55 seconds.

    The adapter attached to the Universal ESP Flasher:

    (The through hole resistor doesn't connect to the dupont wire, even if looks that way)

    And, how to flash:

    1. Open the SHP6: there's a screw hidden in a hole at the prong side - unscrew that and pull off the transparent top.

    2. Remove the pink piece of foam, if covering some of the six pads, preferably don't lose it.

    3. As below, but with UART first disconnected, point pogos at the pads, one by one, starting from one end. The first one might seem awkward but the third will take maybe ten seconds.

    4. When UART connected, flashing software waiting for a keypress and pins aligned, with the free hand first press down the power button next to the LED, then the other button (GPIO zero), then release the first, last release the other button. We should be in the flashing mode now.

    5. Start the flasher. If doesn't start, try #4 again. If still not after a couple of #4, continue with standard troubleshooting procedures.

    6. When done, remove the flasher, find the pink foam (hiding in the pile of dupont wires probably), put it back, put the transparent case back, screw the screw fully in (in this phase the screw has probably twisted 90 degrees, use the screwdriver to position it correctly), plug to wall to see if the chosen firmware acts as expected.

    Tasmota template for this model, blue light for switch status: {"NAME":"Blitzwolf SHP6 15A","GPIO":[158,255,56,255,132,134,0,0,131,17,0,21,0],"FLAG":0,"BASE":45}

View all 9 instructions

Enjoy this project?



Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates