Introduction: WaterLevelAlarm - SRO2001
Before explaining to you the details of my realization I will tell you a little story;)
I live in the country and unfortunately I don't have a municipal sewage, so I have a on-site sanitation that works with a lift pump. Everything usually works well until the day I had a power outage for several days because of a storm...
Do you see where I'm going with this? No?
Well, without electricity the pump used to drain the water out of the pit no longer works!
And unfortunately for me I didn't think of it at that time... so the water level went up, up again and again until the well where the pump is almost full! This can damage the whole system (which is too expensive...)
So I had the idea of making an alarm to warn me when the water in the pump well reaches an abnormal level. So if there is a problem with the pump or if there is a power outage, the alarm will sound and I will be able to intervene immediately before any major damage.
Here we go for explanations!
Step 1: Tools and Electronics Components
Electronics components :
- 1 Microchip PIC 12F675
- 2 momentary switch buttons
- 1 LED
- 1 buzzer
- 1 DC-DC boost module (because my buzzer requires 12V to be loud)
- 4 resistors (180 ohm ; 2 x 10K ohm ; 100K ohm)
- 1 detector (floater)
- 1 battery holder
- 1 PCB board
- 1 plastic box/case
- A programmer to inject the code into a Microchip 12F675 (e.g. PICkit 2)
- 4.5V mini power supply
I advise you to use Microchip MPLAB IDE (freeware) if you want to modify the code but you will also need the CCS Compiler (shareware). You can also use another compiler but you will need many changes in the program.
But I will provide you the. HEX file so that you can inject it directly into the microcontroller.
Step 2: Obligations
- The system must be energy self-sufficient to operate in the event of a power failure.
- The system must have an autonomy of at least 1 year (I do sanitation maintenance once a year).
- The alarm must be able to be heard from an average distance. (about 50 meters)
- The system must fit in a relatively small box
Step 3: Schematic
Here is the schematic created with CADENCE Capture CIS Lite.
Explanation of the role of components:
- 12F675: microcontroller that manages inputs and outputs
- SW1: operating button
- SW2: reset button
- D1: status LED
- R1: pull-up resistor for MCLR
- R2: pull-down resistor for control button management
- R3: current limiting resistor for LED D1
- R4: current limiting resistor in the sensor
- PZ1: buzzer (alarm tone)
- J3 and J4: connectors with between them the DC-DC boost module
The DC-DC boost module is optional you can connect directly the buzzer to the microcontroller, but I use it in order to boost the sound level of my buzzer because his operating voltage is 12V while the voltage of microcontroller ouput is only 4.5V.
Step 4: Prototyping on Breadboard
Let's assemble the components on a breadboard according to the above schematic and program the microcontroller!
Nothing special to say apart from the fact that I added a multimeter in ammeter mode in series with the mounting to measure its current consumption.
The power consumption must be as low as possible because the system must operate 24/24h and must have an autonomy of at least 1 year.
On the multimeter we can see that the power consumption of the system is only 136uA when the microcontroller is programmed with the final version of the program.
By powering the system with 3 batteries of 1.5V 1200mAh it offers an autonomy of :
3 * 1200 / 0.136 = 26470 H of autonomy, about 3 years!
I can get such autonomy because I put the microcontroller in SLEEP mode in the program, so let's see the program!
Step 5: The Program
The program is written in C language with MPLAB IDE and the code is compiled with the CCS C Compiler.
The code is fully commented and quite simple to understand I let you download the sources if you want to know how it works or if you want to modify it.
In short, the microcontroller is in standby mode in order to save the maximum energy and it wakes up if there is a change of state on its pin 2:
When the liquid level sensor is activated, it acts as an open switch and therefore the voltage on the pin 2 changes from high to low). Thereafter the microcontroller then triggers the alarm to warn.
Note that it is possible to reset the microcontroller with the SW2 button.
See below a zip file of the MPLAB project :
Step 6: Soldering and Assembly
I weld the components onto the PCB according to the above diagram. It's not easy to place all the components to make a clean circuit but I'm pretty happy with the result!
Once I had finished the welds I put hot glue on the wires to make sure they didn't move.
I have also grouped the wires that go on the front side of the box together with a "heat shrink tubing" to make it cleaner and more solid.
I then drilled through the front panel of the case to install the two buttons and the LED. Then finally solder the wires to the front panel components after twisting them together. Then hot glue to keep it from moving.
Step 7: System Operation Diagram
Here is the diagram of how the system works, not the program. It's some sort of mini user manual. I have put the PDF file of the diagram as an attachment.
Step 8: Video
I made a short video to illustrate how the system works, with a comment at each step.
On the video I manipulate the sensor by hand to show how it works, but when the system is in its final place there will be a long cable (about 5 meters) that will go from the alarm to the sensor installed in the well where the water level must be monitored.
Step 9: Conclusion
Here I am at the end of this project, it's a very modest little project but I think it could be useful for a beginner in electronics as a base or complement to a project.
I don't know if my writing style will be correct because I'm partly using an automatic translator in order to go faster and since I'm not English speaking natively I think some sentences will probably be weird for people writing English perfectly.
If you have any questions or comments about this project, please let me know!