logo elektroda
logo elektroda
X
logo elektroda

Low-cost water heating project from photovoltaic overproduction on ESP8266 and Tasmota

Daro1003 
Over-production water heating for PV users under new billing rules.

I would like to present a low-cost project that can be done by anyone who likes electronics and happens to hold a soldering iron in their hand.
The project is designed to switch on the heater when our photovoltaic installation generates a certain power. A control problem often encountered by users of photovoltaic installations - i.e. how to heat water when it is lit.

The system I have presented is very simple to build and cheap, it does not have advanced functions like the systems you can buy for over a thousand zlotys, but I think it will certainly help.

Everything is based on a circuit:
1. ESP8266
PZEM 004-t module, which sees the flow of power with current regardless of the direction, so the final assembly is important to be on a direct wire from the inverter.
3. Free software TASMOTA which we win to the ESP8266 using e.g. NodeMCU Flasher .

The elements I used in the project are:

1. PZEM 004-t measuring module
2. ESP 8266 + board with 5V stabilizer because I just had it, but we can use wemos D1 mini or NodeMCU then we won't need USB TTL programmer but just USB cable from phone to program wemos. For those new to the subject, I would recommend buying a Wems D1 mini, it has everything you need on board for programming and operation once the tasmot is loaded.
3. a button - which will be used to put the ESP into a configuration state.
4. wires to connect the ESP8226 to the input of the PZEM 004-t Module, you can also buy the original cable with plug that fits the PZEM 004-t.
5. the female-to-female wires will also be useful if you purchase the Wemos D1mini.
6. 5V relay module
7. 5V power supply - a phone charger can be used.
8. Tasmota software and NodeMCU Flasher links above.

Components for a heater control project in a photovoltaic system. .

How to connect the module
PZEM to ESP there is a lot of this on the internet, as well as how to upload the Tasmota and its first start-up. I do not want to duplicate these instructions here, they can be found on google.
Borrowed diagram from google:
Wiring diagram of PZEM module to ESP8266 .

We connect the PZEM module to GPIO 4 and GPIO 5 GPIO 4 TX PZEM to GPIO 5 RX PZEM.
We connect the relay module to the free GPIO.
To GPIO 0 and to GND we connect the button giving GND to GPIO0 6 times puts the module into hot-spot mode while giving GND to GPIO while turning on ESP puts it into flash mode.

After loading the tasmota and the first start-up, having the ESP with the tasmota already in our local network, we move on to the module settings:

Screenshot of Tasmota configuration showing GPIO port settings. .

Such settings we save the module restarts and we have the screen:

User interface for the Tasmota system displaying voltage and power data. .

We can check if our relay is working and if we have voltage on the PZEM
Of course we connect 230V to the PEM according to the diagram above.

I for testing did it like this:

ESP8266 module with relay module and wiring. ESP8266 and PZEM 004-t modules connected to a 4-channel relay .

The picture shows a 4 channel relay module connected under two GPIOs because I was testing two rules which are designed to switch on individual relays at different powers. That is, for example, the power going through the PZEM, e.g. above 2000W turns on relay 1, the power going above 3000W turns on relay 2.

How much power we set is an individual matter.

Another key setting is the rule by which the whole system works. A rule borrowed from another forum from my colleague isom to whom I thank for his kindness.

Go to the console tab:

We specify the key rule to run.

Rule1 on Energy#Power>2000 do Power1 1 ENDON on Energy#Power<2000 do Power1 0 ENDON
.

And enabling the rule to make it work:

Rule1 on
.

In the first part of the rule:
Energy#Power> 2000 - we specify from above what power the relay should turn on.

In the second part of the rule:
Energy#Power< 2000 - we specify from below what power the transmitter should switch off.

Now checking that everything is working is enough to mount it in the switchgear.
We mount the measuring clamp on the phase conductor going directly from the inverter and take 230V from the same phase to the PZEM.
The PZEM module sees the power and current flow no matter which way it flows, so we have to mount it directly on the wire from the inverter.

The cost of the whole project should not exceed 100zł even if you buy the components on allegro.

I encourage colleagues to discuss and comment on my idea, maybe thanks to colleagues from Smart Home IoT the project will get more functions and will be extended.

I have also made a project on 3 PZEM modules which monitors the energy consumption for the house was mounted directly on the power supply of the distribution blocks for the protection on the house. The inverter has been plugged in front of the blocks that supply the house thanks to this in tasmotoa I can see the energy consumption of the house and the current power flowing from the inverter.

Relay modules and ESP8266 on a prototype board in an electrical distribution box. .

The above project has not yet gained a casing is currently a prototype but I think that the casing and implementation will already be an individual matter of each, I wanted to throw in a general idea of making such a control for water heating counting on the ideas of other more experienced users in the software Tasmota and ESP8266.

About Author
Daro1003
Daro1003 wrote 2523 posts with rating 538 , helped 268 times. Live in city Szerzyny. Been with us since 2008 year.

Comments

__Maciek__ 03 Aug 2024 12:34

Not a bad idea, but ... - It would be useful to have some kind of hysteresis ... or a timer, so that the relay doesn't click like crazy at the limit (for this, a properly located current measurement). -... [Read more]

michal.zd 04 Aug 2024 09:25

. Do I understand this correctly? There is no information about the direction of energy flow, so you used it to measure the actual power generated by the pv inverter? If so, it is simpler to read this... [Read more]

Daro1003 04 Aug 2024 10:12

This is exactly why the installation of a measuring clamp is important. A project for people like me who only use off-the-shelf software. Tell me more about how to construct your project and I will... [Read more]

michal.zd 04 Aug 2024 12:03

The program can be compiled on any Linux. The test version was run by me on a normal Debian laptop. I can upload the binaries to git as well. There are two in total, a broker and a library. For the rpi... [Read more]

Daro1003 04 Aug 2024 12:11

Yes I have one connected to the app. I also have pin 1 and 3 out for communication and pin 5 and 6 used for communication with the meter it works with. https://obrazki.elektroda.pl/8401447500_1722766619_thumb.jpg... [Read more]

michal.zd 04 Aug 2024 12:16

Which rpi do you have? Version. The current version communicates with the logger via wifi. [Read more]

Daro1003 04 Aug 2024 12:18

All on 3B+ with SSD to somehow make domoticz work stably. I also have a broker on it for integration with Tasmota, AFE or others. [Read more]

michal.zd 04 Aug 2024 12:21

Ok, and do you have mosquitto there? The mqtt server is needed to send data to domoticz. Broker - is that what you mean by mqtt? I use nodered, it's more transparent for me compared to domoticz. I think... [Read more]

Daro1003 04 Aug 2024 13:00

. I do. . Unfortunately NodeRed I have nothing about it I don't know what and how. . Apparently so, and not much can be achieved in domoticz without it, but I have no knowledge of it at all, so... [Read more]

michal.zd 04 Aug 2024 14:06

it's great, there's basically nothing you can't do on it. domoticz it doesn't even compare with nodered along with dashboard. see example view with nodered, i took a screenshot a while ago. https://obrazki.elektroda.pl/9718079000_1722769589_thumb.jpg... [Read more]

Daro1003 04 Aug 2024 14:48

Thanks for the course, I need to start first with the installation of NodeRed. How better on the same RBPi as domoticz or on another ? [Read more]

michal.zd 04 Aug 2024 17:12

If you have an ssd, two side by side will do fine. Besides, you probably have GB of ram, Do you know a bit about Linux from the terminal side? There is a program called htop that shows you the current... [Read more]

Daro1003 04 Aug 2024 19:49

@michalzd I very much appreciate your work and commitment but you approach the subject in a very advanced way. Personally, I don't really know what to do and how with your information. I approach the subject... [Read more]

michal.zd 04 Aug 2024 20:33

. rather for someone who is already familiar with Linux and not afraid of compilation. That's why I asked earlier how you feel about the Linux terminal. But the following list of steps is not complicated... [Read more]

speedy9 05 Aug 2024 10:01

Tuya makes ready-made modules that additionally detect the direction of current flow. So if someone is using the Tuya system anyway, there is no simpler or cheaper way to realise the above functionality.... [Read more]

Daro1003 05 Aug 2024 10:14

. You can insert a link I will be happy to test. [Read more]

speedy9 05 Aug 2024 10:20

Even cheaper than I wrote before: https://www.aliexpress.com/item/1005005885768083.html I am thinking of buying a similar module, but a three-phase one: https://www.aliexpress.com/item/1005006456832377.html... [Read more]

Daro1003 05 Aug 2024 10:31

I have a 3 phase build on a PZEM 004-t on each phase the power is identical rather there is no point in measuring from the inverter the power on each phase unless you want to use it to measure the power... [Read more]

speedy9 05 Aug 2024 10:46

That's why you put the measurement on the output to the grid. The direction of the current flow tells you whether you have an overproduction and send it to the grid or a shortage and take it. You can make... [Read more]

%}