Posted on 16 Comments

#34: Science or sorcery? Sonoff T4EU1C no-neutral wifi touch switch

The new Sonoff T4EU1C no-neutral touch switch seems to defy the laws of physics. It works with just a live wire, and doesn’t need a neutral wire.

How can that possibly work? And can we install Tasmota on it?

Let’s find out.

Resources

No-neutral power connections

Traditional house wiring has an active and a neutral that meander around the ceiling to each light location, with the neutral connected directly to the light. The active comes down through the wall to the light switch, and then the output from the switch goes back up the wall to the active side of the light fitting.

This works well with passive switches, but most smart light switches need a neutral connection to power their own electronics. With only the active wiring going to the light switch, it can be very difficult to replace existing switches with smart switches.

Building codes in many countries now require that all light switches must have a neutral connection, but this is a recent change so most existing houses don’t have a neutral wire at the switches.

Smart light switches that are designed to be installed in place of existing switches and don’t require a neutral connection are generally called “no-neutral” switches.

Sonoff T4EU1C

The Sonoff T4EU1C is a no-neutral smart light switch with WiFi, so it only needs the active-in and active-out connections that are already found at most light switch locations. It operates by drawing a small amount of power through the light even when the light is turned off, so that it can run its own electronics.

The T4EU1C consists of two PCBs joined together by an 8-way header. The top PCB is the low-voltage logic board, which includes the processor, WiFi antenna, 3.3V voltage regulator, touch sensor pad and driver IC, and the programming header:

The bottom PCB is the high-voltage mains board, which includes a 12V-output mains power supply, and a relay and Triac for controlling the active output to the load:

Re-flashing the firmware with Tasmota

WARNING: There are problems running Tasmota on this particular model. It worked for me, but many other people have problems with the touch switch even when Tasmota is installed correctly. The rest of the Sonoff operates properly and it can be controlled by WiFi, but the touch sensor doesn’t work. There are a few people collaborating right now to figure out why this happens. If you’re feeling lucky, you can give it a try. However, it’s possible that you won’t be able to use the touch sensor until this problem is solved. There is ongoing discussion about it on the SuperHouse Discord server so please join in.

Just like all other Sonoff models so far, the firmware on the T4EU1C can be replaced with alternative open-source firmware to add new features such as local-network operation, MQTT, etc.

However, out of all the Sonoff models that have been released this is perhaps the most difficult one to re-flash. It can be done if you have the equipment and ability to make soldered connections to very tiny parts on the PCB, and this particular board also seems to have some strange requirements to force it into bootloader mode.

The common process for putting a Sonoff into bootloader mode is to hold the GPIO0 pin low (ie: to GND) while powering-up the board. In my testing, I found that this would result in the Sonoff appearing to accept the upload of the new firmware, but a strange checksum error would occur in the flash memory and it wouldn’t boot properly afterwards.

The process that I’ve found to work requires making a connection to the RESET pin as well as GPIO0, so that it can be put into bootloader mode after it has already been powered-up and connected to the programming adapter.

Programming connections

Re-flashing the firmware on the T4EU1C requires the usual connections to the programming header found on the logic board as shown in the picture above, plus connections to GPIO0 and RESET to force it into bootloader mode. Connection to the programming header is easy, because it’s exposed on the logic board in the same format as almost all other Sonoff models.

The difficulty is gaining access to GPIO0 and RESET, because neither of these lines are brought out onto pads for easy connections.

The most convenient place to make a connection to GPIO0 is the very thin track that runs diagonally on the top side of the logic board. Use a scalpel to carefully scrape away some of the green solder mask along the track. Be very careful that you don’t cut the track, and don’t scrape away the solder mask from the surrounding copper areas. If you do, it will be much harder to connect a wire to the track without causing a short circuit to the surrounding copper.

RESET is even harder. The only place it is exposed is on the end of a tiny resistor labelled “R3”, with a very small gap to an adjacent resistor. The connection must be made very carefully and quickly. If the resistor is allowed to heat up for more than about one second, the solder on the other end will also melt, and the resistor will move.

To control the GPIO0 and RESET pins, I soldered a pair of momentary buttons together and connected 3 lengths of very thin wire-wrap wire to them:

  • The common (blue) wire is soldered to GND on the logic board.
  • One switched wire (yellow, in my example) is soldered to the GPIO0 track after scraping off the soldermask.
  • One switched wire (red, in my example) is soldered to the RESET line by attaching it to the bottom end of the resistor marked R3.

Be extremely careful when making these connections to the PCB. It’s very easy to damage the tracks or the parts, and if you don’t have the necessary equipment and skill to rework the board you may destroy your Sonoff.

Programming header connections

Use a USB-to-Serial adapter and jumper wires to connect the Sonoff to your computer. Make sure the USB-to-Serial adapter supports 3.3V mode, because the ESP8285 can be damaged if you connect 5V to it. The connections are the same as explained in previous videos:

In this case the power switch doesn’t matter, because we will use GPIO0 and the RESET line to force the Sonoff into bootloader mode.

The connections can be made with loose jumper wire, or you can use my Sonoff Programming Adapter which does the same thing.

Tasmota upload

The T4EU1C has the same pin assignments as a Sonoff Basic, so download the generic pre-compiled Tasmota binary.

Install the “Esptool” program, and open a terminal in the same directory as the Tasmota binary.

With the Sonoff connected to your computer as described above, and the buttons ready to assert GPIO0 and RESET, run Esptool as below:

esptool.py -p /dev/tty.SLAB_USBtoUART write_flash -fm dout 0x0 sonoff.bin

You may need to adjust the serial port address to match your computer.

Immediately after you press “enter”, follow this sequence:

  1. Press and hold both buttons that you have attached to the Sonoff.
  2. Wait about 2 seconds.
  3. Release the RESET button.
  4. Wait about 2 seconds.
  5. Release the GPIO0 button.

You should see Esptool immediately identify the processor on the Sonoff and begin uploading Tasmota. This entire process will take about 30 seconds. You should see output similar to this:

 esptool.py v2.6
 Serial port /dev/tty.SLAB_USBtoUART
 Connecting…….._
 Detecting chip type… ESP8266
 Chip is ESP8285
 Features: WiFi, Embedded Flash
 MAC: 2c:f4:32:a8:18:8b
 Uploading stub…
 Running stub…
 Stub running…
 Configuring flash size…
 Auto-detected Flash size: 1MB
 Compressed 515872 bytes to 355877…
 Wrote 515872 bytes (355877 compressed) at 0x00000000 in 31.3 seconds (effective 131.7 kbit/s)…
 Hash of data verified.
 Leaving…
 Hard resetting via RTS pin…

At the end of the upload, Esptool will report 100% completion and say that it is resetting the board. However, it can’t actually reset the board because it doesn’t have any connection to the RESET line. You can press the reset button yourself, or disconnect the Sonoff from the programmer and re-connect it to cycle the power.

The Sonoff will then begin the normal Tasmota setup process, creating a WiFi network and opening a serial connection through the programming header. Follow the usual steps as shown in the Tasmota documentation to set it up, selecting “Sonoff Basic” as the module type.

The T4EU1C should then behave as expected, with control using the touch sensor on the front panel and also via WiFi.

ESP8266 / ESP8285 boot messages

If the ESP8285 didn’t enter bootloader mode properly, the Tasmota upload may have appeared to work in the previous step but the Sonoff still won’t boot. Esptool can show its normal upload progress, ending with the message saying it is 100% complete and resetting the board. But then when you power cycle or reset the board, it never comes online and you can’t tell why.

While booting, the ESP8285 outputs debug information to the programming header at the unusual baud rate of 74880bps. Most serial terminal programs can’t operate at that speed, because it’s not a standard baud rate.

The “CoolTerm” serial console is available for Mac, Linux, and Windows, and can be configured to support 74880bps.

Download and install CoolTerm following the instructions on its site.

After it has been installed, find where the binary is located on your computer. On a Mac, it’s typically inside the “/Applications” directory.

In that same directory, make a text file called “baudrates.ini” and put in the number “74880” without quotes or any other characters. Save the file, then start up CoolTerm.

You should now find 74880bps listed as a supported baud rate in the “Options” menu.

Select 74880 as the baud rate, select the serial port for your programming adapter, and click “OK”:

Click the “Connect” button to open the connection to your Sonoff, and then press the reset button on the Sonoff to force it to reboot.

If the ESP8285 has failed to boot, it will display an error similar to this:

ets Jan 8 2013,rst cause:1, boot mode:(3,0)
load 0x40100000, len 27144, room 16
tail 8
chksum 0xef
load 0x00000000, len 0, room 0
tail 0
chksum 0xef
load 0x00000000, len 0, room 8
tail 0
chksum 0xef
csum 0xef
csum err
ets_main.c

It will then hang, and won’t proceed any further.

If you see this message, there is an error with the program stored in flash memory and you should try following the steps above to flash the Sonoff again.

16 thoughts on “#34: Science or sorcery? Sonoff T4EU1C no-neutral wifi touch switch

  1. Hi Jon,

    Thanks for another interesting episode about the Sonoff T4EU1C, I am intrigued as to why Itead chose to put the relay in at all – if the triac fails either shorted or open, the Sonoff won’t work, if the relay happens to weld it’s contacts together then the Sonoff will work as the triac will still control current to the load. If the relay fails in the open state then nothing works. The inrush current of a cold filament lamp is very high ( the 50 watt globe you used I think had a cold resistance of about 8 ohms giving a start up current of 30 Amps or 7.2 KW), but the triac still has to withstand that with or without a relay.

    Probably I am missing something, but I am interested in the comments of others.

  2. The guide is overcomplicated.
    > The common (blue) wire is soldered to GND on the logic board.
    You could use J2 header without soldering anything. 3 out of 8 pins are GND.
    > One switched wire (yellow, in my example) is soldered to the GPIO0 track after scraping off the soldermask.
    No need to scrape. GPIO0 is available at R10.
    > One switched wire (red, in my example) is soldered to the RESET line by attaching it to the bottom end of the resistor marked R3.
    Didn’t need the RESET line at all in my case. Conecting GPIO0 to GND was enough.

  3. I have bought and installed a T4EU1C. It works fine but interferes with DAB radio reception. The radio is about 5m distant from the switch, on a lower floor and is on a ring main circuit whereas the switch is obviously on a lighting circuit. Have others experienced this and is there a fix?

  4. I have followed the highly detailed instruction and get tantalisingly close to a solution (thanks for the instruction). I have managed to place the three jumper wires (I think). The GPIO0 connection is a bit of a ‘dog’s dinner’ but soldering to R10 seems to be the answer. However I can’t achieve a connection in programing mode. Can you clarify the process please?
    1. I connect using CoolTerm running in Windows 10. Connection is at 74880.
    2. If I press the reset button I get the following response:
    ets_main.c
    ets Jan 8 2013,rst cause:2, boot mode:(3,7) (I assume this is correct?)
    3. Pressing the GPIO0 button on its own elicits no response (Should it report it’s in programming mode?) Using the sequence suggested of holding down both buttons, after 2 seconds release reset and after a further 2 seconds release GPIO0 again results in no response.
    However:
    4. I tried using NodeMCU-PyFlasher (it has a 74880 option) and this reports ‘trying to connect’ until it times out.
    I feel I am on the cusp of success but suspect I am missing something. Any pointers would be very much appreciated.

  5. I flashed all of mine using.. the header for 3V3, Rx, Tx and GND.. and a jumper off the end of R10 (which is connected to GPIO0), straight to the GND on the header.. worked just fine first time on all 3.

  6. I have a problem and I could use some advice. I have soldered all cables like in the video with 2 push buttons. When I’m connecting my USB serial adapter to my computer all lights on the serial adapter remain lit. On the switch no leds are blinking. Basically it doesn’t do anything. The serial adapter gets warmer and warmer in time and it is not detected on the computer. What am I doing wrong? I have verified for short circuit but haven’t seen anything. Thank you for your help.

  7. Just flashed two T4EU1C’s with GPIO0 grounded at power on (no need for reset).

    One point of interest is that connecting to LED panel drivers, I didn’t need the supplied capacitor dongle but I did with a couple of LED bulbs.

    Connecting the T4EU1C to the LED bulbs without the dongle installed caused it to flash it’s LEDs a few times and forget it’s Tasmota settings! Had to connect to the tasmota-NNNN AP and reset everything.

  8. Hi,

    You didn’t mention anything about the 2nd IC, the one that’s controlling the Triac. All the magic is happening there. Could you tell me whats his PN?

    I’m asking this because I consider buying this kind of device but I didn’t decide yet if SONOF or the other model that has bicolor touch LED + triac’s instead relay ( I don’t know their brand name).

    Thanks.

  9. Hi
    Thanks you for your works 🙂
    Do you have a small schematic how this no neutral power act?
    Just the schematic to get the power all time.
    I just want to get my 220v in the switch
    Thanks

  10. Hi Jon,

    I am a newbie at this sonoff stuff. Is there by any chance this can be powered up with a 9-volt battery instead of the outlet from the wall?

  11. Hi John,
    I have encountered the same problem where the light hoes on and Off because the sonoff had not enough power to run. But it still does it with the capacitor installed.
    This is to control the lights in a swimming pool. There are two of them but they can work separately so they must be wired in parallel.
    I’m a newb but I was thinking their was either a problem with the capacitor or maybe this can’t be working with two lights or maybe I need two capacitors?
    Any idea on that one?

  12. Hi, thanks for the interesting explanation.
    I have a question due to the my Sonoff T4 is broken recently. It’s constantly rebooting due to the power supply. Looks like power is not there, when Relay is switch ON . I’v checked separatellty CPU board and it works.
    Based on your explanation my understanding that part of scheme which is responsive for the power supply in Relay Open mode is not working….
    I do not have ocsiloscope to check the gate of Triac, But my Triac shows ZERO resistance between catode and anodem. I do not have another module yet check if this OK.
    Could you please check on your device ?
    As you mentioned datasheet is absent….

  13. Hello,

    Is it possible to remove the touchpad sensor and change the Led (red color instead of blue) ?

    I want to use it for outside lighting and be notified by red Led when this is ON (because “blue” is too “smooth” to be clearly visible)

    Thanks in advance
    Greetings
    Armin

  14. Hi Jon,

    Thank you for such an in-depth review of the smart switch. I just installed 12 switches similar to the T4EU1C in my home (Smatrul brand). I have LED lights all over the house so I had to install the anti-flicker capacitors on the L1 circuit of my switches.

    Now, when I have several L1 circuit lights activated from various switches, some of the lights flicker. If it’s just one (sometimes two) switches that have their lights on, I don’t experience any flickering (even when I take slow motion videos of the lights there is no blinking) but the moment I turn more of those L1 circuit-connected lights on then some of them blink noticably. The L2 and L3 lights are unaffected no matter how many of them are turned on.

    I am wondering if it has anything to do with either 1) the size of the capacitor installed, 2) the number of capacitors/switches installed, 3) the difference in frequency (Smatrul is made in China so it’s possibly designed for 50Hz, but the frequency in my country is 60Hz nominal), or a combination of any of the three. Would you be able to hypothesize what is causing the flickering when mutiple loads are brought online and what may possibly be done to correct it?

    thanks!

  15. Typical domestic wiring are wrong (error in Anti-flicker module setup)!
    True wiring diagram by sonoff: https://ae01.alicdn.com/kf/Hadbe0f724b7d49e3a49903d64fff4937j.jpg

    1. Why do you say it’s wrong? What I showed in the video is exactly the same as that wiring diagram in your link.

Leave a Reply to shuum Cancel reply

Your email address will not be published. Required fields are marked *