How to get system to beep when importing

I have a very crude manual variable controller for my immersion heater.

I sometimes forget to go and switch it off, or down, when the sunlight reduces.

My emonPi and Arduino setup has a CT around the wire going to the meter box and so can tell me when I am beginning to import power from the grid. When this happens I would like something to beep or make a noise so I am prompted to go and turn the immersion heater off or down.

Is there some way of controlling the existing software to do this or is there a way of intercepting the values that are produced and get the Pi to beep?

There is nothing in the PI to make the beep. So either way, you’ve got to add an audible warning.
You can either hang it off a GPIO on the Pi, or use a DO pin the Arduino.

The latter is probably easier.

Wherever you do it, what you need to do is detect when the sign of the power has changed from negative (export) to positive (import) and trigger the warning. If you’re keen, you can reset it manually (with a push-button) or you could try for automatically, as presumably turning the immersion heater off will make it export again, but at a lower value. (But I foresee problems - you must inhibit the warning until it has seen substantial export again, or until you’ve turned the immersion heater on again. So you could be heading for a quite complex algorithm.)

But wouldn’t it be nicer to add Robin’s triac output to your Arduino and let it control automatically?

I have node-red send me e-mails when it turns the car charger (EVSE) on and off as a result of solar production.

If you get e-mail on your mobile then this may be a simpler solution?

Robin’s triac output would be the best, but it is (so far as I am aware) a
completely separate system from the arduino - radio - emonPi setup I have.
And to be ruthlessly economic, it would take about 100/(10/6 * 0.03 * 365)
= 5.5 years for it to pay for itself.

I was actually thinking of using a stepper motor contolled by the Pi to
move the knob on the dimmer to keep the import at zero, but I need to get
the import power out of the radio-emonPi setup and I don’t understand the
path from radio to webpage in order to intercept it.

Since you already have an Arduino, you need only the output stage. Robin sells the output section separately. His Shop webpage shows listings for the PC board a well as a kit of parts.

If you’re comfortable with building one, the hardware itself is neither complex nor expensive.

If you’re not keen on buying a ready made diverter and have an Arduino measuring the main incomer current via a CT that has a spare pin (and the skills) , all the additional hardware you need is a triac, a heatsink and an opto-coupler (plus a couple of minor passive components,terminals and a bit of stripboard) and a suitable box to put it in.

If you have anything bespoke in your Aduino sketch you may need to “merge” the sketches but there is already sketches to use the emonTx as a Mk2diverter out there and the hardware readily available and documented, it’s all open source.

Robin’s kits definitely look the better approach than “a bit of stripboard” but they weren’t available when I built mine, the most expensive bit back then was the heatsink.

And reasonably priced, too.

I especially like this unit.

from what little I know, node-red is included in the emonPi software. But how does it work and is it possible for it to intercept the numbers going from the radio module to the webpage?

Yes, using MQTT - see MQTT - Guide | OpenEnergyMonitor for the publishers. In a feed you can “Publish to MQTT” and then in node-red you can subscribe to that topic - it takes a little set-up the first time, but the components themselves should all be running. Connect the your emonpi instance on port 1880 (http://emonpi:1880) for node-red by default. Node-RED - Guide | OpenEnergyMonitor

Thanks, Peter. I am reading up on node-red. I can indeed get the node-red page at port 1880. There is a Pi tutorial about node-red

There is the potential to have the browser make the beep or one of the unused pins on the Pi change state and control an electronic beeper of some kind.

Update: my feed indicating net flow into the house (positive for in, negative for export) now causes the nice lady to say “energy alert” when this feed goes negative, indicating I need to turn something off or down to stay within the energy produced by the solar panels on the roof. Done with a prompt from Peter and me gaining basic competence with Node-Red.

However there is something puzzling me. Node Red allows you to have flows allocated to tabs on the browser interface. The emonPi software gives you a page called “emonPi” where there are some examples of mqtt feeds providing the data from, for instance, the “topic” emon/emontx1/power1 using localhost:1883 as its server. When I deploy this flow, the mqtt feed says “connected”. All this is fine. However when I try to reproduce this in another feed tab I can’t get the mqtt feed to connect. It always says “disconnected”.

What is special about the feed tab provided with the emonPi software and everything that I do in that feed tab that allows the mqtt feeds to be connected whereas doing the same thing in another feed tab seems always to result in it being disconnected? This happens even when I copy (export) the flow from the working feed tab and paste (import) it into a new feed tab.

1 Like

Did you manually re-enter the password? I am not sure if user-name and password get copied. They are the ones you would have already used in your own flow, but the MQTT node may refer to another instance of the same connection.

I have a different answer for the original question.

I monitor my PV using a cheap Windows tablet which displays the ‘My Solar’ app all day. I added about 30 lines of code in mysolarpv.js to play sounds at the appropriate times, after the calculation of the ‘balance’. Tablets have speakers so why not use them?

I don’t want to share my code because 1) as was already said, the flowchart to avoid too many / too few alerts is difficult, and mine is not perfect; 2) I used sound files which may not be correctly licensed.

An interesting debate. An electricity meter monitors the flow of energy, as does my Mk2 PV Router design. Neither is concerned with the rate at which energy is flowing (i.e. power), only the “energy state” of the premises. Think mileage covered rather than speed. Every electricity meter has a range within which energy can flow freely to and from the grid without charges or penalties being incurred. By modulating the load, a Mk2 Router will constrain the energy state to remain within the “sweet zone” that the meter allows.

For many meters, a chargeable event occurs whenever the LED goes from on to off. This occurs whenever there is a short pulse - as when a kettle is being boiled - and also whenever the meter comes out of its idle state. The idle state can occur either because surplus locally generated energy flowing into the grid is being ignored, or because the rate of consumption (import) is below the anti-creep threshold. A simple circuit which beeps whenever the LED goes from on to off would detect every chargeable event. But it might become rather irritating after the novelty has worn off.

A “Mk2” triac-based control system will automatically adjust the load to stay within the penalty-free range of the meter. To construct such a system is inexpensive, and plenty of assistance is available from this forum. This kind of diverter can be fitted alongside any other kind of monitoring equipment. It just needs a dedicated CT alongside the meter, and a resistive load that it can control.

1 Like

Sorry about the late response to your helpful message.

To be clear, I have a Node-Red browser tab, but within that (below that) are several tabs which represent Flows. I can create new ones from the menu which you get when you click on the thee line icon.

To answer Peter’s comment, there doesn’t seem to be a way to log on separately to these different tabs; aren’t they all controlled from logging on to the main Node-Red browser tab?

Here’s the puzzle repeated from the previous post
The emonPi software gives you a tab called “emonPi” where there are some examples of mqtt feeds providing the data from, for instance, the “topic” emon/emontx1/power1 using localhost:1883 as its server. When I deploy this flow, the mqtt feed says “connected”. All this is fine. However when I try to reproduce this in another feed tab I can’t get the mqtt feed to connect. It always says “disconnected”.

This is a reply to Robin Emley’s post.

The Mk2 PV Router is undoubtedly the best way to go. He has put a lot of thought into the design.

However the payback time is quite long. I have a smallish HW tank which is part of the gas boiler and is normally heated by gas for a few minutes early in the morning before I have my shower. My shower is the main drain on HW, it lasts, say 1/10 hour and uses 10kW for that time, so 1kWh provided by gas is about 3p.

HW is used by the washing machine and the dishwasher but less than the shower.

If I spend £60 on Robin’s hardware it will take me 6000/3 = 2000 days or 6 years for payback assuming I can harvest 1kWh from the sun every day.

My nominal 4kW panels struggle to keep up with the 200W quiescent power this house consumes in the winter so there is not much left over but when the sun does occasionally shine it does shoot up.

I think the key to this is to have a large tank. It would be good to build a house from scratch and bury a big tank underground that can be used for heating as well as HW. But there’s not much energy from the sun in the winter at 52 degrees North.

Oh, and Robin’s kit is the most economical on the market as well as probably the best.

Replying to my own post, I recall that the payback time for having the PV panels installed is around 7 years. So why do I think differently about a diverter?

If you already have an Arduino, then the parts-kit for the output section is all you need (in addition to the sketch) and the cost for that is only 10 quid. (plus 2 quid for P & P)

Thanks, yes you are right. Is the combined sketch published somewhere? I’d need to find the usb programming dongle that I bought years ago.

Payback time of 1 year is very acceptable.