To Control an electric water heater to only use the surplus power from my 3KW PV array
To make the experience fit your profile, pick a username and tell us what interests you.
OK its an Eagle file - one day Ill learn to use KiCad
sch - 173.02 kB - 05/28/2016 at 01:10
OK its an Eagle file - one day Ill learn to use KiCad
brd - 55.06 kB - 05/28/2016 at 01:10
Adobe Portable Document Format - 44.35 kB - 05/28/2016 at 01:10
Adobe Portable Document Format - 21.53 kB - 05/28/2016 at 01:10
Burst mode control of optoisolated triac with ESP8266
ino - 3.62 kB - 05/28/2016 at 00:56
This controller has been in pretty well continuous operation for around 3 years and worked flawlessly in that time.
The pulse control system I have implemented is a bit lame and causes lights to flicker as the power to the heater is turned on and off.
I have started to work through a new version which will incorporate pwm control of the power to eliminate the pulses on the power line. It will also allow me to control the power with greater precision. Stay tuned
Cloudy day today so not hot water again so had to unplug the controller. So while it was out I bit the bullet and pulled it apart and added an LED and momentary Push Button switch.
D1 - PWM output to Triac Driver
D2 - Indicator LED
D3 - PB Switch
Due to my bad code with lots of delays in the main loop - eek I'm going to have a go at using the button to trigger and interrupt to override the controller and give me full power for 1 hour (that's about how long it takes to heat the tank from cold).
After the hour the system will revert back to normal operation.
Afetr long term use of the controler it has been working great but we do have days that the sun dont shine and so there is insufficient powe from the PV system to heat the water so a manual over ride is an essential eddition.
Currently I have to unplug the heater and plug it straight into the power point heat the water upa nd thn switch it back - PITA
I was goingto implement smart phone control but that means creating an app or soething else - hmm maybe i could use blynk or cayene to do the phone side - but adding a switch to the box seems like it might be more practical -
The Tank is mounted under the sink and and the controler sits on top of it so it is just a matter of opeing the door and pushing a button - easier than finding my phone launching the app and then pushing the button.
It only takes an hour to heat the water from cold so I will adda button that when pushed gives full power for 1 hour and then returns to auto opperation.
I thin ki will also add an LED to indicate when the unit is actualy activating as well. A bit of visual feed back helps. Curently the only way I have to tell if it is heating water is to look at my energy meter.
Just looking at my code - wow its bad :lol:
Ive already set D0 as an input but have nothing currently attached to it so I will use that a sthe swicth input
EEK - this is going to be rather nasty my main loop has lots of delays to give the Wifi connection time to do its thing which means if I just read the input each loop i could potentially have tp hold the switch in for 10 seconds :( not cool.
I dont want to rewrite the whol thing right at the moment. Maybe if the pin can trigger an interupt it might work.
Runnig the controler for a few weeks has shown it to be a great addition. With a few tweaks it will be realy usefull.
Currently the heater remains off untill the sun hits the pannles and produces more than the rest of the house is consuming which is typically around 300W.
The heater will run at the highest possible power and happily heat the water untill either we turn the jug or coffee machine on reducing the available power - the hotwater shuts down untill the jug has boiled and then turns back on again.
I still dont have a manual override implemented :( I was planning to set the esp8266 as a server and just connect via wifi and implement a soft switch to turn the unit on or off BUT. Ive come up with a few more connected deivces to implement - fish pond pump and fish feeder - the usual garage door - Can i control it via my pebble ??
A temperature monioring system for the solar hotwater the more i think about it the more I come up with. I have also been thinking of haveing heater controler connect to the internet and get the days forcast and automatically over ride the power control if the day is going to be cloudy.
With al the new ideas haveing everything indivdual will soon become a big mess so the next step im thinking will be to implement a MQTT server and have it control the devices. This than will give me just one point of control. rather than a splattering of different systems.
It has taken me a while to come around to the IOT as a viable concept but Im starting to see practicale uses for the concept.
I had been struggling with apparent hanging of the Nodemcu.
After watch its operation closely I noticed it was always hanging in the same point in the code - just after it requested to read the energy meter - there was a time out in the code which used the value of millis added 5000 to it and if the current value of millis was greater than the calculated value then drop out of the loop and try again.
Well millis is an unsigned long integer and I was trying to compare it to an int - oops
Changed my variable to a long integer and presto no more hanging has worked consistently for days now.
As I want to control the power been consumed by the heater to limit to the surplus power produced by the solar system and minimize RF noise im using the zero crossing switching of the Triac. So I will attempt to control the power by using burst mode control where the PWM period will be long enough to turn the heater element on for a few cycles and off for a few cycles. After a few attempts I settled on 10Hz as the pwm frequency. This covers 5 complete cycles. giving me 10 "power level" steps each step being 1/2 a cycle or 10ms.
As the PWM frequency is not syncronised and not exactly matched to the mains frequency there is a bit of drift in the actual numbe rof cycles that could be on in a given PWM period.
The esp8266 can signal the triac to turn on at any point in the cycle but the Zero crossing detector prevents the triac turning on untill mains voltage crosses zero. The minimum trigger needs to be greater than 10ms to guarantee that the triac will fire and hold for each half cycle it aslo then runs the risk of firing for more than 2 periods this "jitter" in this application I dont believe it to be a problem though testing with a light globe the extra cycle switched was visually evident - 10hz though can be easily seen as pulses and as such this is not suitable for light control. phase control running at the mains frequency would produce a smoother response but as a water heatre there is no need to introduce extra complexity in the circuit to reduce unwanted RF inteference for no significant gain in performance.
All assembled and working. Sort of :(
The esp8266 connects to my network and interegates the power meter and gets the right reading but....
It is somewhat unreliable the esp8266 appears to hang randomly sometimes it will run all night othertimes it will only do a few reads of the power meter. I had read that they are susceptible to poor power so I have added a 4.7uF Tant directly to the 3.3v pins on the ESP board but it doesnt seem to have made any difference.
Its up and running the extra bit of aluminium on the heatsink is keeping the temperature down. THe large sections near the screw driver are unnecessary - to far away from the Triac - Ill pull them next time I need to dissasemble it.
Ive been playing with the PWM output and trying to get the right balance of frequency and duty cycle to give good results.
Here in Aus our mains frequency is 50Hz. to minimize switching noise I have chosen a zero crossing Triac driver - ie only switches on and off at 0V. I have not implemented any zero crossing detection in the circuit to syncronise the PWM with the line frequency.
Well that looked like a good idea at the time.
I deisgned my circuit couldnt have been easier a pin on a node MCU connectes to the optoisolated triac driver - connectsto triac - connects to load.
A0 looks like a great pin for an output im going to be sending a PWM signal to the opto to control the power available to the heater. What A0 is the analog input not the analog output......
whats a prototype PCB with out a jumper here and there :)
Now thats sorted out and some basic code slapped together to get the nodemcu taling to the energy meter and truning my test jug on and off.
The heatsink isnt big enough on the triac - nothing an extra bit of aluminium wont fix. but it works.
The hot water heater I am aiming to control is a small 20liter unit mounted under the kitchen sink.
It is a plug in unit - it draws only 2.4kw (10A at 240V) and plugs into the same circuit as the dishwasher and a couple of other power points so switching the circuit from the fuse box is not possible.
This controler will connect in between the hotwater heater and the mains power socket and so needs to wirelessly connect to the energy meter.
The Node MCU board containing an ESP8266 withits built in wifi module appears to be the ticket for making the connection and with plenty of IO should happily handle driving the switch to turn the hotwater heater on and off.
It will need to connect to my network, access the energy meter, read the HTML data suplied by the meter, find the energy available data and drive the hotwater heater accordingly.
To simplify the prgraming of the NODEMCU I use the Arduino environment with the ESP8266 Board manager https://github.com/esp8266/Arduino/
the basic concept for this project is going to need someway to determine the amount of energy being produced by my 3kw solar system and also how much energy I am currently using.
The difference is going to be allocated to the hotwater heater.
The hotwater heater is a 20litre unit under the kitchen sink just for supplying hot water for washing dishes.
Solar generation data is currently provided by the fronius inverter and data uploaded to pvoutput.org every 15mins or so. Current data can be accessed directly from the inverter via Ethernet.
I decided to keep things simple made use of the excellent work by the open energy monitor guys https://openenergymonitor.org/emon/ and built a 4 channel current reading version on an Arduino Uno with an ethernet shield.
4 current inputs required - 1 for each Phase of consumption and 1 for solar generation.
The the sktech produces a basic WEB page which can be accessed via web bowser from within my home network.
The resulting page gives just the basic information to getthe job done.
Become a member to follow this project and never miss any updates