Hello, this is an urgent and real world problem which I'd like to try to alleviate with Node-RED!
note: I realised after posting this, that I'm very lucky compared to some people in mainland europe right now who have been far more badly affected by flooding than we are. I know at least one person here on the forum is from Hungary which has been very badly affected. I hope everyone is ok. We are safe in the UK, although I will need to see a doctor this morning for reasons that might become apparent
The urgency
At 2.56am tonight I had a call from my neighbour... "our basement is flooding again". Hasn't happened for a few years. By 3.05am I found myself physically holding a pump hose onto a high pressure pump, only to have it pop off and geyser up about 4 metres, hitting my face before I was able to move out the way. Unfortunately we aren't talking rainwater here. The sewage system back flows into our properties. No, we don't live in some rural area, we live in a very busy and urban part of London (Chiswick) on a main road with bus stops, restaurants, and residential homes. It hits loads of us here, and I've seen first-hand the damage caused to some of our local restaurants. Yes, the UK is totally screwed! I'll spare you too many grim details, suffice to say it was an extremely powerful pump and foul water went straight into my face / up the nose etc. and it wasn't possible to shower straight away afterwards as sewage blocked...
There's a lot of info I could tell you here, a lot of background / history, but I'm going to cut to the data, as that's going to help me right now.
Here's a trace of the sump water level in our rear basement:
This shows the rear pump working normally. Water fills the sump, the float activates, and the pump dumps the water out. I mean - a cycle of 30 minutes - that's a lot of water in this case, as we had major floods here - but all is working okay.
Now let me overlay the situation with the front pump on top of that:
The blue trace is the front sump water level. This pump is connected to the sewage pipe much closer to where it exits the building, and near to the non-return valve on the main sewage line.
When there's some kind of blockage in the street, and sewage flows back towards the house, the sump pump attempts to pump water out towards the street and fails, so it fills up again immediately.
Let's consider this an "error state". During normal rainfall, that blue line looks far more "normal", i.e. it matches the frequency of the green trace. (The level creeps up slowly then eventually ejects quickly.)
Anyway, let's abstract all these mechanics out of the discussion - I had a phone call from my neighbour at 2.56am but this was too late. It would have been far less stressful if I had known 30 minutes earlier. We can do that, right?
Now you have a feel for the problem - please can someone help me code this thing up? I have done signal analysis stuff before but I could do with a few pointers to get me started.
Here's the data I get over MQTT from my Arduino Sump Pump system. This is an example message in Node-RED, I get these every 6 seconds.
{"Fmm":429,"Rmm":395,"Pmm":430,"Fpc":46,"Rpc":48,"Ppc":36,"Fal":69,"Ral":55,"Pal":83,"Farm":true,"Rarm":true,"Parm":true,"Fa":false,"Ra":false,"Pa":false,"Fh":0,"Rh":99.9,"Ph":99.9,"Ft":0,"Rt":16.2,"Pt":17.7}
That blue line on the graph corresponds to Fpc
(front percent) and the green line corresponds to Rpc
(rear percent).
Any practical help would be greatly appreciated at this stage!