Etekcity Voltson - ESW01-USA

I am not responsible if you electrocute yourself or burn your house down with the following information.

If anyone is interested, I managed to flash an EtekCity Voltson smart plug, ESW01-USA with tasmota firmware. Tasmota works within smartthings directly, with no bridge server.

These contain an ESP8266.

Identified GPIO’s:
GPIO4 – Relay and Yellow LED
GPIO14 – Button

Pinouts are shown below. VCC is the only difficult one to reach while attached to the plug.

I’m wondering if we can feed the VCC 3.3 somewhere else, likely from the bottom to go through the voltage regulator?

5 Likes

Alternate VCC, much more accessible while assembled in the plug.

2 Likes

I tried that point, without luck. Ended up with it plugged in a power strip on my desk and grounded it to the ftdi.

I was just successful in flashing one of these plugs with Tasmota. Instead of trying for one of the 3.3 V points, I just fed 5 V to the larger pad that feeds into the 3.3 V regulator. Right now I have the relay and button working. Any luck with power monitoring?

I mapped out the 8 pads that connect the ESP board to the rest of the device. They are (in order starting from the pad closet to the antenna):

  1. Vin
  2. GND
  3. GPIO16
  4. GPIO14 (Button)
  5. GPIO12
  6. GPIO5
  7. GPIO13
  8. GPIO4 (Relay/LED)

So that leaves 4 unknown GPIOs. I probed each of these (while running tasmota firmware) and see nothing, except for GPIO12, which has a 3.3 V, 50% duty cycle square wave with a frequency of 2.12 Hz. I’m not sure how to proceed from here. Two ideas:

  • Probe these unknown pins while running stock firmware. I still have an unmodded outlet to try.
  • Flash an I2C port scanner to see if there are any I2C devices connected.

Maybe the easiest way is to just try the different combinations for GPIO16/12/5/13. I think it needs to be done from within the source code though.

This could be added to sonoff_template.h, and the USER_GPIO’s can be manipulated.

{ “EtekCity”, // EtekCity Voltson (ESP8266)
0, // GPIO00
0, // GPIO01
0, // GPIO02
0, // GPIO03
GPIO_REL1, // GPIO04 Relay/LED
GPIO_USER, // GPIO05 Unknown
0, 0, 0, 0, 0, 0, // Flash connection
GPIO_USER, // GPIO12 Unknown
GPIO_USER, // GPIO13 Unknown
GPIO_KEY1, // GPIO14 Button
0, // GPIO15
GPIO_USER, // GPIO16 Unknown
0
}

So is there some component on the main switch(not the esp8266) that collects the power usage data and sends to esp8266? If so, are you able to identify what that component is? If so, maybe we can cross it against what tasmota supports for the Sonoff Pow.

When setting the unknown GPIO’s to Relay2 and toggling from web gui this is what I found:
GPIO5 - Blue LED
GPIO12 - No apparent effect
GPIO13 - No apparent effect
GPIO16 - No apparent effect

GPIO13 - Power (GPIO_HLW_CF)

This populates the “Power” in watts.

However, there are 2 other variables that need set from what I can tell
GPIO_HLW_SEL
GPIO_HLW_CF1

I think GPIO_HLW_SEL is required to get the Power monitoring table to display.
In addtion, I think both GPIO_HLW_SEL and GPIO_HLW_CF1 need set correctly to populate “Voltage” and “Current”.

This is my current entry in sonoff_template.h
{ “EtekCity”, // EtekCity Voltson (ESP8266)
GPIO_HLW_SEL, // GPIO00 Unknown
0, // GPIO01 Unknown
0, // GPIO02 Unknown
0, // GPIO03 Unknown
GPIO_REL1, // GPIO04 Relay/LED
GPIO_LED1_INV, // GPIO05 Blue LED
0, 0, 0, 0, 0, 0, // Flash connection
GPIO_HLW_CF1, // GPIO12 Unknown
GPIO_HLW_CF, // GPIO13 HLW8012 CF (Power)
GPIO_KEY1, // GPIO14 Button
0, // GPIO15 Unknown
0, // GPIO16 Unknown
0
}

Not sure how how missed that blue LED on GPIO5. Good, now there are 3 unknown GPIOs.

Yes, this is what I am thinking. Unfortunately, everything is hidden between the main PCBs of this unit. Pictures here show the internals of a slightly different version, but I cant read what is written on the ICs.

The Sonoff Pow uses the HLW8012, which requires 3 pins to interface with the microcontroller, CF, CF1, and SEL. CF and CF1 both output a square wave which frequency indicates the power on CF, and current or voltage on CF1, depending on if SEL is high or low. With any luck, this chip is also used on these outlets. I am finding a 2.11 Hz square wave on GPIO12 (when not plugged in to mains), so it’s possible. I think trial and error on assigning GPIO_HLW_CF, GPIO_HLW_CF1, and GPIO_HLW_SEL to GPIOs 12, 13, and 16 will determine this.

Update: I tried all 6 permutations of assigning CF, CF1, and SEL to GPIOs 12, 13, and 16, and plugging into mains. No combination reported any value for voltage, except for when CF1 was connected to GPIO12; it would read 1 V when the relay was on. The energy counter also slowly went up (0.001 kWh/min or so) when CF was connected to GPIO12.

Update2: I plugged the outlet into mains and a load into the outlet and probed each of the unknown GPIOs. GPIO12 now has a 1.0262 kHz square wave, GPIO13 had a square wave that varied with power to the load. GPIO16 had nothing. When I pulled GPIO16 high or low (thinking it was SEL), the output on GPIO12 did NOT change as expected. I reflashed, setting GPIO12 to CF1, GPIO13 to CF, and GPIO16 to SEL. Values for Voltage, Current, and Power displayed but did not make any sense. I tried calibrating the measurements by sending the MQTT commands but now the values just seem to jump around randomly. Additionally, the values are all 0 unless the relay is toggled ON.

I’m completely new to esp8266 and arduino… I’ve destroyed a couple of these plugs (and a motherboard and a FTDI module…) trying to get one re-flashed. Learning can be expensive! I finally succeeded in getting ESPEasy with its HLW8012 plugin flashed to it. Got it working with openhab2 and MQTT as well. Anyways, I took one of my nonfunctional plugs and ripped it open – I can confirm that it does indeed have a HLW8012 chip.
20180224_215055

I tried various combination of GPIO12/13/16 to SEL/CF/CF1 and got results similar to copperheadtnp :frowning:

Loving this thread!

I don’t particularly care for power monitoring, so no huge loss there… they do however have the advantage of being far easier to use than the sonoff basic, too bad neither of them have UL rating.

I attempted to add in the etekcity entry as you suggested but met with many compiler errors, and since I don’t have the gumption to sift through all the code to do it properly, I decided to make the changes in the “sonoff rf” configuration.

Upon successful compile and upload I ran to the outlet to attempt setup, however in my haste I realize that the default configuration uses different gpio states, and as such… The button on the front does nothing!

I will reprogram this after more fiddling, thought it would be wise to mention for others who attempt this!

Thanks for all of your hard work this far, I will chime in when I get mine working

EDIT:
Because i added my home’s WIFI details to the sketch, i was able to log in and switch this to the entry i edited for this module’s use. Success! No messing around with code

I was able to reprogram all four of my switches this way and in doing so can now use these with smartthings.

Thanks!

Glad everyone has been successful in flashing new firmware. Really interesting that this uses the HLW8012 chip but doesn’t seem to work with the plugins! These plugs are still a good deal but it would be nice to have power monitoring working.

what is the actual process to flash/.

looks like there is some conflicting information in this thread?

I just want these darn plugs to stop disassociating themselves from the vesync app

For flashing, I 'd use copperheadtnp’s method where he recommends feeding “5v to the larger pad that feeds into the 4.4 V regulator” combined with the first post from BLawson. I would NOT* try to flash with this plugged into mains (again) – I must’ve had a bad solder joint or something but that’s how I fried 1) my etekcity plug, 2) my FTDI programmer, and 3) my motherboard all in one go!

etekcity -> FTDI

TX -> RX
RX -> TX
GPIO 0 -> GND
GND -> GND
pin on bottom in copperheadtnp pic -> 5V source

Also found this link which is interesting: https://github.com/mcolyer/voltlet

2 Likes

That’s pretty much it. You need to solder or otherwise securely attach some wires to the 5 pins identified above, then attach them correctly to your USB-> serial converter of choice. I actually use an Arduino board with the main chip removed. I then used the directions here: https://github.com/arendst/Sonoff-Tasmota/wiki/Arduino-IDE to flash tasmota. But you can use this method to flash any firmware.

And yes, do not connect any wires with this thing while it’s plugged into mains. I believe it has the same issue as the Sonoff Pow described here: https://github.com/arendst/Sonoff-Tasmota/wiki/Sonoff-Pow.

I followed everything, but unable to upload the sketch

this is the error I am receiving

Edit

I was able to get this to work

I actually had to run a jumper between reset & gnd on the mega

its uploading the FW now, its at 96%

ok all looks well…

time to do the other one

Both done…

image

running a 3d printer while wathcing the Power, i am seeing fluctuations from 5-200w all over the place and not consistant to the load as the printer is heating/not heating the bed

@Blawson327
I am running your settings above in the template.h. If you find better settings, please be sure to post it

Thank you

Hi all, I see you linked to my project above. If you’re interested in taking a slightly different tact here, rather than flashing these plugs you can run this server locally on your network and control them via MQTT:

In order to make it work you have to remap server2.vesync.com to the server hosting voltlet and then away you go.

I haven’t gotten around to publishing the power readings to MQTT but it shouldn’t be too much additional work if people here are interested.

Did you found a way to get the power monitor working correctly?

there is only one transistor for yellow and relay and they are connected, the SEL needs to go threw transistor to convert logic to 3.3 but there isn’t one, i think they pulled SEL hi connecting it to vcc all the time it outputs current only, it might just guess voltage at 120v or can gets ithe volts from the analog pin?