You will have seen me write about the excellent Sonoff ESP8266-controlled mains relay switching devices in the past and I went into great detail as to how to program them using the HC2016 software, the only caveat being they don’t have enough FLASH memory for OTA (well, not with my software). Oh yes and I HAVE added that “button control” that people asked for.
Well, here are two new boards – the Sonoff TH10 and TH16 – if you look on their website – full information including schematics etc. are freely available.
Before we start – here are my previous blog entries Sonoff
Slampher and Sonoff
More Sonoff
Even More Sonoff
Sonoff to Mains Block
32Mb ESP01 and Sonoff
Compared to other boards, several of us have discussed that the Sonoff boards are well made with good clearance on tracks for mains power etc. Some doubted whether their small relays would truly handle the loads claimed.
Well, it looks like ITEAD have taken this on board as I’ve just received both TH10 and TH16 modules. As far as I can tell the only difference is that the TH10 has a 10 amp relay, the TH16 has a 16 amp relay.
First impressions? Solid. They are bigger than the original Sonoff modules (which I use on a daily basis for controlling lamps etc) but also much more substantial looking – the programming button is much easier to access as it is intended to be used rather than looking like a reset button. I’ve made good use of this as an output toggle (which also works on the previous Sonoffs).
As usual I’ll leave it up to others to tell you what you can do with the Sonoff software – first thing I did was to reprogram the boards to handle my own software.
So – the output control is identical to the older models – but they’ve also added in a temperature port. They have very kindly made the input port compatible with my software (see settings below) and options are temperature only using the Dallas temperature sensor which they can provide on a waterproof lead complete with stainless tip – or the DHT22 which also handles humidity – I’m pleased to see they did not use the inferior DHT11 which isn’t that accurate.
So – see the original article – you’ll see there how to program up the board – this time – the ground and power connectors are blindingly obvious on the end of the board – that’s 3v3 not 5v – I got away with using an FTDI at 3v3 but you may want to consider a proper 3v3 supply for programming.
If you set wifi_button to 0 – sonoff to 1, temp_type to 0 (Dallas) or 1 (DHT) and temperature_port to 14 (these are non-volatile) you will be able to control the output on out12 (i.e. out12:0 or out12:1), you will be able to read the temperature AND you can toggle the output on and off with the external button on the Sonoff!
The CE and ROHS stickers should keep those who care about such things happy – the important thing for me is looking at the PCB around the mains it is clearly obvious that thought has been put into this. Well done.
Oh yes, the FLASH – like the unit before it – we’re looking at an 8Mb FLASH – that is 1MB – I don’t really support that for OTA though everything works except OTA. I am pretty sure that like other boards, this FLASH if you really must, can be replaced but be warned my soldering isn’t bad and I’ve done lots of Sonoffs, ESP-01s etc – but the little tracks came clean off when I tried it on one of these boards, immediately trashing it – so do so at your own risk.
As for the push connectors for mains in and out – not everyone’s cup of tea and I did have a chuckle that they’ve gone to the effort of avoiding using a screwdriver for the cables – but you have to use a screwdriver to get the cover off !!!!
Sonoff TH10 & Node Red questions:
I have a RPi using the script to install Node-Red and all is working fantastic with Tasmoto flashed Sonoff basics. These are the only devices on my home automation network.
For whatever reason after flashing 12 sonoffs, I can no longer connect and suspect I have fried my USB 3.3 v to serial converter board. I have a replacement on order.
So in anticipation of the replacement converter board I have a question on the Sonoff TH10 which I have one being used with original Sonoff firmware controlling my bread proofing box. My goal is to be off the eWeLink server ASAP and this is the last device on that service.
I’d like to add this Sonoff to my home automation schema but am unsure as to how this is handled in Node-Red. Does the one and only “Sonoff” node in the pallet reflect the additional messages available when the TH10 is flashed with Tasmoto? I see nothing in the existing Sonoff node from the pallet which reflects parameters in the TH10.
Are there any videos showing the steps / nodes required to set up a dashboard so I can change the turn on/off temps via my Android phone?
you can control a “tasmotized” sonoff via mqtt or via rest api http calls, there are plenty of info on tasmota wiki and on youtube… from phone, you can use its ip address to access the tasmota web gui, or just take the http api urls and put them in any “http request widget” you’ll find in play store, or any mqtt client…
Thank you for taking the time to reply. Yes it would make sense that using the phone to the IP of the sonoff would work quite well.
I guess I got hung up on trying to alter the parameters via the Node-Red Dashboard like I could do in eWeLink.
I don’t see any downside to just a direct IP connection to the Sonoff rather than to the RPi running node red.
Thanks again.
https://play.google.com/store/apps/details?id=ch.rmy.android.http_shortcuts
https://play.google.com/store/apps/details?id=net.routix.mqttdash
Those are great apps! Thanks for taking the time to post them
Hi, I’m hoping for some help, I reflashed two sonoff basics with EspEasy (running windows as the Arduino IDE running on Linux was throwing quite a few errors.)
The reflashing appeared to proceed ok, no errors.. but on rebooting/powering them.. I never see an ESPEASY Access Point listed in available networks.. surely if it’s reflashed it should be ok? (anyone see this before?)
Cheers
Stan
Hi there… I’ve got a strange problem where my sonoff is still broadcasting its original ITEAD hotspot despite having been flashed with an arduino sketch and being connected to my wifi.
I didn’t think this was possible after being reflashed. Did I miss a step?
Adam, I had that problem with just one of the 13 Sonoff Basics I flashed using Tasmoto. It seemed temperamental during the initial flash process, unlike the other 12 and I kept trying to re-flash it.
Most times I’d see the IDEAxxxxxxxx WiFi network but on 3 occasions I saw the sonoffxxxx network but was still unable to get it on my home WiFi network.
As 12 flashed without a problem, I just assumed there was some defect with this unit as it was about 3 years old and was purchased in the same batch as the others which gave me no issues.
there are commands to completely erase the flash memory before flashing a new firmware, so you’re sure it’s empty
https://github.com/arendst/Sonoff-Tasmota/wiki/Esptool
Thanks! I’ll try the direct erase flash command line on the one Sonoff which would not program and see if that help.
Peter,
I have a SONOFF TH10 running your Home automation code 2.4.01 and notice it seems to logon every hour. It did it with a previous version also but bot sure why it is happening. I have several ESP8266 devices that work normally on the same set up. It has a temp and humidity sensor sending readings and appears to be working fine otherwise.
Any ideas?
Gordon
If I purchase a sonoff TH16 and use the 2.5mm jack with an open cord, will it detect a short and report it in the app? If not, how can I make this happen?
Very useful post. I’m now using Tasmota and sonata which means I don’t need to connect to the board and flash via wifi (solves the POW issue). Then using openHAB on a z83 mini PC to automate.
Just a little note about the screw over the terminal cover. Most, if not all, regulatory authorities stipulate that you must use a tool (screwdriver) to get to terminals.
Once the ‘competent’ person has access the terminals can be push in or whatever.
Hi,
On ESP8266 TX/RX pins are in reality GPIO 1 & GPIO 3 and can be used as normal digital pins if no Serial is expected/needed.
I kow that on POW AC is also there, means don’t!
I think it is because of the way it is working together wit the HLW8012 chip.
But what is the situation with the TH16?
Is AC and DC part separated well enough on TH16?
Asking because if so you have 3 GPIO pins right away without SMD soldiering!
If still willing to do precision soldiering you have 4 end even two more if you are willing to change the function of the blue led or the push button. (6 already. Relay is of course the 7-th.)
Another reason why important is that you can also connect a Arduino mini (3v version) and communicate with it on serial. Will be like a module in a desktop PC (fits inside perfectly) and you have many benefit from it like analogue ports! (And of course it brings you 12 digital ports! If using the 4 analogue one as digital then even16!) This you don’t have without! The ESP chip of course has but only one analogue port and on TH16 not even soldiered in.
I am really curious!
Thank you in advance!
Better yet, read the blog and use my NANO peripheral – communicate by i2c…. (4 and 5 on the esp, a4 a5 on the Nano).
Hi Peter,
That is cool!
Only one quesion is left that is if it is safe to use the tx/rx pins and vcc and ground together on TH16.
Oter words is DC part safely separated from AC?
Do you happened to know?
I still would like to connect to tx/rx pins. 🙂
Thank you in advance!
Regards,
Gábor
i would not mess with sonoffs, if pins are not exposed… read here about POW models… don’t know for TH models, you better ask on tasmota issues page…
https://github.com/arendst/Sonoff-Tasmota/wiki/Sonoff-Pow-and-Pow-R2
Hi,
Thx!
About POW i knew this.
That must be because of the HLW8012 chipm that is measuring current draw. But TH16 does not have this.
Regards,
Gábor
I have simply started to use TX/RX for a BME280 to take control of a 120l water boiler. I was not able to measure 220V AC on these pins. Finally have even grabbed them. So i consider no such issue for TH16. I also have a POW. There this issue is present for sure! I confirm. So please be careful!
Hi Darren
I am in UK
I have lots of Byron Homeeasy kit, which is 433Mhz I also have a Telldus USB stick connected to an old RPi model B.
My first attempt at programatic control was with an Arduino conncted to a linuc PC (2012). ambituous but rubbish as they say – it worked but only as aconverastion piece.
I have 12 sets of ceiling lights controlled via 433 actuators- these are all in my modern house extension, they are controlled by wall mounted 433 remote switches. all that works quite well. all these actuators can be controlled by up to 8 remotes, and they are self learning. In the old part of the house most of the lights have wired switches.
Like your solution, it is user friendly, no wifi everything still works.
The RPi runs telldusd and a web server, so by opening a port on my router I can control the lights from a phone. I have also installed postfix and procmail on the RPi, so I can control the lights via email.
I recently bought a Google Home Mini. This is the point I started looking at MQTT and IFTTT and where I realised that these proprietry systems are not a good idea.
Dead internet or router being the first issue with most of this kit you cannot switch the lights on even from inside you own phone.
So the tasamota/mosquitto solution looked attractive. I bought a Sonoff RF and looked at updating the firmware. I then realised that changing the firmware will break the 433 interface (AFAIK) – this means no router no lights. Even if the Sonoff 433 does still work, it will only pair with a single wall switch, so I cannot have a switch by both doors – all these switches come with a unique code.
Even if the Sonoff were able to support 433 and wifi, It still leaves folks with a problem getting stuff to talk MQTT from a phone. AFAIK IFTTT does not yet talk MQTT, you need a further bridge and configuring that bridge looks nasty.
So for the moment I will stay with my 433 based kit I have voice activated lights from my phone and Google Mini to show off to my friends but the real good stuff stays on the 5 year old RPI
Pedro –
I have come to the conclusion that WiFi lighting control is unsuitable in a house with real families. Tasmota and all the various solutions are great for us geeks, but not real solutions.
The acid test is could you sell the house with all this techno-stuff installed.
Pedro
I have two Pi/MQTT based home automation systems – one at home and one at our holiday home. I have made them ‘family friendly’ by adding 433 MHz push switches to the walls alongside the normal ones. I’ve also got 433 MHz push buttons that are smaller that I mount elsewhere for lamps etc (panic buttons repurposed for IoT). I have a 433 RF to MQTT gateway running on an ESP8266 and rules on my Pimatic home automation system to trigger events based upon the different numeric codes transmitted via the 433 MHz push switches.
This way I can control my lights/heaters/devices via my Pi with automated rules, manual push button events from a web front end (tablet/phone etc) and also from a push switch on the wall that replaces the original rocker switch.
So far it seems pretty girlfriend proof – and she’s not easy to convince usually!
Hi again
A switch connected across the sonoff will work, but as mentioned earlier in the stream, sonoff cannot be used in a UK light switch, as there is no neutral wire. My existing home easy switches are mounted in the lamp ceiling fixings.
I have a 4 button remote that came with the switch, not really a granny pleasing solution.
The switches you mention in link 3 could work, at least for lights that i do not want to control using tasmota. I will look at the tasmota wiki, but I suspect re-flashing them will break the 433 mode, have you tried that approach?
https://github.com/arendst/Sonoff-Tasmota/wiki/Sonoff-RF
or try espurna… https://github.com/xoseperez/espurna/wiki
I can live with the lunacy of having to charge my phone before I can turn the lights on.
I can install a tiny ups to keep my pi from trashing it’s sdcard.
What I cannot do is idiot proof a sonoff based lights control system. My mum does not own a phone, but she quite like to switch her light on.
That’s my problem, I want the benefits, but fill the missing gaps to keep the stuff everybody else expects, is a light switch by the door.
I have a sonoff, it is supposed to work with 433 MHz switches, but they don’t specify which make, and they don’t sell 433 switches – afaik
So folks someone must have a non-phd protect solution.
Pete
if you have the sonoff RF models, Itead site sells remotes for them… any 433.92MHz will work, anyway… and you can wire a switch and connect to the internal sonoff tactile one and have a standard switch, no wifi needed… or there are wall mountable, battery powered, rf remotes…
https://www.youtube.com/results?search_query=sonoff+external+switch
https://www.itead.cc/sonoff-rf.html
https://www.itead.cc/wireless-4-buttons-push-cover-remote-controller.html
https://it.aliexpress.com/item/86-Wall-Panel-Wireless-Remote-Transmitter-1-2-3-Channel-Sticky-RF-TX-Smart-For-Home/32793117889.html
A separate point.
When looking at relays operating at high current, its not just the current you need to consider. You need to consider the spark erosion when it switches.. So think about the duty cycle. If you switch a 5amp heater with a thermostat, there is usually a lot of hysteresis, the stat clicks back and forwards perhaps every 30 mins. If you use a thermocouple, an ADC and a esp8266, you could be on/off every few secs. Not good.
As the contacts erode, contact resistance increases, so they get hotter. If you are lucky it fails open cct, if your unlucky it sets fire to the plastic case. Personally I would not use them on much over 1amp, and then only on a noninductive load.
Hi,
I have been trying to update the firmware of this device from v2.0.2 to v2.0.4 each time I try the update fails. Have you had similar problem. And If so can you recommend a fix. Apart from this glitch the unit seems to be functioning fine every time I open the eWeLink linked it tells me that this device requires an update. Hope you can help with a way to rectify this problem.
Why not email the designers.. Itead.
and usually we flash these devices with tasmota (mine with espurna, too, for some of them), right after opening the box 🙂
Indeed. I use Tasmota.
i put espurna on this, too, very useful 🙂
http://tinkerman.cat/connected-power-meter/
Hi Peter,
I have just found your excellent blog whilst researching esp8266.
I have a question about sonoff for lights.
I have used Byron homeeasy and telldus for 6 years, but homeasy prods are no more, so I recently bought a so off to have a look. I have used them to control lights and heating.
I have avoided Mqtt to date, it fails the kiss test, too many points of failure, power cut kills the Mqtt pi, so I cannot switch the lights on…
So my question. What is the optimum way to control lights so I can schedule them, turn them on from my phone etc?
Is WiFi really the best solution?
Pete
Simple, battery backup the Pi. I use MQTT exclusively to control my stuff and as I sit here in the UK recovering from my 2 months in hospital, my gear had been running 100% reliably over in Spain over the entire winter.
Have to agree with Peter, the Pi is an excellent choice in combination with MQTT and Node-red and with a small cheap 600VA UPS you have something that will run for quite some time if there is no power but kind of pointless when your lights won’t have power anyway 🙂
I switched to the Pi and MQTT after reading Peter’s post and built some customs units and running Peter’s code, they are just about bullet proof and reliable.
Unless you have ethernet cables everywhere and you can do POE, which would be ideal, yes wifi is the way to go… If you don’t want mqtt, simply recall the http urls that sonoff with tasmota expose, read on its wiki
no answers = a bad feeling that maybe I should not use a TH16 on the 1600 watt heater.
why not? Of course it depends where you are but in the UK, at 220v, the current is WELL below the limit for 1600w = under 7 amps. If USA at 110v then you would be pushing it and in that case I suggest not using the unit at 1600w.
thanks for replying, I can sleep well now knowing that my heaters can be used with a sonoff and not burn down the place. Thanks Tom
There was a faulty batch of SONOFFs reported by SONOFF themselves and I’m not sure how many of those are still in circulation. I think the issue was with the amount of solder added to the tracks on the high power side of the PCB to increase the current carrying capacity. I’d certainly suggest visually inspecting the PCB and compare to photos online plus do some testing of your own before using the devices unattended.
I don’t mean to scare you off the products (I own and run lots of SONOFF products from throughout their range) but I operate many of them unattended in a holiday property 50+ miles away so wouldn’t find out before it was too late if there was a reliability or fire risk issue. This goes for all the kit I install, not just Chinese/SONOFF stuff,
what about 500w towel rails are they any good for those?
my heaters has a pilot wire connection below, could I use 240V (live & neutral from another feed separate to heater) into Sonoff th16 input and then connect the black wire to output on Sonoff device so only controlling low power 100mA?? See blub from spec sheet about pilot wire?
Pilot Wire Connection
The BLACK control wire is designed to carry a signal from slot in or wall mounted Dimplex programmers. If, however a programmer is not being used, the pilot wire should be isolated in accordance with the current IEE Wiring Regulations.
IMPORTANT – DO NOT connect the BLACK pilot wire to earth. Care should be taken with the installation of the pilot wire(s) as when switching to background (set back) they become energised at 240V although only at a current of less than 100mA. In every case a suitable means of isolation must be provided for the pilot wire and marked to indicate that two sources of supply may be present at the heater. Where pilot wires are installed separately from the heater final sub- circuit they should be protected, double insulated and carry their own integral earth continuity conductor.
Would you advise using the 16amp th16 on 1500 watt non fan heater in the UK 230v?
Or should I avoid trying to using any wi-fi switch with heaters?
Confused as the documentation in the box shows a picture of a heater/fan being used.
Hi Thomas,
I have the 16A version of a SONOFF POW on a 2kW water heater and that runs fine although I rarely have to run it longer than 15-20 minutes at a time. I tested it well before implementing it in a live environment unattended. I have one fan heater but I switch that with an Energenie RF socket as that’s fully UK designed and certified. For everything else I’m happy with the 16A SONOFF units now but I divide all Chinese specification units by 2 to 2.5 as they do like to over state such things plus I like some headroom regardless.
I remember seeing the fan heater in the SONOFF documentation and getting a bit worried myself. Fan heaters are an inductive load and behave much more differently and need treating with more caution than other devices even if the same current.
hi,
I want to control multiple electrical appliances based on temperature and humidity. Can I connect sonoff TH16 with Sonoff 4CH to control more than 1 electrical devices for my greenhouse.?
Not sure I follow the problem. With Sonoff 4CH you can control 4 separate devices already.
Hi, just reviewed this switch, you can extend capabilities of higher current, replacing actual relays with OMRON brand. As we know, OMRON has been known for many years making good equipment. We can upgrade this to 20A, but we need to make PCB tracks thicker that actual are, to prevent burning/heating
Search Google for that part: G4A-1A-PE DC24, it’s 20A relay, controller by 24v Voltage, not bad. For testing and interest, I’ll order one piece, to check if this works for me… An of course, one omron relay costs approx the same price as whole device 🙂 So, any questions about quality of OEM relay?
I’m not sure, does current measurement will work properly if you upgrade relays.
I have also mentioned, that you must change power terminal connectors with the type where you can screw cables to it, not just pressing fixation.
Hi Pete
I agree it is common to apply a security de-rating. Often close to 50% for continuous use.
I also received a reply from Banggood. Apparently I misunderstand the item, and maybe I do but the web site listings due rather gloss over the issue and not suggest a continuous max load to go with their (questionable) 16A maximum…
— Banggood reply as follows —
Dear Darren,
Thx for your order NNN and NNNN.
Maybe your misunderstand this item.
Its max power is 3500w(16A), that mean the max current it can load is 16A but this status cannot last.
Generally speaking , when you use it, the load current is lower than 16A.
So this item is safe, you can use it without worry.
By the way, this item has a CE certification.
Best regards,
Leo
Hi guys
Why are you trying to translate VDC and VAC to average/peak when it clearly means continuous and alternative currents
Most relay, switches and devices with physical contacts have different ratings in DC and AC. Even the human body deals better with AC than with DC. This is related to electrochemistry as with DC, oxydation comes with lower currents (if I remember).
Or may be I didn’t understood your point and in which case I apologize for my wrong comment.
The issue has been clarified by Itead as promised, in here. However, Barbudor, in my case I was not comparing DC and AC but simply saying that many electrical appliances have peak currents – for example, a 2KW heater element – let’s say for the sake of argument it’s average power consumption when hot is 2KW, will consume more than that when cold. I assume filament lamps do that (if anyone is still using them) but of course over a much shorter period. From a perspective of wear and tear, for my own purposes, I would never use, in this case a 16 amp relay with a 16 amp load – I would always leave some margin. Of course where this leaves us depends on the country – in the USA on 110v, 16 amps represents around half the power it would if 16 amps were in use in the UK at 220v.
Given the clarification that the relay is 16 amps – and ASSUMING that the PCB tracking is up to the job, I’d be happy in the UK (220v) with using a 2KW load – but that’s just me.
WARNING ABOUT 16A Sonoff Devices.
I bought some “Sonoff POW 16A” devices in the recent Banggood Sale. These are labelled on the carboard box and the plastic ABS case as “16A” but when you open them up, the relay is a 10A model. On one of them it was clearly obvious as 10A and in another, there was a white sticker obscuring the 10A markings.
Just a heads up before anyone loads up their Sonoff with 10+ amps. One should always take chinese wattage ratings with a pinch of salt and divide by at least 2 anyway but given there’s a 10A and 16A option available, one would expect the 16A models to have beefier internals, not just a different number printed on the casing!
This subject has come up before – Darren – can I suggest you send an email to the company and tell them that using a 10 amp relay and claiming 16 amps is simply NOT acceptable.
Personally I would not go up to even that limit with these devices having used many Sonoffs. Perhaps 8 amps max – less for an inductive load? Even then that is 2KW….
I may have overreacted, but am equally confused…
Under the white sticker it says: –
10A 250VAC and some symbols
————-
16A 250VAC
10A 250VDC and different symbols
I am guessing it may mean 10A continuous and 16A peak but the documentation and the product page when they sell these does not warn you about that. The leaflet inside the Sonoff box even shows a beefy heater being plugged into one.
I’m not sure I’m feeling that confident and have informed Banggood (but I’m not expecting anything…)
The above findings are the same on 3 out of 3 SONOFFs that I ordered. I ordered 2x TH16 (with the jack socket for a Dallas sensor) and 2x 16A POW. All the same under-specced relay.
Admittedly, it’s a slightly bigger relay than the small, basic SONOFFs, but that’s not saying much as those units are pretty weedy inside.
In the meantime I’ve brought this to ITEAD’s attention and hopefully someone will comment. If it is a relay meant to be used at 10amp continuous and 16 amps peak then the box outside should also make that clear – indeed – I’m not even sure if most members of the public would have a clue what 16 amps peak means….. normally an appliance will quote either continuous current requirement or more likely wattage. Sadly wattage is useless here as the amperage is what matters for these relays.
Thanks Pete, hopefully collectively we may get a response from ITEAD/Banggood. I like ITEAD’s products and innovation, but they just fall short of being brilliant with ‘niggles’ like this.
Most members of the public won’t open the unit up as when advertising them for sale they say that you won’t get support if you open them up. Odd really considering that they don’t exactly discourage the use of 3rd party firmware etc.
As in this case, Banggood are just one of many suppliers, we really do need clarification from Itead. They have my email but of course they are asleep right now in their part of the world (I think).
Very true – the suppliers will just be punting out whatever ITEAD’s documentation suggests. Have you liaised with ITEAD directly before? I know you regularly receive evaluation units from various parties, but wasn’t sure if the ISonoff kit came from ITEAD themselves or a third party…
Yes I’ve dealt with Itead many times – there’s a good chance they’ll respond in here.
as said by Peter, these concerns should be addressed to itead as manufacturer, but on the other side banggood is very good in refunding if you have problems, never had an item which was faulty and was not refunded or replaced… while with aliexpress recently this became a lottery…
Hi Darren,
Thanks for your feedback, we checked our products in the warehouse, it’s ok.
We use the 16A relay as we wrote.
Please check the picture below, you can see the relay is 10 Amps DC and 16 Amps AC, please tear the white label paper, and check your product again.
Thanks.
Help
Hello all i am very new to this and looking forward to my adventure
I am using a Pizero and the image made by Andreas Spiess. It all appear to work.
I have a few Sonoff Th10 and for the life of me i have been unable to find what firmware to load on (i have made the cable and get flash to them) to make Node-red communicate with them.
I have post questions on his youtube channel but still awaiting a replay.
I have looked through Peter’s massive blog and still cant work out what to do. and searched the web and found many FW but i cant get any to work, some when checking the arduino code when adding in ssid and PW do not complile. I have loaded many libraries but still cant get past the compile check, some also are looking for other ****.h files which i have not found
My Pizero works well thanks the peters and andreas hard work. I can SSh into it.
I have played around with node-red and Peters BigTimer and that all appears to connect the the Pi in the debug window.
I would like to use OTA updates if possible.
I have purchased some larger memory chips if i need to replace them. but i think from looking at YT vids things have moved on.
All i am try to do at this my starting point is to be able to turn a small hall way table light on and off.
I also have an Echo Dot and would love to progress on to making that follow voice commands to turn it on and off.
If anybody can link to a firmware that i can try and upload to my sonoff it would make me a very happy man as i feel like throwing the whole lot out of the window at the moment 🙂
regards
Andy
Sonoffs – no question in my mind – Tasmota… I added Sonoffs to my software some time ago but for reasons of cost maybe, they insist on using smaller FLASH than ESP-12s – just at that time the Tasmota software was taking off and – well, why re-invent the wheel, he’s doing such a good job. https://github.com/arendst/Sonoff-MQTT-OTA-Arduino/wiki
+1 on Tasmota. I have several SONOFF devices running this very easy to configure replacement firmware.
I’m also a big fan of ESPEasy as a very versatile ESP8266 firmware for sensors/relays etc – it works well with MQTT and has a reasonably flexible ‘rules’ engine which allows some pretty useful customisation.
https://www.letscontrolit.com/wiki/index.php/Tutorial_ESPEasy_Firmware_Upload
I use my own code aside from the Sonoffs (for which I use Tasmota – I have a wide range of peripherals in there and plenty of room for expansion now I’ve given up on the old ESP-01s. As far as I can see the ESPEASY software only has support for a tiny number and variation of displays – for example simple i2c 2 liners – and one type of OLEDS. You might want to take a look at my WORD manual…VT-100 mini-terminal, several types of LCD and several ways to connect them etc.
that image is OLD, had issues reported and is unsopported by him (and by us…), better start from a basic raspbian stretch or dietpi install and run the script… “from zero on the zero” 🙂
Ok thanks. I have a Pizero running Andreas Spiess PiZero image. which worked very well. Thank you for that code Andreas.
Nodered runs and i can see Peters Big Time. The Mqtt looks like it is also working in the debug window
My issue is i have been trying for a 2 weeks trying to find a code to load on to a SONOFF TH10 to be able to let nodered turn it on and off.
I can flash the firmware in a sonoff so thats now no problem to do.
All the codes that i have downloaded and tested have failed. To be far this is very new to me, but i have done loads of research but still i fail.
Even the code published from Andreas fails as i can find to files he refers too.
The code that he published is:-
https://github.com/SensorsIot/MQTT-meets-Sonoff/blob/master/MQTT_video/MQTT_video.ino
I cant seam to find the correct AsyncMqttClient.h to download. all i am doing is searching in google and loads of various one appear.
And also this part
#ifdef useCredentialsFile
#include
#else
mySSID = ” “;
myPASSWORD = ” “;
#endif
as i can find the credentials.h file i deleted the # lines and filed out my ssid and PW but it still want compile
I changed the code to
# define mySSID = ” “;
# define myPASSWORD = ” “;
but still no joy.
looking through the code, woo that’s sounds like i know what i am doing NOT, as long as i following his YT video all should be well.
Then once it works i can learn how to change the topics, feedback etc
Any idea what i am not doing correctly.
I have also found a channel on The Beginner’s Guide to Home Assistant – HassIO https://www.youtube.com/watch?v=XWPluWcYRMI
Do you think that would be easier for a novice to get on with, though i like Peters and Andreas channels and websites and feel i should solder on with this.
Thanks in advance
I now have it working.
I am not able to get into the node-red dashboard it’s asking for log in details. Tested all the ones I have from the pi image that I used but no joy
If you installed the script from scratch – then the username for Dashboard is “user” and the password is the one you gave it. Under other circumstances – other software, non-standard setup, I can’t be of help.
Peter you are the man. I have logged in ok. Now the fun can begin. It’s been a long two week struggle to get a sonoff to work but now it does happy days
And more news. OK, got the Sonoff TH10 and the temp/humidity probe. Total cost with an extension cord around 20 bucks. Cut the cord in about half and put the Sonoff in the middle. With this I can monitor temp/humidity, and have something (like a portable AC unit) switch on remotely (manually or in response to a temperature threshold) AND, something I didn’t know, when the unit is switched on or off I get a notification on my phone. In other words, the email push I thought I needed is unnecessary, and the notification of a temperature threshold being hit is already contained in the Ewelink software. I can monitor temp and humidity and I get notifications when thresholds are hit, so all is good and MUCH easier than I thought it would be.
More news. So I just wanted a simple monitor for cheap that could send an alert if a temp exceeded a threshold. You can find them for $60 to $200 online. I scoured for something cheaper. Today, deep within Amazon, I found this, which looks like a kit thing put together by a coding group. Anyone know of it?
Hi Pete,
Crossed wires maybe?. I am totally with you on node red vs blynk but for the poster “AW” who appears to just want a simple temperature sensor reading accessible by mobile phone it’s a quicker solution to solder a DHT22 to a Wemos and flash Blynk on there. Quite different requirement and complexity to the great work you are doing with more compressive control systems, node red and your code Base.
Cayenne is very easy, too, for this kind of things…
Node-Red – as of today – and I quote ….
Note: Only a (small) subset of the Actuators and Sensors are currently supported by Cayenne
I know, but for the specific problem of your reader it should be enough, temperature sensors are there ☺️
Hi AW,
If you’re just after monitoring a temperature reading via a simple mobile phone interface, you could consider “Blynk”. This is a clever little platform with an Android and Apple iPhone App which, with a small amount of code, an ESP8266 (powered via a USB charger or similar) and a DHT22 or Dallas DS18B20 temperature sensor will give you what you need with very little technical knowledge required.
http://www.instructables.com/id/ESP8266-12-blynk-wireless-temperature-e-humidity-D-1/
Above is an ‘instructables’ article describing something similar to what I think you’re after but there is an active discussion forum/group at the Blynk web site http://www.blynk.cc/
I recommend Blynk for your requirement as it sorts the internet/mobile access side of things and the sensor all in one go. There are other options available without using Blynk but these may be more convoluted especially if you’re not already familiar with ESP8266 etc.
Rather than using a ‘vanilla’ ESP8266 requiring 3.3v as per the instructable, I’d recommend looking at a “Wemos D1 Mini” board as these have onboard Micro USB interface for programming and for powering the device, so once programmed you could just stick it in a little ABS enclosure and power it from a USB power supply/charger via a standard microUSB cable.
Darren
Hi Darren – I’m guessing you’ve never gone through my earlier posts. I took an intense interest in Blynk and had many conversations with the designers – it is pretty – however – most of these systems show little interest in Node-Red, preferring to work with every interface known to man and hence limiting their overall capability and stretching their resources – if they would merely concentrate on producing an all-singing API so we could roll our own thing – but sadly – no – which is why I’ve all but abandoned all of the alternatives in the hope that Node-Red Dashboard will continue to improve – indeed again looking back through posts in here you’ll see how to add all sorts of impressive widgets to Node-Red Dashboard, far beyond the limits of the existing graphing, dial and other interfaces. There IS an interface between Node-Red and Blynk which is 99% reliable but I could never make it 100%.
Still – some of the Blynk widgets are great – their colour widget however is not and takes up way too much screen space. As you’ve brought this to my attention I’ve been back to their site – what has happened recently? Not a lot. To this day, Node-Red is STILL not officially supported as far as I can see so you’re in the hands of third parties who may or may not choose to keep the interface going.
Hi, Peter. I just left a reply to Darren, but your input would be valuable also. However, I’ll admit I didn’t understand much of what you wrote to Darren, since I’ve no understanding of what Node Red is. Again, all you guys have been great with your patience with my basic questions.
Darren, first off, thank you for the thorough and respectful post reply to a noob like me. That said, I checked out the links and found myself a touch overwhelmed by what was there. I don’t own a soldering iron, and I’ve never bought that white pegboard thing that you attach wires and such to.
It looks like fun to learn, but unfortunately I’m not able to invest that much time relative to what I want to do.
Is there any way to use Blynk with software programming of it to work with the already-made Sonoff TH10/16? That way I just screw in wires to the Sonoff, plug in the humidity/temp probe, and then program Blynk to recognize it and email me when the temp exceeds a certain threshold. Is this possible?
Hi AW,
Yes you could use the SONOFF with the external temperature probe and Blynk to do exactly what you require…but (there’s always a but…) in order to flash the replacement firmware (Blynk software stored on the sonoff itself), one needs to solder 4 pins to the SONOFF board and then connect those 4 pins to a PC via a special USB device and some software on a PC. Its probably easier on an ESP8266 “Development board” instead of a Sonoff as you can buy SOME of them with header pins already soldered…and then you could use breadboard jumper wires (female to female) to connect between a DHT22 breakout board (with header pins also pre soldered). Many ‘dev’ boards have MicroUSB sockets which can be used to power the device but also to flash new firmware across however the SONOFF requires a separate USB to Serial device to update the software – this is something I have several of and use all the time but isn’t something a ‘noob’ would have just lying around. Given your self confessed noob status, and the complications listed above, a Sonoff device gives with one hand and takes with another so it might be pushing it a bit.
Your best bet might be be to get someone to do the soldering for you on the Sonoff and that would get you past the first hurdle. You could then learn the coding side of things with Blynk (if you are up for that). It would be a great opportunity to be brave and have a go yourself as it’s more rewarding that way but I also appreciate there’s quite a bit of learning curve if this is just a one-off.
I have built and implemented several not dissimilar SONOFF / Blynk projects for colleagues and friends, providing the kit ready to “plug in and go” including bespoke software to do whatever is required (Remote temperature sensor and relay for remote heater control, Garage door control, Driveway gate control, timed outdoor lighting etc) so I would be willing to assist you more if necessary but that wouldn’t want to totally remove the satisfaction you’d get by having done at least some of it yourself.
Let me know if you need any more help and how much help and between us all here there’s more than enough knowledge and helpfulness to get you sorted.
AW – Re-reading your reply, it sounds like you need something a bit more ‘off the shelf’ so my last reply is probably not much help.
The standard (chinese) software/firmware that comes with the Sonoff might be up to the job – you’d be in the hands of ITEAD and need their proprietary iPhone/Android app to be able to view the temperature etc but that would work “out of the box”. It doesn’t sound like it sends email alerts but it would show a temperature reading on your smart phone. I’ve never tried the standard Chinese firmware so can’t provide any details on how it works (or how well) as the first thing I do is remove the standard firmware/software and replace it with my own (or someone else’s) as I’m a geek.
I’m happy to assist (offline) with a ready made turn-key solution if you’re interested – it’s all good fun this 🙂
Sorry, I missed this comment, Darren. How can I reach you offline to find out more about your ready made turn-key option?
Hi AW,
If you click on my name to the left of any of my posts, my e-mail address is in my profile text.
Have a good weekend. Sorry for going off topic, Pete et al.
You ROCK. Thank you for your patient and thorough, albeit intimidating, guidance. Of course, the advantage with the Sonoff is the ability to simply plug in a temp/humidity sensor and you’re good to go to see the info over wifi anywhere in the world. It seems such a minor thing to be able to trigger an email alert in the Ewelink app, but the developers I contacted have no plans to change anything in it. You’re right, though…for a one-off, that’s a lot of learning and I don’t think I’ve got what it takes to do it. Still, I really appreciate the time and effort you made in coaxing me to try!
Just a short addition but if soldering is the issue I have found it unnecessary on these devices. You can just hold a row of 4 pins in place whilst the flashing takes place (20 secs). After that further updates if necessary can be done OTA
Could use some help…I’m not a technogeek. I want to monitor room temperature via wifi/internet and be able to see it on my phone. No switching. No hardwiring into appliances or a wall desired. Can I somehow plug in the TH10 or TH16 (?which should I use) into a wall outlet and have it report a room temperature to me? If so, how? Do I have to have 3 dangling wires screwed into some plug thing to plug into an outlet, or is there something more aesthetic I can buy to do this job? Thanks.
Hello,
Thanks for having this blog it seems very useful and informative for “automation folks” which I’m planning to become myself as well. I’m (very) new to sonoff and trying to find an answer here with no success. I like to figure out how to set up the external 2.5 mm plug on the TH10 to control the switch instead of being triggered by temperature. My plan is to plug in the original wall switches to keep the traditional setup and add wifi option with the sonoff. I’ve seen a video on youtube and the person demonstrating it claims it is possible to do with the original firmware. When I plug into the 2.5 mm the sonoff shots off, tried on several units same issue. Please advise what to do. Thank you so much!
Well you would have to write your own software of modify some existing software. I can’t remember offhand but the temperature sensor simply feeds a port bit – will no doubt have a pullup resistor so likely all you need do is chip out the support for the (I think) Dallas temperature chip – and monitor the input to turn the output on or off depending on the state of the input.
Why is there a 20A fuse on the TH10?
Ask them?
I did but I haven’t got an answer.
I was thinking that maybe someone with more electrical knowledge than me can explain why.
Hello Peter,
Thank you for all the work you’ve done and explain how to flash the sonoff device.
I have one question which I can’t find the answer anywhere, although should be simple!
I have the sonoff TH10 with ESP Easy firmware, the ip is: 192.168.0.2, if I want to turn on the relay, I use the following command: http://192.168.0.2/control?cmd=gpio,12,1
which works fine, what I’m struggling to find out is how do I read the temperature/humidity sensors which are on gpio 14, and I didn’t manage to find any answer.
Thank you in advance
Hi there Radu – you might want to find someone who uses esp easy firmware. I use my own and send MQTT commands back and forth.
@radu: i think you think the wrong way, with ESPEasy you do not read the sensor date, instead ESPEasy does send the sensor data to somewhere else…
see pictures for my config:
under config you can define where to send sensor data, e.g simple http get request or mqtt
pic 2 for send config…
Hello krikk
Thank you for your answer, after all I’ve found how to get the data from the relay, it’s pretty simple, but not documented, all the details you can get them with 1 call and you receive a JSON answer, the request is link is very difficult: relay-ip:relay-port/json 🙂
Hi Radu,
for me it’s the other way around: I have the temperature working, but can’t switch the lamp. Using the same command, and I hear the switch clicking ,but nothing happens. What is your config for the switch?
also flashed EasyESP on my new Sonoff TH10, works without a problem…
http://www.letscontrolit.com/wiki/index.php/ESPEasy
Gpio14 is used for reading the DHT22 sensor…
Thanks Pete for this great blog.
Thanks to your direction I’ve managed to flash a webserver on a sonoff TH . However I’m unclear:
– how I can read the temperature / humidity from the ESP 8266 : which pin? Which configuration?
Thanks!
André
Andre – your note is unclear – you’ve “flashed a webserver on a Sonoff TH” – what webserver and what software did you used?
I just purchased my first sonoff with another on the way. I do have a question regarding the timer function native to the device. Are the times stored on the device or is it necessary that my IPhone be in range for the timer to work?
I’m not following this…
Good afternoon, everyone. I just opened up my new Sonoff POW, and, as exlected, it’s a fine little switch. The on oars relay is rated for 1 hp at 240v, so I will likely give a solitaire feild test on my big dirty .5 hp pumps soon.
I’ll use one for each pump, plus a TH to monitor the water temp.
Meanwhile, I have it measuring the power useage of my Sonoff controlled fishtank.
Ivery been focusing on the hardware, and have been using Ewelinks, as it meets my needs.
As for the power sensor, I was hoping I could jumper in a nice closed core current meter, but I’ll need to trace it out a little more before I start cutting it up. The good news is the 16A relay can likely handle all but the most industrial applications.
Alex.
Here are some internal shots.
And the underbelly
I have all the new Itead devices on the way, should be here toward the end of October and I’ll tackle all of them – so the more info folks can provide beforehand the easier it will be for me 🙂
Speaking of new, does that include https://www.itead.cc/sonoff-pow.html this device is so intriguing. Having cheap power consumption monitoring at any outlet, amazing times.
I have the POW sitting in front of me in the queue of things to look at.
I received a sonoff pow today and I’m trying to flash it but I believe the button may not be connected to GPIO0.
Have you managed to flash it? If so, would love some pictures/instructions on how to do it!
Pictures coming up of Pow, Dual and 16A but I have a dentist appointment this morning (all morning job).
Hi
I am interested in this
https://www.itead.cc/4-channel-wifi-wireless-switch.html
Itead has confirmed that it is based on Esp8266
can I replace the firmware like Sonoff device?
pacitzu
This is new to me – and hence I’ve not had a chance to look at it – I’ll drop ITStudio a note and if they ship of a sample I’ll have a look with a view to modifying the software.
Pete.
Hi Peter,
Itead has a new device https://www.itead.cc/smart-home/sonoff-touch.html
Can you make un article about it. I am interested about touch, because the other components are esp8266 and one relay (maybe)
About the POW please focus on power measuring algorithm, a small example working on Arduino will be nice.
Keep up the good work
Hi Be aware that the sonoff touch requires a neutral connection at the switch. Whilst this is normal in US houses it is unusual in UK houses due to our solid walls leaving restricted space for wiring and pattress depth.
Same here in Indonesia. No neutral in the light switch sockets.
For this reason, I have chosen to use these with custom made enclosures. A lot more expensive of course, but no batteries and wiring required. As I live in an apartment, I don’t have many switches to deal with an my Amazon Echo takes care of the front room lighting and sockets. There is a module for the Pi that plugs into the GPIO port and there is a Node-red module to decode them.
http://sg.element14.com/enocean/ptm-210/module-switch-radio-tx-868mhz/dp/2134137?ost=PTM210&selectedCategoryId=&categoryId=800000003591&searchView=table&iscrfnonsku=false
No neutral here in Spain.. I started looking into this and the more I do the more I wonder why Britain came up with this live-neutral system in the first place. I know why we came up with the ring main – to save copper!
Can anyone post a step by step description of how to put the TH10 into flash upload mode? I’ve seen a couple of methods posted, but have not been able to get the board into the upload mode (I have previously been successful doing this with the other itead Sonoff unit, but haven’t been able to do so with the TH10).
Looking at the schematic, if you hold the BUTTON down and then apply power, it should go into the programming mode. E_FW is the one you want on the schematic.
Oh, sorry – I just assumed that was common knowledge. Yes, the button held down with the power off lets you program them. From there on it can be used as a toggle for the output (well, it can on my software) and also for web access… but I’ve not made that last one the default yet, I think it defaults to GPIO2 for web setup for our own boards. Pity there isn’t something that would uniquely identify the SONOFF board.
Thank you, this worked great. Unfortunately the itead folks got a bit more clever with this device. I was able to download my Arduino Sketch, and it attempts to work, but it appears the bootloader on this device is set up to load the itead configuration firmware before my sketch loads. Other devices, such as the Sonoff relay board don’t do this. The net result is that the device comes up in AP mode before the sketch attempts to start the WiFi server in my sketch. Looks as though I need to fully erase the memory in the ESP8266. Can someone point me to a method of erasing the memory that still allows me to download a sketch (doesn’t “brick” the TH10)?
I’m having trouble with this David… unless I’m reading your note incorrectly – it is suggesting that somehow, sometihng iTead have done is interfering with the flashing process. Not buying it. That process is set in ROM on the ESP8266 and cannot be altered (if it could I’d be changing that 78k debug output to 115k).
Ok, so – it may be that you need to PROPERLY clear the device first in case there is something going on at the top end of the setup – recent versions of the SDK DEMAND that this is set up – earlier versions did not. Reading through my setup article might provide insight. https://tech.scargill.net/blowing-the-home-control-2016-code/
Just ordered a POW, and I would be happy to give a report when it gets here.
Excellent
I had a couple of Sonoff Dual’s arrive yesterday. Very impressed by the casing and push terminals – I think they’re quite an improvement over the screw terminals on the original.
Does anyone know how to pull GPIO0 low to load new ESP8266 firmware via serial? On the single channel version, the push button does this – but it doesn’t seem to do it on this one.
Any ideas?
Thanks.
Found details on how to get into programming mode here in an article by Markus Maeder, together with protocol for driving the relays.
http://support.iteadstudio.com/support/discussions/topics/11000006870
They look good, but I’ve just had a sonoff die after only 2 day of operation. Mains input section has gone. powered from the program port and all’s well.
Now I’ve got to see which bit has gone too much talk of reliability of late!
Never happened to me – let us know what happens. And if it is the unit – let ITEAD know what has happened – I think they’ll want to know.
New model just come out –> https://www.itead.cc/sonoff-dual.html
same as TH10 but dual output (2 relays) and no temp probe connector
Thanks Giovanni
The DUAL and POW modules are on their way to me now – expect a review soon!
what’s POW? I find only a thread on upcoming module, and latest post is from yesterday asking for ETA…
No idea – I’ll tell you when it turns up!
Some doc already available.
” Sonoff Pow can report your connected device’s immediate wattage consumption or kWh energy usage”
https://www.itead.cc/wiki/Sonoff_Pow
For those eager to try MQTT (or serial, web, http) on Sonoff, Sonoff Dual or Sonoff TH10/TH16 use my latest updated Sonoff-MQTT-OTA-Arduino code available from https://github.com/arendst/Sonoff-MQTT-OTA-Arduino
Peter, do you have an overview of the used pins? I don’t quite get how to read the DHT yet…
In my software you select either the DHT22, DHT11 or Dallas….all on GPIO14 in this case…
Oh and the output is on GPIO12. What I don’t understand is that in the middle of the board is quite a large 0.1″ pitch connector – or rather the filled in holes for one – and not much attached. I wonder why they didn’t take the opportunity to put the other IO onto that connector. Still – it’s a step up. I’m just so annoyed that I messed up the tracks on the FLASH chip when trying to update.
Hi Peter, did you use a hot air setup to remove the IC?
I purchased an ATTEN 8586 a few years ago and it was the best investment I’ve ever made. So easy to remove IC’s or other parts from boards without doing any damage to the PCB itself. Oh and it doubles up nicely for heatshrinking jobs too 🙂
CE is no guarantee of safety.
CE marking is not, but if the product really passed the standard safety tests, it is.
For us hackers it doesn’t matter much, but if Itead wants to sell their products to as a consumer product within the EEC, they need to have CE certification passed, either by them directly or by the importer, as customs may require proofs at any time.
And be sure that if your device catch fire, the insurance company will not pay for your burnt house if they can prove that it may be the cause 🙂
Again, this is a risk that we can tak as hackers, but we know what we are doing, are we?
I think they’ll be managing quite nicely regardless – our market is but a tiny corner – and as you say enthusiasts – and I do think that is where they are interested – after all you could not put programming and other connectors onto a product for the mass market most of whom would not know a programmer from a hole in the ground. I doubt VERY much if a British insurance company would miss the opportunity to rubbish a Chinese product REGARDLESS of what markings it had. “And which reputable firm did you buy this from, sir?” – “China” – “Oh, I’m afraid we don’t do China”. Trust me – I’ve been there.
Frankly I’d be more worried about people poking wires into a connector 🙂
And… while I think about it – I doubt VERY much if the mass market read this blog 🙂 So I’m assuming I’m talking to people who are (a) enthusiastic and (b) have something of a clue how not to get electrocuted.
(Disclaimer: If anyone electrocutes themselves, I don’t exist – you only imagined reading this blog).
i’ve just spent the last few years getting the CE marking up to date for a range of products from medical to machinery. only issue we cant see it the creepage and clearance inside the switch mode supply transformer. the PCB etc goes out the window if the transformer is badly wound and insulated.
But i’m more happy to run with them than an imported psu that you can’t open.
anyway I’ve a timer that states that it should not be left unattended! so not sure why you would use it if the manufacture don’t think it’s safe!!
It is no guarantee of anything other than it has a CE mark and it is detrimental to small R&D companies for no good reason.
Just a quick look but that does not look like a CE mark, It looks like the so called “china export” mark. With the CE mark the C and E should form circles that over lap.
That said I now have two of the old one running your code and they seem to be rock solid. un-plug them and plug them back in and they connect and start running first time every time.
I’m quite happy to run these at home as the board has better creepage and clearances then some CE marked products I’ve looked at.
I will believe it is actually CE when I see the report 😉
https://www.itead.cc/smart-home/sonoff-th.html#comment-2872252393
No answer so far!
I don’t put much store in CE marking – it means very little as you can easily self-certify and as you say there is China engineering. You can buy the stickers cheap and for small batches CE testing is… well, don’t get me started. One look at these boards and you can tell they’ve put thought into them – the power area compared to some oriental power supplies is well thought out.
Itead has reported they are working on the CE certification. They expect to have it in no more than a month.
HAH! I knew I’d seen that name somewhere. Can you check your blog. I’m having a go at your Sonoff code and I’ve managed to get as far as the opening screen on PlatformIO – and downloading your project. Anything further than that is currently escaping me… a starter for 10 would be appreciated.
Pete.