I'm loving your videos at the moment Andreas, really great content ,that is exactly in line with the stuff I am playing with myself at the moment, so I am picking up good tips from your videos and code examples :)
Nice video! MQTT is great because it is widely used, easy to implement and is supported by various software packages.My tips for today: 1. Node-RED makes it easy to integrate both MQTT and a wide range of other protocols such as REST. It is very easy to setup and runs on Raspberry PI and other Linux computers. 2. With ESP Easy it is easy to create MQTT nodes without any programming.
I have to investigate a little more in node red, I know. But currently, I am working on the ESP infrastructure which has the capabilities I showed in this video. Especially the OTA stuff is not easy (at least, the details). In principle, it works but... I want also to have the data completely separated from the code that I can distribute standard coding. And of course, I took the opportunity when I got the code from ITEAD for this Chinese chip and show my viewers, how to use it.
Very interesting subject and idea. I did not know sonoff can be used this way. Even ESP8266 documentation I found in Chinese with some English lines in it. Good job in explaining. I am ordering sonoff just for this purpose and post you my results. Thank you.
This is very interesting. There's a lot to take in here - think I need to watch it again and have a look at the code to get to grips with it fully. Many thanks for sharing it. Arthur
Hi Andreas. I like your videos and its content. In your sketch "SonoffPOWV2.ino", you're using two debugging methods: RemoteDebug and the macros DEBUG_PRINT/PRINTLN. These two are not declared. Furthermore, you forgot to remove some variables, like "pirState" or "currentPirState". You probably found some inspiration from another sketch ;-). Thanks for your videos. Sam
You are right with my sketches, the are never perfect. They are usually just a "snapshot" of the state of the work during filming. Sometimes, they stay like that, and sometimes they develop further. Like with this one. I think, I will update these sketches during the next week. But, it will be a "major" update. I changed a lot in the meantime To the forgotten variables: You find these in most of my sketches, because I do not check and the compiler does not tell me. Maybe if I would enable the compiler warnings it would be different. But so far, they did not hurt too much.
TheDambo1 , I am using Blynk in combination with MQTT using Node-RED. With Blynk I now can display information from MQTT-nodes and control them, such as display movement when a PIR-sensor is triggered or switch a light on.
I am not sure if this fits also to the newer Version POW R2. Would be great to hear any news about it. I wanna measure the power coming from the solar power modulator ... cause I can read and follow these measurements from the distance pretty easily. Thanks
I had a look at all the smart plug references available with manufacturers and I decided to use Sonoff POW for my AC power consumption. Is it capable enough to measure a load drawing around 10A of current?
I would invest in one of the cheapish USB isolators based on the analog devices chip. Killing a $2 usb to serial adapter on the isolated side is a lot less heartbreaking than killing your whole PC. :)
A quick question. Could these Sonoff POW be used to smarten-up dumb charges that don't switch off when batteries are charged? I have a few cheap NIiCd devices (e.g. garden blower) that just keep charging when the battery is charged. My thought is they could monitor the current and when it drops at the end of the charging cycle when the battery reaches full charge. Could also be used used with Phones/laptops/etc so they don't get the flutter charge after they have charged up. What do you think?
+John Morrison Because currents on 220 volt are much smaller than on 12 volt it will only work for bigger consumers. For small consumers it is better toswitch the DC side
Thanks for the reply. That is a shame. I was hoping the current drop going into the charger(s) would indicate a full charge. Back to the drawing board for me.
Thank you (again) for your video. Is tehere really no way to connect e.g. a temperature sensor to the Sonoff POW? You say that GND can be at live voltage, but for the ESP8266 to work, there must be some way to get 3.3V *maybe even 5v?) relative to GND inside there, or am I mistaken?
Of course, you can connect anything to the ESP. But everything has a voltage relative to earth of 220 volts. Relative to its gound it is 3.3 volt. So pay attention! You are too young to die.
Thank you for the answer - I just want to connect a temperature sensor to it, which will be far away from any curious hands, and probably inside a waterproof box. Greetings from Costa Rica! :-)
I just received some POW's ordered directly from Itead.cc. Out of curiosity based on your comment on the circuit's isolation I tested it using a DMM and unless I did it wrong twice, I measured near zero Ohm resistance between the "L in" and the logic GND. Was this also the case for you as from your comment I understood the zero Ohm link being between earth and logic ground?
Andreas Spiess Thank you for the reply but what I was after is that on my DMM test the live input seemed to be connected to logic ground (and not the input earth ground for example). This is mind boggling for a hobbyist like me (software engineer by trade). It sounded surprising also to an EE relative familiar with the device. Edit: I forgot to thank you for this video since otherwise this would have been something unexpected. I haven't found too much about it even by specificly searching for Sonoff POW isolation.
Hi Andreas, I've downloaded your code for this and have a couple of queries, you appear to assign an interrupt for GPIO0 "attachInterrupt(GPIO0, ISRbuttonStateChanged, CHANGE);" but there doesn't seem to be a handler for it, also in the loop section your have the following. "if (buttonChanged && buttonTime > 4000) espRestart('C', "Going into Configuration Mode"); // long button press > 4sec if (buttonChanged && buttonTime > 1000 && buttonTime < 4000) iotAppstory(); // long button press > 1sec " However it appears that buttonTime is not set anywhere so I cant see that this code would actually do anything? Thanks for all your video's very interesting and helpful. Nick Sharp
On my Sonoff POW, relay failed in "ON" state just several hours after first use, with just 40 watts of load. Had to replace it with a different kind, glued in place with a double-sided tape, and connected with wires. Do not rely on these cheap devices for anything really serious.
Hi Andreas. Do you know of any wifi power consumption monitors that can be wired to a central household fusebox to monitor consumption on each circuit? I am familiar with Arduino and Raspberry Pi so programming isn't an issue - I don't know the hardware that is required. Thanks for taking the time to make your videos and share them with everyone.
I am not in Home automation, so, the only product I know is this one. If you want to measure at the fusebox, I think, it would be sufficient to measure voltage once and then, for every fuse. I would use a contactless hallsensor like the WCS1800 around each wire. Like that, you have no change in the wiring. Maybe there are also commercial products available, but I do not know.
Hi Andreas, I would like to put my own Arduino-Sketch on the Sonoff (because I have already a webservice that I want to use) and add your functionality of reading measured data from the Sonoff device. As far as I understood I just have to include the library from itead (for the HLW8012 Power Meter Chip) and use it to read data. Unfortunately the link in this video is no longer up and available. Could you perhaps post a link to this library that works so that I can download and use it ? BR Gawan
Hello Andreas. It's needless to say that I enjoying your videos very much. They are very interesting and instructive. i'm building my HA with openhab and i'm interesting to install MQTT Sonoff POW in my setup, but i encounter with a small problem. in Arduino i copied your code but when i trying to compile or burn the code to the Sonoff i get an error "exit status 1 'rtcMemDef' has a previous declaration as 'typedef struct rtcMemDef rtcMemDef' . does it something with my Arduino IDE? "
Hello Andreas! Thank you for the video. Just a small question about the sonoff: I've an AC to DC power supply with this rating 220V, 250W, 50Hz, 0.89A on input and 12V, 25A on output. Will it work with the sonoff? I'm confused by their 10A/16A rating Thanks!
If you want to connect the 220 volt side of your power supply to the Sonoff, you do not care about the 12 Volt Amperes. So, your device consumes less than 1A, which is much less than the rated 10A of the Sonoff
Dear Andreas, i like to use sonoff pow for measuring the power consumption of all my house. The 16A is enough because we I have 3kW max energy forniture. I like to bypass the relay in this way the power in the house is always on, and i like to place this device before all home system. I have raspberry with mqtt server and home assistant for collect the data. It's all this possible? What is your think about this? Thanks in advance.
I probably would not do it because I would not trust the device running on such high current all the time. I would prefer a device which just goes around the existing wire to measure ampere. Like that, you do not have to change anything at this very important place. Here, it also would be forbidden to add a device at this place.
Thanks for your advice, I try to build or find something to put around the existing wire. Like this: www.hackster.io/whatnick/esp8266-iot-energy-monitor-b199ed
It is 50 Hz. That is not the issue. But if your wave forms are somehow distorted because the load is not linear, you do not get good readings. That is, why the better Multimeters offer RMS functionality. Cos pi is in addition and I did not take it into account. I forgot about it till your comment (my degree is 40 years back). Now, I have to look at it... Thank you!
Nice, I was looking to implement this in ESP Easy, What GPIO pin is HLW8012 connected to on the ESP? My question is more, how does the HLW8012 communicate with the ESP?
One command line from ESP and two data lines from the power IC. Dead simple. Optocouplers would be possible, but then you need two power supplies. That was NOT separated here, so mains voltage everywhere. if you're lucky but based on N, bad if it's based on HOT.
I'm loving your TH-cam channel - I just wish I found it earlier! I've made a home automation system with Raspberry Pi's and Python, but would like to use ESP8266's and MQTT, with one Pi Zero W running Node Red to control everything. Have you tried the Peacefair PZEM-004T to measure voltage/current/power? I've been using it for just over a year now to monitor my home energy usage, using a Raspberry Pi via USB, and this works great. The PZEM measures up to 100A, i.e. it can monitor the whole house, and it's under $9. I would like to use an ESP8266 instead of a Pi, using its Tx/Rx pins. I have converted a PZEM to work with 3.3V, and using an oscilloscope I can see that the ESP8266 is sending the requests and the PZEM is sending responses, but the ESP8266 doesn't see them. Some people say that there is a problem with the Arduino serial routines; I've tried different serial libraries and different versions of the Arduino IDE, but so far haven't got it to work. If you have experience with the ESP8266 Tx/Rx comms, or have used the PZEM with an ESP8266, I would appreciate hearing about them! If not, and if you are interested, I'll let you know if I eventually figure it out.
Yes, I tried it back in December - I'll have to check my notes to remember exactly what happened. After I couldn't get it to work I asked around, and some people said that there are issues with the comms library, and others said I needed to go back to an earlier version of the Arduino IDE. Since it works well on my Pi, I gave up for the time being. But I'm ready to try it again.
I have a problem in my sonoff pow r2.It doesn't reading a power or current but still working its switching principle.Why is that and where is the component has damage?please help how can i fix it?thank you
Cool, opening a hot device. If you don not know what you are doing you will surely get a electric shock. If you connect an oscilloscope there, it goes bang and fire! Exciting and Dangerous. The manufacturer could have donated three opto couplers and an isolated power supply unit for the ESP, but the power IC must remain on the hot side and be supplied with 5 volts anyway.
Could you use 3 of these for 3 phase supply? Im sure we use maybe 30 amps max on across all 3 fazes so 16A max is fine. also are these two way, meaning they can count backwards too? We have solar power panels so would it count the power the solar made as the one used by the house or would it just not count
Hi! you can test if this sonoff can measure positive and negative current? I want connect to my solar inverter, make a production log and cutoff standby of inverter during night. good Work!
We anyway would call it in German. But maybe I did a mistake in English. I looked it up in wikipedia and they say, that the Enlish just say "mains" and the Americans someting like "household power" Is this the same as your "line voltage"?
Yes, it is the same. There are many ways to name the household power and I have been curious about the standard in many countries as I have taught industrial control systems in Saudi Arabia in the past as well as in Canada.
Thanks for the link. Because I only switch small loads (200W) I did not experience any problems. Mine also look different than the ones on their picture.
As always very good video and useful information. In this case I want to ask you something. I have three-phase electric power at home, can you tell me if this device is going to work for me? Thanks Andreas, let me remark your very good job again. Oriol
So if I have a regular lamp it is going to work properly. My question is not about the relay because it worked for me in the past. The real challenge was with power meters I had to use three phase meters in the past.
The vacuum has a poor power factor and the Sonoff likely does not measure the phase angle or deal well with the negative (reactive) power when summing/averaging the power over many cycles.
Hi Andreas, does the chip measuring REAL or ACTIVE POWER, or APPARENT POWER ??? May be that is the problem of different values. Some chips only measure current (that is APPARENT) and multiply by voltage to get POWER. That is not REAL POWER that your electric company will bill. Regards,
I do not have the knowledge nor the equipment to test that. It is well possible, that this is the issue. Maybe a viewer is more into this topic and can enlighten us...
Hi, normally that kind of socket power meters measure APPARENT POWER and TOTAL/APPARENT CURRENT. Also your UT71D measures TOTAL/APPARENT CURRENT. APPARENT POWER = APPARENT CURRENT * VOLTAGE On the other hand: Active Power = Apparent Current * Voltage * powerfactor, where powerfactor is cosine of the angle and is always 1 or less. Other way: Active Power = Apparent Power * powerfactor Active Power, usually, is what your company bill you monthy. But we don't know what kind of power measures SONOFF POW. you can check with a old incandescent bulb (usually powerfactor = 1), vs a new low power bulb (powerfactor < 0.80) Check: SONOFF power vs UT71D current * your voltage. More info about this and a great project is openenergymonitor.org/emon/modules/emonTxV3 It is easy to build your own.(as I do) Regards,
I remember my studies... This for me always was the "dangerous" part (because of high voltage). So, I concentrated more on the small stuff. Even today, I get wet hands, when I have to work on mains... Thanks for your explanation. I did this check: "SONOFF power vs UT71D current * your voltage." This was the basis for the comparison. But this does not include the power factor, if I remember right...
Hi Andreas, mee too. High Voltage is very dangerous. I am not an expert, but just in case.... Regards and thanks for your great work !!!! I came from arduino, and I am trying now to begin with wemos mini d1 boards. I have to finish first my home's wattmeter monitor. (after I will have to change it to ESP8266 base to upload data to cloud and not to a SD. Regards and happy new year.
Hi people! Anybody know is it possible for this sonoff pow device to report if power is greater or smaller than some given comparable value (for example to inform you when is power consumption 0W , or smaller/greater than for example 100W), so you can know if some device finished it cycle for example? Oven, water heater, etc... that would be interesting feature. Or the whole thing must be in Sonoff app?
0:46 That CE sign doesn't mean a thing really. It's a fake China Export logo, not a Conformité Européenne logo, so please do not _assume_ it's safe. And even if it's were real CE mark that doesn't mean the device is safe. It only states that it's conforming to European standards according to the _manufacturer_. The CE mark does not indicate that a product has been approved as safe by the EU or any other authority.
+Jean-Jacques de Balzac So, if I understand you right, we should not bother if the device has a CE sign or not, because it anyway has no value. That is ok for me.
A fake CE sign holds absolutely no value, because anyone can put it on their device... A real CE sign only states that it conforms to European standards to make free trade within the EU easier. It's not a proof of safety. That's why you shouldn't automatically assume a device is safe because of the CE logo. de.wikipedia.org/wiki/CE-Kennzeichnung
I have a problem to upload a sketch to my SONOFF POW. Tried to upload the sketch OTA-mDNS-SPIFFS but without success. [th-cam.com/video/GoQXOLB50HA/w-d-xo.html] #32 Internet of Things with ESP8266 #4: Upload Programs Over the Air (OTA) drive.google.com/open?id=0B_vGp6rdca--a29UdktWU20yc3c - online directory There is an online PDF available, online readable drive.google.com/open?id=0B_vGp6rdca--YTc1VTluUVMwY1U in the hope to make it easier and more accessible. Information about the connections between SONOFF POW and USB-SERIAL How to select/activate ESP8266 in the IDE and adjust the correct settings (what I hope, these I found back in other tutorial[s] ) This is the output which I get when I try to upload OTA-mDNS-SPIFFS Arduino: 1.6.12 (Mac OS X), Board: "Generic ESP8266 Module, 80 MHz, 40MHz, DIO, 115200, 512K (64K SPIFFS), ck, Disabled, None" OTA-mDNS-SPIFFS ... Sketch uses 291,933 bytes (67%) of program storage space. Maximum is 434,160 bytes. Global variables use 35,716 bytes (43%) of dynamic memory, leaving 46,204 bytes for local variables. Maximum is 81,920 bytes. warning: espcomm_sync failed error: espcomm_open failed error: espcomm_upload_mem failed error: espcomm_upload_mem failed
I think, OTA only works if your sketch on the ESP is OTA enabled. So, at least once, you have to be able to upload a sketch via Serial. And your sketches have to be written acordingly. BTW it might be useful to search for the ESURNA project. There, you find a ready made firmware for this device.
I'm loving your videos at the moment Andreas, really great content ,that is exactly in line with the stuff I am playing with myself at the moment, so I am picking up good tips from your videos and code examples :)
That's how it should be. :-)
Hi Andreas. Your channel is awesome. It has really helped me understand the 8266 and its successor.
Nice video! MQTT is great because it is widely used, easy to implement and is supported by various software packages.My tips for today: 1. Node-RED makes it easy to integrate both MQTT and a wide range of other protocols such as REST. It is very easy to setup and runs on Raspberry PI and other Linux computers. 2. With ESP Easy it is easy to create MQTT nodes without any programming.
I have to investigate a little more in node red, I know. But currently, I am working on the ESP infrastructure which has the capabilities I showed in this video. Especially the OTA stuff is not easy (at least, the details). In principle, it works but... I want also to have the data completely separated from the code that I can distribute standard coding. And of course, I took the opportunity when I got the code from ITEAD for this Chinese chip and show my viewers, how to use it.
Very interesting subject and idea. I did not know sonoff can be used this way. Even ESP8266 documentation I found in Chinese with some English lines in it. Good job in explaining. I am ordering sonoff just for this purpose and post you my results. Thank you.
You are welcome!
Mr Andreas you are always Great , popular scientist, regards from Greece
Thank you! Greetings back to Greece.
This is very interesting. There's a lot to take in here - think I need to watch it again and have a look at the code to get to grips with it fully.
Many thanks for sharing it.
Arthur
I do not tell you how much time it took me to get there... But there are a lot of interesting concepts in it, for sure.
You do good work, some of the best videos i have found, you have my admiration and appreciation, thank you sir
Thank you for your nice words!
Uhh the remote debug library is cool! Thanks for introducing!
You're welcome!
I agree, we need this ;)
:-)
Excellent as always
:-)
Hi Andreas. I like your videos and its content. In your sketch "SonoffPOWV2.ino", you're using two debugging methods: RemoteDebug and the macros DEBUG_PRINT/PRINTLN. These two are not declared. Furthermore, you forgot to remove some variables, like "pirState" or "currentPirState". You probably found some inspiration from another sketch ;-). Thanks for your videos. Sam
You are right with my sketches, the are never perfect. They are usually just a "snapshot" of the state of the work during filming. Sometimes, they stay like that, and sometimes they develop further. Like with this one. I think, I will update these sketches during the next week. But, it will be a "major" update. I changed a lot in the meantime
To the forgotten variables: You find these in most of my sketches, because I do not check and the compiler does not tell me. Maybe if I would enable the compiler warnings it would be different. But so far, they did not hurt too much.
Great job! MQTT seems quite good. I need to try it. Before I work only with Blynk
I never tried Blynk, but I have to one day.
TheDambo1 , I am using Blynk in combination with MQTT using Node-RED. With Blynk I now can display information from MQTT-nodes and control them, such as display movement when a PIR-sensor is triggered or switch a light on.
Now, it moved up in my list!
Thank you, great video!
:-)
another good video. at @3:00 you say the sense resistor is 0.01 ohms, that would be 10 mili ohms.
You are right!
I am not sure if this fits also to the newer Version POW R2.
Would be great to hear any news about it. I wanna measure the power coming from the solar power modulator ... cause I can read and follow these measurements from the distance pretty easily.
Thanks
So far I have no plans with the Sonoff POW
Very interesting!
+Mauro Sedrani :-)
I had a look at all the smart plug references available with manufacturers and I decided to use Sonoff POW for my AC power consumption. Is it capable enough to measure a load drawing around 10A of current?
According specs: Yes
I would invest in one of the cheapish USB isolators based on the analog devices chip. Killing a $2 usb to serial adapter on the isolated side is a lot less heartbreaking than killing your whole PC. :)
You are right. I ordered one of these, but before testing it, I did not want to give recommendations. Anyway, you have to pay attention...
A quick question. Could these Sonoff POW be used to smarten-up dumb charges that don't switch off when batteries are charged? I have a few cheap NIiCd devices (e.g. garden blower) that just keep charging when the battery is charged.
My thought is they could monitor the current and when it drops at the end of the charging cycle when the battery reaches full charge.
Could also be used used with Phones/laptops/etc so they don't get the flutter charge after they have charged up.
What do you think?
+John Morrison Because currents on 220 volt are much smaller than on 12 volt it will only work for bigger consumers. For small consumers it is better toswitch the DC side
Thanks for the reply.
That is a shame. I was hoping the current drop going into the charger(s) would indicate a full charge.
Back to the drawing board for me.
Which one is the frequency in the code? ESP frequency or Mains Frequency?
Interesting, Thanks for sharing.
Is it possible to use Sonoff POW and normal wall switch at the same time to turn the lights ON/OFF?
Yes
Yes, I am busy doing just that, my light switch is a two way light switch, I will then use the energy monitoring to detect if the light is on or off.
Thank you (again) for your video.
Is tehere really no way to connect e.g. a temperature sensor to the Sonoff POW? You say that GND can be at live voltage, but for the ESP8266 to work, there must be some way to get 3.3V *maybe even 5v?) relative to GND inside there, or am I mistaken?
Of course, you can connect anything to the ESP. But everything has a voltage relative to earth of 220 volts. Relative to its gound it is 3.3 volt. So pay attention! You are too young to die.
Thank you for the answer - I just want to connect a temperature sensor to it, which will be far away from any curious hands, and probably inside a waterproof box.
Greetings from Costa Rica! :-)
I just received some POW's ordered directly from Itead.cc. Out of curiosity based on your comment on the circuit's isolation I tested it using a DMM and unless I did it wrong twice, I measured near zero Ohm resistance between the "L in" and the logic GND. Was this also the case for you as from your comment I understood the zero Ohm link being between earth and logic ground?
You are right. The PCB is connected to the live wire. That is the reason for my warning.
Andreas Spiess Thank you for the reply but what I was after is that on my DMM test the live input seemed to be connected to logic ground (and not the input earth ground for example). This is mind boggling for a hobbyist like me (software engineer by trade). It sounded surprising also to an EE relative familiar with the device.
Edit: I forgot to thank you for this video since otherwise this would have been something unexpected. I haven't found too much about it even by specificly searching for Sonoff POW isolation.
Hi Andreas,
I've downloaded your code for this and have a couple of queries, you appear to assign an interrupt for GPIO0
"attachInterrupt(GPIO0, ISRbuttonStateChanged, CHANGE);"
but there doesn't seem to be a handler for it, also in the loop section your have the following.
"if (buttonChanged && buttonTime > 4000) espRestart('C', "Going into Configuration Mode"); // long button press > 4sec
if (buttonChanged && buttonTime > 1000 && buttonTime < 4000) iotAppstory(); // long button press > 1sec
"
However it appears that buttonTime is not set anywhere so I cant see that this code would actually do anything?
Thanks for all your video's very interesting and helpful.
Nick Sharp
This is an old code and maybe you are right. iotappstory has now a completely new library.
On my Sonoff POW, relay failed in "ON" state just several hours after first use, with just 40 watts of load. Had to replace it with a different kind, glued in place with a double-sided tape, and connected with wires.
Do not rely on these cheap devices for anything really serious.
Hi Andreas. Do you know of any wifi power consumption monitors that can be wired to a central household fusebox to monitor consumption on each circuit? I am familiar with Arduino and Raspberry Pi so programming isn't an issue - I don't know the hardware that is required. Thanks for taking the time to make your videos and share them with everyone.
I am not in Home automation, so, the only product I know is this one. If you want to measure at the fusebox, I think, it would be sufficient to measure voltage once and then, for every fuse. I would use a contactless hallsensor like the WCS1800 around each wire. Like that, you have no change in the wiring. Maybe there are also commercial products available, but I do not know.
Andreas Spiess thank you!
Hi Andreas,
I would like to put my own Arduino-Sketch on the Sonoff (because I have already a webservice that I want to use) and add your functionality of reading measured data from the Sonoff device.
As far as I understood I just have to include the library from itead (for the HLW8012 Power Meter Chip) and use it to read data.
Unfortunately the link in this video is no longer up and available.
Could you perhaps post a link to this library that works so that I can download and use it ?
BR
Gawan
The link which does not work was the recall notice and had nothing to do with the coding. The link to the code still works.
Hello Andreas. It's needless to say that I enjoying your videos very much. They are very interesting and instructive. i'm building my HA with openhab and i'm interesting to install MQTT Sonoff POW in my setup, but i encounter with a small problem. in Arduino i copied your code but when i trying to compile or burn the code to the Sonoff i get an error "exit status 1
'rtcMemDef' has a previous declaration as 'typedef struct rtcMemDef rtcMemDef' . does it something with my Arduino IDE?
"
I do not know and it is hard to do remote diagnostics. I never had this error. Do other sketches work? Then it is probably not with the IDE
Hello Andreas!
Thank you for the video.
Just a small question about the sonoff:
I've an AC to DC power supply with this rating 220V, 250W, 50Hz, 0.89A on input and
12V, 25A on output.
Will it work with the sonoff?
I'm confused by their 10A/16A rating
Thanks!
If you want to connect the 220 volt side of your power supply to the Sonoff, you do not care about the 12 Volt Amperes. So, your device consumes less than 1A, which is much less than the rated 10A of the Sonoff
Problem Solved.
Thank you so much!
Dear Andreas,
i like to use sonoff pow for measuring the power consumption of all my house. The 16A is enough because we I have 3kW max energy forniture. I like to bypass the relay in this way the power in the house is always on, and i like to place this device before all home system. I have raspberry with mqtt server and home assistant for collect the data. It's all this possible? What is your think about this?
Thanks in advance.
I probably would not do it because I would not trust the device running on such high current all the time. I would prefer a device which just goes around the existing wire to measure ampere. Like that, you do not have to change anything at this very important place. Here, it also would be forbidden to add a device at this place.
Thanks for your advice, I try to build or find something to put around the existing wire.
Like this: www.hackster.io/whatnick/esp8266-iot-energy-monitor-b199ed
I don't get it, isn't frequency just stable 50Hz? or is it a cos phi factor?
Makes a cheap wifi master/slave socket board (Steckdosenleiste)!
AltMarc i think the frequency is the measurment value of the power sensor
It is 50 Hz. That is not the issue. But if your wave forms are somehow distorted because the load is not linear, you do not get good readings. That is, why the better Multimeters offer RMS functionality. Cos pi is in addition and I did not take it into account. I forgot about it till your comment (my degree is 40 years back). Now, I have to look at it... Thank you!
Nice, I was looking to implement this in ESP Easy,
What GPIO pin is HLW8012 connected to on the ESP?
My question is more, how does the HLW8012 communicate with the ESP?
The HLW8012 has a freqzency output. So, you have to measure its fequency.
I am checking your github, I will try it :-)
Thanks
:-)
One command line from ESP and two data lines from the power IC. Dead simple.
Optocouplers would be possible, but then you need two power supplies.
That was NOT separated here, so mains voltage everywhere. if you're lucky but based on N, bad if it's based on HOT.
I'm loving your TH-cam channel - I just wish I found it earlier! I've made a home automation system with Raspberry Pi's and Python, but would like to use ESP8266's and MQTT, with one Pi Zero W running Node Red to control everything.
Have you tried the Peacefair PZEM-004T to measure voltage/current/power? I've been using it for just over a year now to monitor my home energy usage, using a Raspberry Pi via USB, and this works great. The PZEM measures up to 100A, i.e. it can monitor the whole house, and it's under $9.
I would like to use an ESP8266 instead of a Pi, using its Tx/Rx pins. I have converted a PZEM to work with 3.3V, and using an oscilloscope I can see that the ESP8266 is sending the requests and the PZEM is sending responses, but the ESP8266 doesn't see them. Some people say that there is a problem with the Arduino serial routines; I've tried different serial libraries and different versions of the Arduino IDE, but so far haven't got it to work.
If you have experience with the ESP8266 Tx/Rx comms, or have used the PZEM with an ESP8266, I would appreciate hearing about them! If not, and if you are interested, I'll let you know if I eventually figure it out.
Yes, I tried it back in December - I'll have to check my notes to remember exactly what happened. After I couldn't get it to work I asked around, and some people said that there are issues with the comms library, and others said I needed to go back to an earlier version of the Arduino IDE. Since it works well on my Pi, I gave up for the time being. But I'm ready to try it again.
So far, I have no experience with this device. So, I cannot help you...
I have a problem in my sonoff pow r2.It doesn't reading a power or current but still working its switching principle.Why is that and where is the component has damage?please help how can i fix it?thank you
Unfortunately I cannot do remote debugging :-(
Cool, opening a hot device. If you don not know what you are doing you will surely get a electric shock.
If you connect an oscilloscope there, it goes bang and fire! Exciting and Dangerous.
The manufacturer could have donated three opto couplers and an isolated power supply unit for the ESP, but the power IC must remain on the hot side and be supplied with 5 volts anyway.
Since I write these words I survived ;-) These devices are not intended to be used as we use them..
Could you use 3 of these for 3 phase supply? Im sure we use maybe 30 amps max on across all 3 fazes so 16A max is fine. also are these two way, meaning they can count backwards too? We have solar power panels so would it count the power the solar made as the one used by the house or would it just not count
I think it should be possible. I do not know if they can count backward.
Hi! you can test if this sonoff can measure positive and negative current? I want connect to my solar inverter, make a production log and cutoff standby of inverter during night.
good Work!
I do not know and cannot test it for the moment.
Do Swiss call 'line power' mains power? Line voltage is what we call it in Canada and the US of A.
We anyway would call it in German. But maybe I did a mistake in English. I looked it up in wikipedia and they say, that the Enlish just say "mains" and the Americans someting like "household power" Is this the same as your "line voltage"?
Yes, it is the same. There are many ways to name the household power and I have been curious about the standard in many countries as I have taught industrial control systems in Saudi Arabia in the past as well as in Canada.
Here, we often say: 220 Volt (which is no more true since quite a while, but everybody knows what we mean)
I have peroblems with IOTAppstory.com. No code is downloaded vis OTA. Error in log: 500 ESP MAC is not configured for updates... What can I do ?
Maybe you watch the newest video about IOTappstory. A lot has changed and you even get a library now.
Hi Andreas there is RECALL NOTICE for Sonoff TH16 and POW you can find more here:
www.itead.cc/blog/sonoff-th16-and-pow-recall-notice
Thanks for the link. Because I only switch small loads (200W) I did not experience any problems. Mine also look different than the ones on their picture.
Hi. Now you cold try sonoff pow r2. Much better
I do not have one in my lab. And for the moment I have no plans.
Is it as hackable as the original? Or should I get the original if I want to flash my own firmware?
I have pow R2 and didn't see much of improvements the wiring connectors are still quite awful.
hi Andreas. if the sonoff are without power, are the relays in a normaly closed state or do they brake circuits when they do not have power?
They are normally open
As always very good video and useful information. In this case I want to ask you something. I have three-phase electric power at home, can you tell me if this device is going to work for me?
Thanks Andreas, let me remark your very good job again.
Oriol
Do you have a 3 phase device? Then it will not work, because these devices only have 1 phase
So if I have a regular lamp it is going to work properly. My question is not about the relay because it worked for me in the past. The real challenge was with power meters I had to use three phase meters in the past.
If you use one phase for the lamp it should count the power going into this lamp. I also have 3 phases in the house.
Thanks again. I appreciate your work keep on pushing.
The vacuum has a poor power factor and the Sonoff likely does not measure the phase angle or deal well with the negative (reactive) power when summing/averaging the power over many cycles.
This is what I also think.
Would it be dangerous to use 24h with a consumption of 1300w 24hx365 days? I want to put him in an asic miner
If it is on 220 V it might be ok. on 110 V for sure not. At the beginning, I would closely watch its temperature, just to be sure.
yes 230v in spain thanks :)
Hi Andreas, does the chip measuring REAL or ACTIVE POWER, or APPARENT POWER ??? May be that is the problem of different values. Some chips only measure current (that is APPARENT) and multiply by voltage to get POWER. That is not REAL POWER that your electric company will bill. Regards,
I do not have the knowledge nor the equipment to test that. It is well possible, that this is the issue. Maybe a viewer is more into this topic and can enlighten us...
Hi, normally that kind of socket power meters measure APPARENT POWER and TOTAL/APPARENT CURRENT.
Also your UT71D measures TOTAL/APPARENT CURRENT.
APPARENT POWER = APPARENT CURRENT * VOLTAGE
On the other hand: Active Power = Apparent Current * Voltage * powerfactor, where powerfactor is cosine of the angle and is always 1 or less. Other way: Active Power = Apparent Power * powerfactor
Active Power, usually, is what your company bill you monthy.
But we don't know what kind of power measures SONOFF POW.
you can check with a old incandescent bulb (usually powerfactor = 1), vs a new low power bulb (powerfactor < 0.80)
Check: SONOFF power vs UT71D current * your voltage.
More info about this and a great project is openenergymonitor.org/emon/modules/emonTxV3
It is easy to build your own.(as I do)
Regards,
I remember my studies... This for me always was the "dangerous" part (because of high voltage). So, I concentrated more on the small stuff. Even today, I get wet hands, when I have to work on mains...
Thanks for your explanation.
I did this check: "SONOFF power vs UT71D current * your voltage." This was the basis for the comparison. But this does not include the power factor, if I remember right...
Hi Andreas, mee too. High Voltage is very dangerous. I am not an expert, but just in case.... Regards and thanks for your great work !!!! I came from arduino, and I am trying now to begin with wemos mini d1 boards.
I have to finish first my home's wattmeter monitor. (after I will have to change it to ESP8266 base to upload data to cloud and not to a SD.
Regards and happy new year.
Thanks for the link. I just had one of these Current sensors in the mail... Happy new year to you, too!
Hi, Really new at this sonoff POW - Andreas, I downloaden you shetch but get error since power.h is not found so where can I get this?
It is in my GitHub repository.
Found it already thank you. 👍👍
:-)
How does your firmware compare with Tasmota POW - is your's 'better' :) ?
AFAIK Tasmota had no support for this device when I did this video. Tasmota and Espurna are much better solutions now.
Ah ok, I haven't looked at Espurna yet. I just ordered a POW to play with from China - I guess it'll be with me a few months time hi-hi !
Hi Andreas, when you say "Tasmona is a better solution" do you mean that firmware can measure power/current/voltage with better accuracy?
I think so. But I did not try
Hi people! Anybody know is it possible for this sonoff pow device to report if power is greater or smaller than some given comparable value (for example to inform you when is power consumption 0W , or smaller/greater than for example 100W), so you can know if some device finished it cycle for example? Oven, water heater, etc... that would be interesting feature. Or the whole thing must be in Sonoff app?
Maybe you look at Tasmota or Espurna
Any easy way to reset cost counter in POW R2?
I do not know
how to Light, Fan, and Dimmer Control with ESP8266
Maybe you google "Tasmota". Dimmer is not possible with a Sonoff
0:46 That CE sign doesn't mean a thing really. It's a fake China Export logo, not a Conformité Européenne logo, so please do not _assume_ it's safe.
And even if it's were real CE mark that doesn't mean the device is safe. It only states that it's conforming to European standards according to the _manufacturer_. The CE mark does not indicate that a product has been approved as safe by the EU or any other authority.
+Jean-Jacques de Balzac So, if I understand you right, we should not bother if the device has a CE sign or not, because it anyway has no value. That is ok for me.
A fake CE sign holds absolutely no value, because anyone can put it on their device... A real CE sign only states that it conforms to European standards to make free trade within the EU easier. It's not a proof of safety.
That's why you shouldn't automatically assume a device is safe because of the CE logo.
de.wikipedia.org/wiki/CE-Kennzeichnung
I have a problem to upload a sketch to my SONOFF POW.
Tried to upload the sketch OTA-mDNS-SPIFFS but without success.
[th-cam.com/video/GoQXOLB50HA/w-d-xo.html]
#32 Internet of Things with ESP8266 #4: Upload Programs Over the Air (OTA)
drive.google.com/open?id=0B_vGp6rdca--a29UdktWU20yc3c - online directory
There is an online PDF available, online readable
drive.google.com/open?id=0B_vGp6rdca--YTc1VTluUVMwY1U in the hope to make it easier and more accessible.
Information about the connections between SONOFF POW and USB-SERIAL
How to select/activate ESP8266 in the IDE and adjust the correct settings (what I hope, these I found back in other tutorial[s] )
This is the output which I get when I try to upload OTA-mDNS-SPIFFS
Arduino: 1.6.12 (Mac OS X), Board: "Generic ESP8266 Module, 80 MHz, 40MHz, DIO, 115200, 512K (64K SPIFFS), ck, Disabled, None"
OTA-mDNS-SPIFFS
...
Sketch uses 291,933 bytes (67%) of program storage space. Maximum is 434,160 bytes.
Global variables use 35,716 bytes (43%) of dynamic memory, leaving 46,204 bytes for local variables. Maximum is 81,920 bytes.
warning: espcomm_sync failed
error: espcomm_open failed
error: espcomm_upload_mem failed
error: espcomm_upload_mem failed
I think, OTA only works if your sketch on the ESP is OTA enabled. So, at least once, you have to be able to upload a sketch via Serial. And your sketches have to be written acordingly.
BTW it might be useful to search for the ESURNA project. There, you find a ready made firmware for this device.