Guidance on providing switching priorities sought.

Dear all,

I recently implemented stage one of my first Arduino project, using a Nano to energise a relay which interrupts the demand signal (thermostat) to an electric central heating boiler when 'other' loads exceed a set value. It measures these 'other' loads via a current transformer into the Nano's analogue input, and the control is via a digital output.
The reason for having to do this is because the electrical input to the flat will trip beyond 10kW, and that's the maximum allowed by local regulation (it's in Abroadland).
That was stage 1.

Now, having learned that the heater utilises 2 off 3kW elements I have developed a list of further enhancements to the system, which essentially consist of modulating the heaters so that there is maximum heating effort consistent with not exceeding 10kW.

I will write the code to do that, and use burst-fire control (from a single digital output) to drive a thyristor via a zero-volt crossing IC, plus another dig-out to drive a relay which will drive the heating element without modulation; thus a combination of 3kW heater 1 ON-OFF and 3kW heater 2 modulated 0-3kW will enable full 0 - 6kW control.

Additionally one ormore thermistors will measure the room temperature and hot water tank temperature, and several dig-outs will drive relays to control the 240v outputs to sockets feeding the 1.6kW hot water cylinder, kettle, toaster, microwave, etc.. The objective is to turn off one or more of these appliances as determined by a strategy that considers the user's needs at the time of day/day of week to give the minimum inconvenience and prevents the main trip from operating (located three floors down from the flat).

The help I could do with revolves around how I can construct the code which orders the priorities based on this strategy. I can see that allocating a 'priority number value' to each appliance, and switching each OFF in this order as current demand rises towards the 10kW limit may work, plus how a time/date based re-allocation of priority numbers could work, so:-

  1. Is the priority based strategy (it being simple and easy to follow by the user) the best way to implementthe system?

  2. Assuming at some stage the user may want an internet based readout of the variables (room temp, heating output, hot water temperature, etc.) is the above approach readily upgraded.

  3. Apart from the current transformer processing and burst-fire output there will be very little time critical processing load for the Nano, but even so would it be advisable to upgrade to a more powerful Arduino at an early stage?

Regards, GM

Sounds like the hard way. Look at Arduino Power meters here.

There are already a host of smart switches that you can control with Arduino without designing your own zero-crossing detection. If your power meter detects that you are getting close to the 10kW limit, then you can turn off appliances or heat depending on the time of day.

Check the Home Assistant community- I am sure you will find others who have the same issue.

That seems like a lot of effort required to meet an arbitrary limit. If everyone in the country has the same limit then I'm surprised there aren't commercial solutions available.

My first thought is can you use gas for heating? It seems like you are spending a lot of your precious 10kW on that one item. Gas heating is usually cheaper than electric. (Where I live, wood-pellet stoves are cheapest.)

  1. Yes. You apply whatever priorities you want. You're the one programming the Arduino.

  2. Great idea. Then you should consider adding a WiFi shield to the stack in the future or start with an Arduino or ESP32-based board which has WiFi or ethernet on board.

Personally, I'd add a Bluetooth module and use that to get the data onto my phone. It depends if you want to write an app (bluetooth) or an HTML web page (WiFi.)

  1. You probably won't exceed the capabilities of a Nano. But if you want to add a UNO-sized WiFi shield, then start with an UNO or Leonardo.

Depending on how well you can control your various devices, I would be inclined to try and anticipate demand. So if perhaps, I see a need on weekdays at 7:00 to have the apartment nice and toasty, water ready for a shower and toast and tea afterwards, I'd like to heat at full strength at 6:00am until I get to the top of the 7:00 permissible temp range. Then at 6:30, make sure the water's as hot as is allowed.

This way, when the kitchen appliances are in use, the heavy lifting is done and can you alternate keeping the apartment at temp with the water heater.

I'm not sure mere priority is sufficient - you need to be smarter about what you run when. As another example, if the water heater's insulation is good, it may make sense to bring the water up to temp before you bring up the apartment temps.

You may also want to look at the forecast to see if the heating will be working harder and start it earlier.

Some good pointers' and thanks for those.

To MorganS, the specifics of going to all electric is that the user could foresee that the gas infrastructure was being run down (in Andorra), and the standing charge (the charge just for the supply facility) for gas was rising, currently around 70 Euro per month. Add this to the fact that the flat would be occupied for only the winter ski season (December to March) meant the savings on gas standing charge would outweigh the extra cost of electricity.
The flat being small and 3 storeys up from ground level negated any choice of wood powered heat, apart from a decorative stove in the lounge.

So it appears that my 'dynamic priorities' approach won't need to be completely re-written as the system develops, and that's a pleasing thought.

The power measurement software has already been written and works well, plus I have to add that this project is an unpaid job (apart from a few beers), driven mainly by my yearning to build something useful from the code I have learned, and to develop my coding skills, and whilst I can see a use for strapping together others' code I prefer to do the most that I can do.

Thanks again for your help.
GM