During last weeks, some local building contractor was involved in reconstruction of our house and renewing the basement drainage. As a result the new basement drainage has been installed and a new hopper for the sewage pumps has been placed. To be honest, it is a lot of heavy work, performed by the builder including digging, insulating, pounding and other dirty staff – but after all the system works if sewage pump is removing the drainage water. In constrast to the earthworks, where you need much experience and human force, which I don’t have, I took over the plumbing and electrical work on the pumps. In order to have a fail-over system, I installed two pumps, where the second pump is triggered if the first one fails. In order to be able to operate on a short circuit of the first pump, I put the second pump on a separate phase (in Europe, we have three phases power supply, 220V each, shifted by 120° to each other, not like split-phase in US). Having this system installed, you get some periodic work to do: finally you want to make sure by regular testing procedures, that the second pump is operating if the first one has failed. Since I’m lazy and like inventing and constucting stuff more than executing regular test procedures, I decided to implement a monitoring system using some cheap electronic and computer components: Raspberry Pi, Tinkerforge Hardware.
The main idea of the system is to implement a sensor, measuring electical current consumption and control the pumps with relais. The test procedure should then include the following steps:
- measure the time between two main pump switchin-on
- disable the main pump for that time (ok a little more)
- make sure the second pump was operating
A good idea is to report all this to me by email. Another requirement is to write the pump switching intervals down and to plot it in nice diagrams.
Sensors and Actors
In order to implement this, I need electric current sensors and relais. TinkerForge Analog In Bricklet allows to measure electrical voltage. Using a coil, it is possible to induce some voltage from a conductor under alternative current.
Here is the result:
I got one coil from an old earth leakage circuit breaker and created the second on my own from a solenoid and some wire which I bought by a local element provider.
TinkerForge Dual Relais Bricklet is switchin up to 10A, of 230V, so I could use the component directly, since my pump are 500W strong and require around 2A.
TinkerForge Master Brick is a perfect interface for connecting the sensors and the actors, but the controlling software needs to run on some hardware. Since I had one, I decided to use a Raspberry PI board and connect it to the Master Brick via USB. For that purpose, I installed Raspbian, Java, JBoss AS 7 and finally Camunda BPM.
In order to connect all the components together it is useful to use a plate or a circuit board. Since I had no board but mounting kit from TinkerForge I used a piece of old plexiglass. Here is the board with mounting kit….
… and here is it with all components mounted: Raspberry Pi, TF Master Brick 2.0, TF Dual Relais, two TF Analog In and two inductive coils for detection of current.
The only part ready so far is an event detector component, which is implemented in order to log all pump and relais events to a database on Raspberry Pi. This piece of software is pretty trivial and is not worth describing for now – it simply uses TinkerForge API and persists the events using Hibernate. I also implemented a simple alternating state mashine which switches the main pump every second time. For now I’m implementing the automatic test procedure based on Camunda BPM, but this is a subject of a separate post.
Summary and Outlook
As expected, the hardware part was challenging and interesting and the software part is pretty trivial. The breakthrough for the task came with creating of the inductor and getting voltage (in fact it is about 100mV during the pump is working).
The implementation based on Camunda BPM is just a small experiment showing how powerful embedded systems are and how lean and lightweight a BPM Engine can be. The interesting part will follw after it in placing a status system outside of the house (to make sure to work on local electricity loss) and check the health of the system either by polling or by being pushed from the pump control device. It is also resonable to put some additional sensors on it – like a water level sensor to measure the amount of water in the hopper…