In my quest for the perfect low voltage or dry contact garage door relay I stumbled across this one that I found on Amazon
Seems like it might have been made by ITead because it came programmed with EWELink software. Having said that I cannot find it on their website and I also thought it might be a Sonoff brand name. I still think it is ITead but I just can’t prove it.
I also searched the Tasmota Wiki for it and came up short. Looks like if I want to hack this switch that I’m on my own. I did play around with the EWELink software and to put it mildly…….it’s crap. It came with no instructions although I did manage to figure out how to get it into AP mode to connect to the EWELink.
This thing is screaming for custom software. So let’s explore that, shall we? First of all it looks like about all the other boards out there and it has an ITead PSF-B04 , ESP8285 Internet of Things (IoT) chip onboard. Now at least I know I can flash it, I just don’t know what’s going to happen after that. And by that I mean………is it supported by Tasmota? It’s only a $10 gamble so what the hell?
Most of these boards have a 4 pin connector where you can hook an FTDI up and flash the board. I confirmed that by plugging in a USB micro connector to the board that 3.3 volts was present across the pins in the photo.
So that’s good news as well. I did NOT map the pins in the middle which should be TX and RX however it didn’t look like there were any traces on the board to those pins. Who knows?
What I did do was find the specs for the PSF-B04 chip which show where TX and RX are.
Simple Enough. Plug in your FTDI and just hold the breadboard pins directly on the chip. If I can do it with 56 year old eyes……so can you.
I’m not 100% positive how I got into flash mode but it seemed to be like this. The button closest to the power hook up end sets whether the relay is in inching mode, latched, etc. Set it in latched where when the relay is toggled it stays on. Now unplug. Hold down the button next to the relays, plug in the board and continue holding the button for 5 seconds. Both LED’s will be lit up. I believe that’s it.
Download the Source Code.zip file from Tasmota releases (gotta scroll way down the page to find it) and navigate to the Sonoff folder and open the sonoff.ino file with ArduinoIDE. Make sure install the libraries (I’m not going into that here, I have those directions on this page). Once sonoff.ino is open then make sure at a minimum to go to the my_user_config.h tab and input your SSID and WiFi password so you can connect to it. I like to set a static IP up as well so I know where to find it by putting the IP address into a browser.
Set these parameters up in ArduinoIDE
Now compile and upload the sketch to the ESP8285 on the board by holding RX from the FTDI onto TX (pin 3) on the chip itself. Then hold TX from the FTDI on RX (pin 4) on the chip. You have to hold steady for a minute or so…..so get comfortable.
Hit “Upload” in ArduinoIDE and it will take a couple moments for the sketch to verify and begin the upload process. You have plenty of time to get those 2 pins into place and hold them onto the chip itself.
Again, if I can do this, anyone can. Okay it is flashed. It will come up as a Sonoff basic. The first thing you want to do is change the module to a Sonoff 4 Channel Pro. Hit the configuration button and select Sonoff 4CH PRO (23)
That’s right. I said a 4 channel pro. Remember earlier I said this was unsupported by Tasmota. Well guess what? The Toggle 1 and Toggle 2 work PERFECTLY with the relay. Toggle 3 and 4 will toggle the LED on the board. And the buttons on the board still work as well!
Now go to the Console and issue these commands:
PulseTime 10 PulseTime2 10 PowerRetain 1
Okay essentially this relay is set up. I intend to control this relay via MQTT in HomeAssistant so I went to Configuration > Configure MQTT and set the Host parameter with the IP address of my MQTT server.
Now we can light the relay up by issuing the commands to turn on Relay 1 and Relay 2
mosquitto_pub -h 192.168.XX.X -t cmnd/sonoff/POWER -m on mosquitto_pub -h 192.168.XX.X -t cmnd/sonoff/POWER2 -m on
Now because I have the relay in inching mode (PulseTime 10 = 1 second of relay activation) the commands above are all you need. If you set PulseTime 0 then the relay will stay on or off only as you manually toggle it. In that case you’d need an MQTT command that says “off” at the end instead of on.
If you use MQTT as I do you don’t need the http address and you don’t care about the extra Toggle 3 and 4 buttons that don’t work. I tried messing around with the GPIO pin assignments using a generic Sonoff (18) and I couldn’t quite crack the code.
Now lets talk about the hardware. There is a line on the board where just the power hook ups are and on that line it says “AC/DC 7-32 V”. So that makes me think I can plug 7-32 volts up to either connector and have a blast.
NOT SO. The capacitor on the Micro USB side is a TEN VOLT CAPACITOR. If you were to plug your USB connector into say a 12 volt power brick……….KABOOM! I found an old Sonoff basic I screwed up royally which has a 470 micro farad 16 volt capacitor on it and I changed mine as I would like to power my relay from a 12 volt Micro USB brick.
So basically if you use more than 10 volts to power this relay you have to do one of the following:
- Use the blue connector on the left. if you are coming from a USB brick you have to cut the microUSB connector off and plug the bare wires into the blue compression connector. The capacitor on that connector is rated at 33 volts. (Hence the maximum rating of 32v as stamped on the board).
- OR replace the 10v capacitor on the microUSB side with a higher rated cap. Be sure to use a 470 micro farad cap though. Again a junk Sonoff basic has one on the board.
Now lets talk about firmware shall we? The version on Github 6.4.1 isn’t actually the latest. I found this out because I saw some discussion about making a template for unknown devices and uploading them to the Wiki. Try as I might I couldn’t find the template button. Then I read where it was in 184.108.40.206 and I knew there was later firmware out there.
Go to this page and download under the 1M size area sonoff-minimal.bin and sonoff.bin
Now on your main menu click on “Firmware Upgrade”
Upload the Sonoff-minimal.bin file FIRST. There is not enough space left in flash to write the sonoff.bin firmware file. Once minimal is installed THEN you can install sonoff.bin. Once it is done you will notice that under Configuration you will see a “Configure Template” button. NOW you have the latest firmware.
We just took a good hunk of hardware with shitty firmware and a shittier software app and made it a POWERHOUSE. Happy Automating folks.