Adding RF to a non-RF ITEAD Sonoff

Yes, sure! You can buy a Sonoff RF and you are good to go, I guess. But I didn’t and I was not so sure about the no-named RF receiver so I ended thinking about adding my own.

But first things first. The Sonoff is an ESP8266 based smart switch by ITEAD which comes with custom firmware that communicates with the manufacturer cloud to provide “smart” capabilities like remote switching or scheduling. The cool thing is that it has a line of pins that expose the VCC, GND, RX and TX pins of the ESP8266 and a buttons attached to GPIO0 so very soon it got hacked and there are a number of firmware projects already available. I’m not an early adopter and some work has been done and reported by Peter Scargill, Javier or even in instructables.

The ITead Sonoff Smart WiFi Switch after a small hack to use the Avidsen RF remote to toggle it

The ITead Sonoff Smart WiFi Switch after a small hack to use the Avidsen RF remote to toggle it

About two months ago I bought 3 Sonoffs TH, the ones ready for mains switching but without RF receiver. When they arrived I reckon I tried ITead eWeLink App for Android but in less that 5 minutes I decided I had nothing to loose getting rid of it and flashing my own firmware.

Truth is that I’m living my own ESP-fever so I immediately plugged it to an FTDI adapter and tried a simple program. Goodbye eWeLink and guarantee voided (does it have any?).  When I started figuring out what use could I give them I thought I could embbed them behind the switches in the wall but they are a dime too big and they use simple SPST relays, so no commuting (that’s a fail).

So next thing were lamps and other plugged appliances, starting with a warm lamp in the living room. But this particular lamp was already plugged to a RF switch and switched on/off from a remote. I realized I did not want to loose that. Having to unlock the phone to switch on the light sounded a bit weird. Why didn’t I bought the Sonoff RF instead?

Well, because I was not sure about the RF module it uses. How to handle it from custom code? Will my remote work with it (probably not) or will I have to buy theirs?

Time for a little hacking!

First step was to redo all the work I had already done when I started with these remote. It worked fine with Arduino but not with the Sonoff until I realize the 433MHz receiver I was using required 5V to operate. Mmm… No worries, even thou the ESP8266 works at 3V3 I remembered that in the schema for the Sonoff the AC/DC transformer feeds 5V to an LDO, so I could get the 5V from there.

Front view of the Sonoff board with pin descriptions

Front view of the Sonoff board with pin descriptions

Back view of the Sonoff board with pin descriptions

Back view of the Sonoff board with pin descriptions

Second problem was where to plug it. The answer was the line of holes where the RF module is in the Sonoff RF. Only two of those pins are tied to the ESP8266, the closest to the relay are GND and 3V3. Could I be so lucky? NO. The receiver I have is the standard RFLink [Aliexpress] and such and has 4 pins: GND, DATA, DATA and VCC. Besides, the module just did not fit so close to the relay so the first pin would go in the second hole (the 3V3 hole)… OK, time for the X-Acto knife, the iron and the dremel.

RF receiver

The RF receiver. I removed the black plastic around the pins to solder it closer to the board, otherwise it won’t fit in the case.

First I cut the traces leading to the 3V3 pin in the RF row of holes (that’s the second hole counting from the relay). There are surface traces on both sides of the board, so I had to cut both and then bridge them together again. Then I soldered the module in the 2nd, 3rd, 4th and 5th holes. I brought GND from the 1st to the 2nd hole, I then connected the DATA pin to the GPIO14 in the perpendicular row of pins through a voltage divider to ground to lower the 5V from the module to 3V3. A 10K and 20K 0805 SMD resistors do the job, but it was really hard to solder them between the pins… Next I soldered the VCC pin of the RF module to a spot in the board I checked was connected to the 5V rail.

Sonoff Hack

Check the cut just by the LDO, there is another one in the same spot in the other side of the board. But cutting those traces removes power from the ESP8266 so I had to wire it again (it’s the white wire in the right). The other white wire powers the RF module with 5V. You can also see the GND bridge between pins 1 and 2 in the top row and the voltage divider from the DATA line to the GPIO14 and GND pins.

Sonoff hack

I also had to dremel a bit the case to allow some room for the module

Done. A bit of a mess but it worked!

"My" Sonoff RF

“My” Sonoff RF

But the maximum distance from the remote to the module was something in the 20cm… until I soldered a 17.3cm wire to the antena hole in the RF module (that 1/4 of a 433MHz wavelength). Now I can be 10 meters away, even with a wall in between and I can still switch it on. And before you say anything: yes, range should be better for a 433MHz module but it’s fine, after all I can still switch it on/off from Australia via the Internet.

ESPurna Firmware

There are some fine control firmware projects out there for the ESP8266.  Some of them are generic and let you manage the pins one by one, some of them are more specific for “smart switches” based on the Espressif chip. Most of them have MQTT and Web configuration. Some are small enough so you can flash them Over-the-Air to the 1Mbyte Sonoff. None of them (at least I haven’t found any) have RF capabilities.

So I decided to build my own. After all that’s fun. I’ve named it ESPurna (“espurna” means “spark” in catalan) and it features:

  • WebServer for configuration and simple relay toggle
  • Flashing firmware Over-The-Air (OTA)
  • Up to 3 configurable WIFI networks
  • MQTT support with configurable host and topic
  • Manual switch ON/OFF with button
  • Support for custom RF module (check blog post)
  • Visual status of the connection via the LED
ESPurna status page

ESPurna status page

ESPurna administration page

ESPurna administration page

As always, if you are interested in the firmware it is in a espurna repository in bitbucket.

“Wiring” it.

Final step is to “wire” it all together. The Sonoff with the ESPurna firmware connects to my home WiFi and subscribes to a certain MQTT topic. Upon reception it switches on or off the relay depending on the message payload (0 for OFF, 1 for ON, 2 for TOGGLE). Whenever the relay state is changed it also publishes the new state to the same topic (there is code to avoid recursion). So if you change it manually pressing the button or with the RF remote you still have a record of that.

In my home server I have Node-RED running. A few months ago I switched from a bunch of python scripts to Node-RED for message persistence (in MySQL), notifications and to push data to some online services like Xively or

With MQTT and Node-RED working adding support for Blynk was a piece of cake. In 10 minutes I had a simple dashboard in my phone from where I could switch the lights on and off. In fact, I’ve spent way more time moving around controls in the dashboard canvas trying to make it look cool (I failed).

Node-RED blynk link

My blynk configuration in Node-RED. So easy!

You know something is well designed when things fit in like magic.

Wow. I feel like I should explain many more things about this project, but there will be a follow up so stay tuned 😉

CC BY-SA 4.0 Adding RF to a non-RF ITEAD Sonoff by Tinkerman is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

59 thoughts on “Adding RF to a non-RF ITEAD Sonoff

  1. Pingback: Dumbing Down a Smart Switch | Hackaday

  2. Pingback: Dumbing Down a Smart Switch | BH

  3. Pingback: Dumbing Down a Smart Switch - SHelfinger

  4. Peter


    Your idea is good but you ended up using a RF receiver that’s worse quality than the one supplied by ITEAD. From the photos, your receiver looks like it’s using an LM358 but apologies if not. If you replace it with a proper superhetrodyne receiver based on either a SYN500R or MAX1473 chip then your range would quadruple. I have devices that communicate over 70M. Good work otherwise.

    1. Xose Post author

      You are probably right. I just used the one I had available. Thanks for your comment.

  5. Pingback: ITead’s Evolution | Tinkerman

  6. Pingback: New firmware for the Slampher | Tinkerman

  7. hjgode

    Hello and many thanks for this code set. There is no issue tracker in bitbucket for espurna. I had problems with git submodule update, the nofuss did not work (permission denied). I then had to use git clone manually for nofuss. Everything compiled then without error.


    1. Xose Post author

      My bad. The problem was that I linked the SSH URL of the repository (you’d need to be logged to check it out) instead of the public HTTPS one. It should be fixed now. Thank you!
      I also activated the issue tracker in the repo.

  8. hjgode


    many thanks for the code. Unfortunately the development/compile description does not work for me. I had to clone nofuss manually as “git submodule update” gives a permission denied when trying to clone nofuss. Possibly an issue with the gitmoduls file and the used URLs.

    Everything worked fine from then, but I had to flash my sonoff three times until I got the web page.


  9. hjgode

    Hello again (sorry for bothering…)

    I bought one SONOFF RF to look at it. It comes with an ITEAD 433MHz 2-channel receiver they also sell separately :-). The RF module has an OOK/ASK receiver and an EFM8 (busy bee) that outputs D0, D1, D2, D3 and SW (a switch) and LED. The D0-D3 are goind to another EFM8 on the SONOFF. The switch off the RF receiver board (yes, there is another one) is connected to the momentary switch via a 0Ohm R9 to GPIO0. The switch on SONOFF is not connected to GPIO0 as R21 (another 0Ohm) is missing.
    The RF433 switch can be used to start pairing with ITEAD’s remote. D0 to D3 are then mapped to the remote A, B, C and D switch. The RF433 should switch D0-D3 to ground for ~200ms.
    I assume they use there standard RF433 receiver with no re-programming. Then the EFM8 on the SONOFF will look for these D0-D3 inputs and toggle the light.

    The idea is now to redraw the one of the RF433 D0-D3 outputs for example to GPIO14. First I would disconnect D0-D3 by cutting the angled pin header at the RF433 modul. Additionally remove R9 (so the switch on the RF433 will no longer have any connection to GPIO0) and add R21 back to get the SONOFF switch to GPIO0 for flashing and … Then the espurna code needs to be changed to toggle the relay with the input pulse on GPIO14. The EFM8 will not have any more connection to D0-D3 nor the RF433 switch, so it will not interfer with the espurna code. The SONOFF busy bee will become a ‘sleepy’ bee ;-))

    Do you think that will work?


    1. Xose Pérez Post author

      Hello again!
      The schema you are drawing is the same as in the Slampher I reviewed a few weeks ago.
      I don’t see the need for your hack. The busy bee on the Sonoff will pull down the GPIO0 line when the paired button in the remote or the hardware button is pressed, toggling the relay with no firmware modification.
      The only feature you lose is the ability to handle long clicks or double clicks on the hardware button since it is tied to the EFM8 and not the ESP8266. Apart from that the firmware works without change.

  10. Lieven

    Nice work !

    I get some errors while compiling with platformio:

    /export/espurna/code/src/main.ino: In function ‘void setup()’:
    /export/espurna/code/src/main.ino:148:21: error: ‘nofussSetup’ was not declared in this scope
    /export/espurna/code/src/main.ino:154:17: error: ‘rfSetup’ was not declared in this scope
    /export/espurna/code/src/main.ino: In function ‘void loop()’:
    /export/espurna/code/src/main.ino:175:20: error: ‘nofussLoop’ was not declared in this scope
    /export/espurna/code/src/main.ino:181:16: error: ‘rfLoop’ was not declared in this scope

    Any ideas ?

    1. Xose Pérez Post author

      You are compiling the project with the ENABLE_NOFUSS and ENABLE_RF options enabled and the PlatformIO *.ino preprocessor does not find the function names because they are indented! OK, I’ve fixed it in the repo. Just check it out again. Thanks for the info. Will do a bug report to about this.

  11. Heinz-Josef Gode


    I checked out the code yesterday.

    Using “platformio run –target uploadfs -e sonoff-debug-ota –upload-port” gives a lot of warnings about redefines.

    first error:

    platformio run –target uploadfs -e sonoff-debug-ota –upload-port
    [Wed Nov 2 08:09:12 2016] Processing sonoff-debug-ota (build_flags: -Wl,-Tesp8266.flash.1m256.ld -DDEBUG_PORT=Serial -DSONOFF, lib_install: 19,44,64,89,549,727, upload_flags: –auth=fibonacci –port 8266, platform: espressif8266, upload_speed: 115200, board: esp01_1m, framework: arduino, extra_script:, upload_port: “”)
    Error: Unknown platform ‘espressif8266’

    Need to replace all espressif8266 by espressif in platformio.ini

    next error in gulp buildfs2:

    platformio run –target uploadfs -e sonoff-debug-ota –upload-port
    [Wed Nov 2 08:11:17 2016] Processing sonoff-debug-ota (build_flags: -Wl,-Tesp8266.flash.1m256.ld -DDEBUG_PORT=Serial -DSONOFF, lib_install: 19,44,64,89,549,727, upload_flags: –auth=fibonacci –port 8266, platform: espressif, upload_speed: 115200, board: esp01_1m, framework: arduino, extra_script:, upload_port: “”)
    before_build_spiffs([“.pioenvs/sonoff-debug-ota/spiffs.bin”], [“data”])
    gulp buildfs2
    [08:11:28] Using gulpfile ~/bin/espurna/code/gulpfile.js
    [08:11:28] Starting ‘clean’…
    [08:11:28] Finished ‘clean’ after 20 ms
    [08:11:28] Starting ‘files’…
    [08:11:28] Starting ‘inline’…

    dest.on(‘unpipe’, onunpipe);
    TypeError: Object 0 has no method ‘on’
    at DestroyableTransform.Readable.pipe (/home/hgode/bin/espurna/code/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_readable.js:516:8)

    I can compile with changing buildfs2 to buildfs in

    def before_build_spiffs(source, target, env):
    env.Execute(“gulp buildfs”)
    # replaced buildfs2

    But MQTT does no work: I do not get a state nor can I switch the relay (normal sonoff, no DHT etc.).

    What is wrong?


    1. Xose Pérez Post author

      First, it looks like you are not using latest PlatformIO version since they renamed the espressif platform to espressif8266 a few months ago.

      Second, the error with the Vinyl module might be due to a dependency version mismatch, but I’m not sure.

      Third, have you configured properly the MQTT broker? either by the default values or through the web interface? Same for the DHT sensor.

  12. Bartman

    Hi there. I’m doing some research about thins sonoff before buying, and came multiple times at this firmware.

    I’m currently not using any mqtt in my house, but I’d like to control the relay just by http.
    Can I turn on or off the relay via an http (curl) command, initiated on my raspberrypi (wich is currently my center of the house 🙂 ).

    Thanks for the response

    1. Xose Pérez Post author

      Hi, thanks for your question.
      Actually you can. You can turn the relay on and off using “http://IP/relay/on” and “http://IP/relay/off”.

        1. Xose Pérez Post author

          Not at the moment but will add this feature in the next release.
          Also, I was thinking about adding a proper REST API.

  13. Ryan

    First off your firmware looks great. I am still waiting for my sonoff to arrive. Thanks for all the work and the writeups along with it.

    What kind of support does espurna have for gpio14 on the single relay sonoff module? I would like to use this module to control house lights. I was hoping I could connect 14 to the old light switches and then monitor the state of 14 throug mqtt. When the state of 14 changed send back a mqtt message to toggle the relay. Some cases would involve 3-way light switches.

    Thanks for the help,

    1. Xose Pérez Post author

      Hi, tkanks!
      I would create a custom board definition in the “/code/src/config/hardware.h” file specifying the GPIO for all the relays you are going to have. So if you will have a Sonoff with a relay on GPIO12 plus and external relay on GPIO14 you could:

      #elif defined(SONOFF_WITH_EXTERNAL_RELAY)

      #define MANUFACTURER "ME"
      #define DEVICE "SONOFF"
      #define BUTTON_PIN 0
      #define RELAY1_PIN 12
      #define RELAY2_PIN 14
      #define LED_PIN 13
      #define LED_PIN_INVERSE 0


  14. Kees

    Your bitbucket repository has a ton of files. I am kinda at a loss which one to pick or even where to start.
    I presume I have to load them al in the ide with espurna.ino as the main file calling the others?

    1. Xose Pérez Post author

      You are right. If you are using Arduino IDE just load the espurna.ino file and the rest will load as tabs in the project.
      You might want to check the documentation about flashing ESPurna using the Arduino IDE. Please note there are some dependencies (libraries) you will have to have in your system in order for ESPurna to compile successfully.

  15. Juan Pedro Martín

    Hello Xose,

    The first thing I want to do is thank you for your wonderful job.

    I would like your opinion. I’ve search for a 433 receiver at 3.3v to ease the inclusion of a rf to the sonoff.

    I’ve found a module that seems to fit perfect for sonoff. The conector is:
    GND DATA DATA VCC GND ANT that fits perfect in the rf holes of sonoff
    – – – VCC GND

    My opinion is that there is nothing to do (for example,no need to cut 3.3v traces). Only welding VCC in VCC hole, GND in GND hole and DATA to GPIO 14 even without resistor divisor.

    The module is H3V4F. The datasheet can be found here

    And can be bought in China, Europe and Spain easily for less than 2USD.

    Am I right in this? “Only welding VCC in VCC hole, GND in GND hole and DATA to GPIO 14 even without resistor divisor.”


    1. Xose Pérez Post author

      Hi Juan
      It looks like a good match. Not sure right now but you might need to wire the DATA pad in the module to GPIO14 in the 5-pin header.
      Anyway you might want to check the original RF module from Itead: It’s the one their use in their Sonoff RF. Its just for reference since you would need a secondary controller to decode the signal.

      1. Juan Pedro Martín

        Thanks Xose,

        I already have tested a sonoff rf but it is not valid for my project. The problem of sonoff rf is that the decoder chip has a closed code. You pair a code and that code is used once for open the relay and the following to close it and so on like sonoff button does.

        My goal is to control one room light with a sonoff adding a Rf and include the decoding and the logic on the esp8266. I will try a rf lib ported to esp8266 for decoding, although I thought your espurna code was able to decode. Doesn’t it?

        The sonoff + rf will receive 2 rf signals codes. The first from a cheap(7$) 433 pir sensor to detect presence and switch on the light. This signal is sent every n second while there is presence.
        The second from a cheap (5$) rf button with wall switch shape(is not a switch, only a rf button but it is located removing the external part of the current wall switch). This signal will close and open the sonoff relay. If the relay it is activated by the wall button, the pir signal will be ignored until relay was deactivated with the wall button (it is a way of forcing manual mode)

        Furthermore I plan to add a new mqtt topic published by the sonoff showing the presence in the room obtained from rf pir sataus(for example for alarm propose)

        So the sonoff will act as relay + rf concentrator and domotic is done with very few money.

        1. Do you find my project recheable? Or you find any problem I didn’t realize?
        2. Does espurna decode the rf received by GPIO14 or should I use another library(for example ?

        Thanks so much for your help!

        1. Xose Pérez Post author

          I use the RemoteSwitch library in ESPurna (actually a fork of it), because it supported the RF remotes I have. The RCSwitch is still supported and might be a better option but you will have to add support for it in ESPurna (take a look at the rf.ino file).

          The project is completely doable. The only thing I can think off is to try to write a generic approach. Like being able to set the sonoff in learning mode, send a code, store it and link it to an MQTT topic and payload.

          1. Juan Pedro Martín

            Ahh perfect! I made a quick review to rf.ino this is why I supposed ESPurna supported rf decoding.

            Yes I have to make a lot of modifications over your code. My plan is include multiple pushing codes to enter in pairing mode.
            For example:
            -2 fast pushes to enter in pir pairing mode. The received code will be treated as pir code using the pir logic and adding mqtt topic for presence status.
            -3 fast pushes to enter in rf button pairng mode.

            I have found another sonoff arduino library that made use of this method of multiple pushes to generate a lot of functionality like enter in wps mode (to connect automatically to the router pushing wps button), etc.

            Thanks a lot for you help!

            Best regards,

          2. Xose Pérez Post author

            My personal preference would be to enter all those modes via the web interface, instead of using different combinations. But of course use whatever suits you better. That’s the great thing about open libre source code 🙂

  16. Andréas Schütz

    Hi Xose

    Awesome work you put into Espurna… Very nice indeed.
    Where can I find information about the REST API?


    1. Xose Pérez Post author

      Thank you!

      Documentation is something I should work on… for the moment here you have a few examples using CURL, hope everybody would get the idea. These are valid for ESPurna 1.5.0.

      # Query available entry points
      $ curl -H "Accept: application/json" http://192.1681.1.34/apis?apikey=C62ED7BE7594B658
      {"relay0":"/api/relay/0", "power":"/api/power"}
      # Query first relay status
      $ curl -H "Accept: application/json" http://192.1681.1.34/api/relay/0?apikey=C62ED7BE7594B658
      { "relay0": 1 }
      # Toggle first relay (status 0 to switch off, 1 to switch on and 2 to toggle)
      $ curl -X PUT -H "Accept: application/json" http://192.1681.1.34/api/relay/0 --data "apikey=C62ED7BE7594B658&value=2"
      { "relay0": 0 }
      # Get telemetry
      $ curl -H "Accept: application/json" http://192.1681.1.34/api/power?apikey=C62ED7BE7594B658
      { "power": 798 }
      1. Andréas Schütz

        Sure, this helps a lot. Thank you.
        Until you have created the perfect docs. 😉 , I think you also should post this on the bitbucket blog. We will get it.

        Many regards!

  17. Andréas Schütz

    Hi Xose

    Is there a way to reboot the sonoff from the REST API (and even from MQTT)?

    I would like to have a bunch of sonoffs at a very remote location. Bandwidth to the remote location is very limited so a GUI connection is out of the question.
    Onboard the remote site I have a small linux server to “schedule” the sonoffs to switch on and off according to time and sensor data. The server connects now and then to download “command files” that I compose for it.
    When I command the server to do OTA updates the remote server compiles and uploads firmware fine, but the sonoffs sometimes get unresponsive to fs upload until I do a reboot of the unresponsive sonoff.
    I would save many kilometres and hours if I was able to “remote reboot” the sonoffs.

    Many regards!
    /Andréas Schütz

    1. Xose Pérez Post author

      Not hard to do. Right now ESPurna supports resetting the board from the terminal (issuing a “reset” command) and via the web interface. Would you mind opening a feature request in the repository? It helps me having everything in one place.

  18. pawel7531Pawel

    Do I need to replace my original Sonoff firmware to make this hack work? As I understand this – you use GPIO14 to control Sonoff, so the question is – will this GPIO14 work as a switch on the original firmware? I’m very reluctant to flashing other then stock firmware because on stock firmware I can access my Sonoff outside my WiFi network via Sonoff cloud. After flashing a new firmware it won’t be possible

    1. Xose Pérez Post author

      The Sonoff cloud API is closed so you are right, you won’t be able to use the eWeLink app with any other firmware but the original one.

      I’m 99% sure the GPIO14 is not accesible using the stock firmware. Only in the Sonoff TH series it’s being used as data line for the DHT or DS18B20 sensors. So you will have to decide between the Sonoff cloud/APP or custom functionalities.

      1. pawel7531Pawel

        OK, thanks. Do you know any other free cloud service which could be used with esp8266 chipsets? I was looking at but it does not seem to have any interaction with devices, only storing its data. On the other hand Domoticz which I use with my esp modules has free MyDomoticz service but it’s very unstable and very hard to use from Android devices. Thanks,

        1. Xose Pérez Post author

          All cloud services will need some kind of integration on the device side. If everything you need is a dashboard to toggle on/off switches or get sensor data Blynk or ImperiHome could work, but I have only used the first and not very thoroughly. The original motivation to create ESPurna was to be able to run these devices cloud-less 🙂

    1. Xose Pérez Post author

      There is no difference in the firmware for the Sonoff or the Sonoff RF. The RF has a second microcontroller that takes care of the RF module and pulls down GPIO0 when the predefined code is received. From the ESP8266 point-of-view it behaves just like the button. Just remember that if you remove the R9 you will loose the ability to switch it on/off with the remote. My recommendation is to temporarily short to ground the R21 pad closer to the transistor to enter flash mode.

        1. Xose Pérez Post author

          I’m afraid there is no other place “easier”, the R7 pad closer to the ESP8266 is also connected to GPIO0, but you have a resistor there.

        1. Xose Pérez Post author

          No, the RF support in the ESPurna firmware is almost legacy and only works for simple RFLink modules like this one [Aliexpress].
          To use the Sonoff RF you don’t need to enable anything extra.

          1. Xose Pérez Post author

            I’m not aware of any existing OS firmware for Sonoff devices that modifies the controller that drives the RF module in the Sonoff RF. So you will pretty much have the same experience with all of them when pairing your remote…

  19. Ewald Harmsen

    I think I got a ba quality sonoff basic. I load it with a new frimware, butwifi ignal was very bad.
    I tried to reflash it, but most of the times I could not get a connection. I got a connection once, but the flashing stopped half way.
    So the device is useless at the time.

    Can i somehow connect another esp module to it?

    How do I connect from esp to GPIO12?

  20. Ewald Harmsen

    I got a sonoff, I flashed it.
    The Wifi was teribble, I got back 1 in 20 pings, so I could not even set it up.
    SO I decided to reflash it, but that did not work, I could not open the connection.
    After several tries it started flashing, but half way it stopped.
    So I have a non working device.

    QUestion: is it possibe to attach an extra ESP chip, and control the relay with that?
    I could power the chip from the available 3v3 pin, but how do I talk to the GPIO 12 Relay?

    1. Xose Pérez Post author

      There is an issue with the Sonoff Basic wifi. Still trying to tackle it but I suspect the wifi is really bad and even more when you have live current flowing in the board.

      I did not quite understand your question about adding another ESP. Do you mean using the Sonoff as a power supply and relay controller but using a second chip for WIFI?

  21. Simon (sjp770)

    Hi Xose,

    Is there a way wirh your excellent firmware to send all 4 different remote presses as different values on an mqtt topic instead of triggering the remote? I’m referring to a sonoff RF from itead, not a modded one.

    1. Xose Pérez Post author

      Unfortunately the RF handling (and the button) is done by the EFM8 microcontroller, not the ESP8266. The EFM8 is responsible for the synching and stores 1 code as the current synch code, the one the Sonoff will respond to. Then, when the code is received, it pretends to be a button and pulls down GPIO0 so the ESP8266 knows it has to toggle the relay. So even thou you could detach the message from the relay you can only do it for one code at a time.

    1. Xose Pérez Post author

      Only digital GPIO14 is brought out in the Sonoff Basic. Accessing the only analog pin in the ESP8266 requires some good skills soldering.

  22. Alexander Rabenstein

    Hi Xose,

    I found your firmware, and was wondering if it is possible to use a nodemcu (esp8266) and 433 transmitter with your firmware as an MQTT enabled 433 transmitter. I had bought the hardware before I got aware of the sonoff devices.

    1. Xose Pérez Post author

      Yes, it should be possible. There is an RF module for that but the truth is that I have not tested it for a while… And with the Sonoff RFBridge in the market there is little need for that, except if you already have them, like in your case.

  23. Jimmy Jones

    Sorry to be pedantic about your use of English but in the sentence ‘which comes with a custom firmware’
    should read ‘which comes with custom firmware’ .
    Because firmware is an uncountable noun . Its form in this case is already plural. Therefore use of the ‘a’ is unnecessary.


Leave a Reply (all comments are moderated, be patient)

This site uses Akismet to reduce spam. Learn how your comment data is processed.