Do-it-yourself water level alarm on pic. Making a float water level sensor with your own hands

To measure and indicate water level in industry and in the domestic sphere, water level indicators are used, providing continuous measurements and visual control of the true level in containers various forms and sizes.

Indicator Description Type/principle measurement range Installation location Controlled material
Bypass level indicator Floatless 0.05…2 meters Side Liquids
Water
Bypass level indicator Floatless 0.1…2 meters Side Liquids
Bypass level indicator Floatless 0.1…2 meters Side Liquids
Magnetic 0.15…5.8 meters Side Liquids
Magnetic level indicator with the possibility of implementation in automated control systems Magnetic 0.15...3 meters Side Liquids
Buikovy 0…2.5 meters Above Fuel
Water
Mechanical level indicator Buikovy 0.9…2.0 meters Above Fuel
Water
Indicator type pneumatic level gauge Pneumatic 0.7…4.0 meters Above Fuel
Water
Bypass indicator for critical applications Float 0.5...5.5 meters Side Liquids
Water
Electronic digital fuel and water level indicator Hydrostatic 0.9…4.0 meters Submersible Fuel
Water
Electronic digital fuel level indicator Hydrostatic 0.9…4.0 meters Submersible Fuel
Water

The choice of level indicator depends on many factors. Let's touch on the most important of them.

1. The required accuracy of the device directly depends on the implemented measurement principle:

  • mechanical - accuracy ±5%;
  • pneumatic - accuracy ±3%;
  • hydrostatic - accuracy ±1.5%.

Thus, specially designed Unitel level indicators for water and for water implement the pneumatic principle of level measurement, the digital indicator of the presence of water in the tank is hydrostatic.

In addition, mechanical liquid level indicators, float level meters, as well as a hydrostatic container fill level indicator can be used as water level indicators.

2. Depending on the purpose of the measurements, the device can be selected:

  • with level indication at the location where the container is installed (MT-Profil R, Unimes, Unimes E, Unitel, Unitop, DIT 10);
  • with the ability to transmit a signal to the upper level (TankControl 10, NivoFlip together with a sensor and/or switch).

3. The possibility of using a water level indicator depends on the location of the water container, installed:

  • directly onto the container (MT-Profil R, Unimes, NivoFlip);
  • with a remote display device if the container is located in a hard-to-reach place, for example, if we're talking about about the water level indicator in a well or in a tank installed underground, in a flood zone, or on the roof (Unitel, Unitop, DIT 10, TankControl 10);
  • with two indicating devices: one is installed directly on the container, the second is remote (Unimes E).

4. The choice of a specific model of water level indicator depends on the dimensions of the container(see measuring range in table above)

5. Water quality also matters.: Some indicator models are not suitable for use with drinking water.

When choosing a level indicator, you must also consider the temperature environment, water in the container, material of the container, as well as other conditions for using the device.

In order to choose correctly, buy a water level indicator,
meeting all operating conditions, satisfying all your requests,
contact the specialists of our company.

In your household There may be a need for various kinds of water level sensors or other liquids, which can be made your own without much difficulty with skillful hands. I searched the Internet and offer you several options for circuits for various needs related to liquid levels, their monitoring, control, regulation and other things.

The circuit options are as follows: LED indication of six liquid levels, automatic pump control and a couple of simple circuits for just sound indication when the container is filled with water.

To solve the need to automatically regulate the water level by pumping or, conversely, filling with a pump, as well as simply monitoring, be it visual by light indication, or using sound signals, diagrams have been selected for a not very advanced user, like others on this site. I tried to select options using both integrated circuits and transistors.

To turn the pump on and off, it is more convenient to use, in coordination with the control circuit, an actuator relay on an electromagnet. All found circuits use such switching. And this is logical, since electronic keys in the case of engines are less reliable. It is only important to select a relay that matches the parameters of the pump motor, so that later you do not have to look for a replacement if its contacts are damaged.

Six liquid level indicator with light indication

Despite the apparent abundance of wires and elements in the above diagram, in fact, it is ridiculously simple. Since there is only one logical chip of the active elements, the remaining elements are all passive, moreover, the circuit does not require any adjustment at all, since this is “logic” in pure form. And all the values ​​of the elements of each of the six channels for each logical element are the same, so you just need to connect the input and output of each and repeat this six times. It is further clear: contact 7 is common, and 1-6 are levels, each of them can be placed at the desired height directly in the container for light indication. The LEDs can be arranged in a row (or in another manner), which will indicate the level of liquid in the container being filled: from 1 to 2 pieces light up at the same time. If desired, you can, of course, use LEDs of different colors.

Of course, with today's abundance of LEDs, you can use any that suit you. Perhaps, to adjust the operating current for them, you will need to select resistor R13.

Automatic water pump control

The given circuit is also, in general, not so complicated, and its basis is the K561LE5 logic chip; it consists of four 2OR-NOT logic elements. Having assembled and used this scheme, you can either fill or empty the required reservoir with water. To transmit the execution of turning the pump on/off, only a transistor and a relay have been added.

Two rods are used as sensors - long and short. Long – for the minimum level, short – for the maximum water level. It is taken for granted that the tank in our case is metal. If yours is not made of metal, then in this case you need to add another rod, lowering it to the very bottom.

The principle of the circuit is as follows: when water comes into contact with both a long and a short sensor, the logical level at pins 9 and 1.2 of the DD1 microcircuit changes from high to low, which causes a change in the pump mode.

When the water level is below both sensors, in the DD1 microcircuit at pin 10 there is a logical zero. When the water level rises, even when the water comes into contact with a long sensor - at pin 10, there is also a logical zero. But when the water level of the short sensor is reached, a logical one will appear on the 10th pin, then transistor VT1 turns on the relay, and it controls the pump, which begins to pump water out of the tank.

The water level begins to decrease, the short rod does not come into contact with the water, but a logical one still remains at pin 10, so the pump continues to operate. But when the water level reaches below the long rod, a logical zero will appear at pin 10, and then the pump will stop working.

Switch S1 allows you to switch the entire logic of the circuit and, accordingly, the operation of the pump to the reverse.



This circuit also assumes two contacts: when they are immersed in water, the sound generator starts working, and the sound is emitted by speaker BA1. At the ratings indicated in the diagram, the frequency of the generated sound signal about 1kHz.

The K561LA7 integrated circuit consists of four “AND-NOT” logic elements. The sensitivity of the sensor circuit is very high, this is ensured by the use of unipolar (field-effect) transistors with insulated gate (CMOS) in the K561LA7 logic chip.

Transistor KT972 used in a composite circuit. But it can be replaced by connecting two transistors (KT3102 and KT815) as in the diagram on the left.

The circuit is powered with a voltage of 3-15 V. When the supply voltage is above 6 Volts, you can limit the current of the speaker and transistor by connecting a resistor in series with the dynamic head.

The water level indicator (sensor) on the PIC16F628A microcontroller is a device that allows you to visually monitor the water level in an opaque container. The proposed device can be useful to anyone who has Vacation home With summer shower or a summer house, a vegetable garden, or anything, as long as there is a container of water. After some upgrades, the indicator turned out to be the water level.

The indicator itself consists of two main parts:

  1. Water level sensors;
  2. Electronics that processes information received from sensors.

Now let's take a closer look at each of them components indicator.

About the scheme.

The indicator circuit was assembled from what was at hand and was generally developed for the PIC16F84 microcontroller, but later it was decided to add support for a cheaper and more accessible microcontroller - PIC16F628A.

Schematic diagram water level indicator (Figure 1) is as simple as five kopecks.

Figure 1 - Schematic diagram of the water level indicator on the PIC16F628A microcontroller

Let's look at the main components. The heart of the device is the PIC16F628A microcontroller from Microchip. For stable power supply which uses a rectifier based on a diode bridge, capacitors and an L7805 integrated stabilizer.

To reduce the voltage, it is strongly recommended to use a step-down transformer, which will provide the necessary galvanic isolation. It is better not to install quenching capacitors, as there is a risk of being exposed to a dangerous voltage potential.

The sensors are connected to the circuit through barrier resistors.

Four LEDs display the current amount of water in the tank. Depending on which sensor connects to the common wire, the LED of that sensor will light up. The entire list of parts is summarized in Table 1.

Table 1 - List of components for the water level indicator on the PIC16F628A microcontroller
Position designation Name Analogue/replacement
C1, C3 Ceramic capacitor – 15pFx50V
C2 Electrolytic capacitor - 470μFx25V
C4 Ceramic capacitor – 0.1 μFmkFx50V
C5 Electrolytic capacitor - 1000μFx10V
DA1 Integral stabilizer L7805 L78L05
DD1 Microcontroller PIC16F628A PIC16F648A, PIC16F84
HL1-HL4 LED 3mm
R1-R5, R11 Resistor 0.125W 5.1 Ohm SMD size 0805
R6-R9 Resistor 0.125W 510 kOhm SMD size 0805
R10 Resistor 0.125W 1 kOhm SMD size 0805
R12-R15 Resistor 0.125W 180 Ohm SMD size 0805
VD1 Diode bridge 1A x 1000V 2W10
XP1-XP4 The plug is paid
XT1-XT2 Terminal block for 2 contacts.
XT3 Terminal block for 3 contacts.
ZQ1 Quartz 4MHz type size HC49

About sensors.

Thin clamps made of galvanized sheet are used as sensors, which, in turn, are located on a plastic pipe at a certain distance from each other. The pipe is attached to a heavy base (Figure 2).

Figure 2 - Heavy base for plastic pipe with sensors.

The wires connecting the sensors and the circuit are connected to the clamps (you can use twisted pair). This entire structure is installed in a container of water. Water will short-circuit the sensors to each other. The distances between the sensors are arbitrary. In my case, the container was conditionally divided into three parts, and a clamp was installed on the pipe at the level of each part. If an overflow was provided for the container, then the last clamp should be installed at the overflow level.

The design of the sensors may be different. The main thing is to follow the required sequence.

How does it work.

This design works very simply. At the very bottom of the pipe (or on the base) a common wire is attached for working with sensors. All measurements will take place relative to this wire. Water, filling the container, will gradually begin to close the common wire with the sensors. The first in line is sensor 1. When the common wire with it is closed, then the first LED will turn on. Next, a second sensor will be added to the first sensor, the second LED will turn on, the first will turn off, etc. When a short circuit occurs with the fourth sensor, the fourth LED will turn on. Which, in turn, will flicker at a frequency of 2 Hz.

Such a work algorithm can be easily organized using ordinary logic. This was done at first, however, due to frequent erroneous conditions, it was decided to replace the circuit with a modern microcontroller device. Working programm for the PIC microcontroller was written in assembly language and debugged in the MPLab 8.8 program

Modeling.

The operation of the device was simulated in the Proteus program, see Figure 3. The model was made for the PIC16F84A microcontroller! We carefully select the firmware.

Figure 3 – Water level model on the microcontroller.

About the printed circuit board.

Printed circuit board turned out to be 55x50mm in size (pictures 4-5!!! not to scale).

Figure 4 – Printed circuit board of the water level indicator in the tank on the PIC16F628A microcontroller (bottom) not to scale.

Figure 5 – Printed circuit board of the water level indicator in the tank on the PIC16F628A microcontroller (top) not to scale.

The appearance of the indicator is shown in Figure 6.

Figure 6 – Finished water level indicator board.

Frame.

The circuit of the finished indicator was placed in the body of a small receiver (Figures 7-8).

Figure 6 – Finished water level indicator board on the PIC16F628A microcontroller in the receiver housing.

Figure 7 – Power button.

I sealed the holes for the speaker with glue, and glued a glossy photograph to the front side (Figures 8-9)

The indicator, assembled from known working parts, starts working immediately and does not require adjustment.

Figure 8 – Taped holes.

Figure 9 – Front panel of the water level indicator on the PIC16F628A microcontroller.

Video of the device in operation.

The result is a not bad indicator of the water level in the tank on the PIC16F628A microcontroller, which does not contain scarce parts, is easy to manufacture and does not require adjustment. Added support for PIC16F84, PIC16F648A microcontrollers. The printed circuit board turned out to be 55x50 mm. The container in which the sensors will be placed does not need to be damaged by unnecessary holes. Good working components and good luck to everyone!!! Thank you for your attention.

This device was designed for a septic tank country house, as an indicator to monitor the filling level of the sewer. The task was to create a reliable sensor that should work in moisture conditions and in different temperature conditions. At the beginning, I thought about applying the principle of a float in a cylinder, using a silicone container as a basis (as can be seen in the figure possible options version of the liquid level sensor). But life itself guides and suggests the right paths, you just need to be able to realize this! Based on the fact that my septic tank already had an outlet sewer pipes at 110mm and 50mm, the solution came by itself. Thus, it became possible to mount the device on a 50mm pipe, eliminating other mounting options. All materials must be made of plastic, aluminum, bronze, stainless steel, and so on - resistant to the environment to which you are going to apply them!

The operating principle of the liquid level sensor is based on a magnet and reed switches. By moving the magnet along two reed switches, the sensors are triggered and, accordingly, the LEDs glow a certain color, indicating the extent to which the reservoir is filled with liquid. I tried to simplify the design of the product as much as possible, and achieved the use of only two reed switches. Also, it was important to use as few parts as possible for reliable, long-term operation.

Liquid level sensor circuit

Operating principle of the liquid level sensor

Possible versions of the liquid level sensor

The diagrams show that in the lower position of the float, when the green LED HL1 is on, the 2nd reed switch is activated. That is, the liquid level is below the float, which is limited by a stopper and, accordingly, the magnet closes the contacts of the reed switch. As the liquid level rises (filling the reservoir), the magnet moves and the 2nd reed switch switches, which connects the yellow LED HL2 and turns off HL1. When the critical level is reached, the magnet will activate the 1st reed switch, the red HL3 LED will light up, and the yellow one will go out, notifying you that the tank is full. If there is any malfunction with the float or magnet, the yellow LED should light up (for example, the float overturns or the magnet mixes, the stopper breaks, etc.). By adding a relay to the circuit, it will be possible to use it as an actuator to connect more powerful loads. Also, you can connect a buzzer to the 2nd reed switch for sound notification or mobile phone and so on.

Power the device from any 3-12V source. For example, from a telephone charger with a 5-volt switching power supply or two 1.5V batteries, a more compact 3V one will also do. In this case, it will be necessary to reduce the resistance of resistor R1. Choose a smaller button or switch, although you can do without it by keeping the indicator on constantly. Wall-mounted installation in the house, for example in an electrical panel. Do the wiring in advance (I already had it ready). Thus, you can get by with very simple circuitry, without microcontrollers, etc. After all, the simpler the more reliable!

So, we will need the following materials:

Connecting coupling for sewer pipes PP d=50mm x2 pcs.
- sewer plug d=50mm x2 pcs.
- plastic clamp (bracelet) x1 pc.
- plastic U-shaped profiles (from furniture fittings).
- heat-shrinkable casing d=30-40mm, d=3-10mm.
- plastic or textolite plate =4-6mm.
- aluminum rivets x10 pcs.
- neodyne magnet (from hard drive computer) x1 pc.
- reed switches 3-pin x2 pcs.
- button or low-voltage switch x1 pc.
- resistor 680-1.5k. x1pcs.
- LEDs x3 pcs.
- low-voltage wires (for example for burglar alarm, 5-wire).
- a 4-pin plug (for example, from a dimmer for RGB LED).
- hot glue or silicone.
- 12V power supply or 3V battery (from the computer).

From the tool:

Drill
- construction hair dryer
- heat gun
- soldering iron
- also another handy tool that any master can find.

Manufacturing

First you need to find everything necessary materials and be patient. The work took me three days, including development and experiments. I advise you to test the device circuit first, and then assemble it. Be careful when working with reed switches; it is very easy to break the glass body when bending the legs. Using a plastic clamp, secure the reed switches with hot glue. Select the distance for them experimentally; it should ensure that the reed switches operate when the magnet passes. Seal the joint with heat shrink and hot glue or silicone. The finished bracelet is placed on the coupling and allows adjustment best position triggering. Also, it is easy to replace it if it malfunctions by disconnecting the plug. Find a moisture-resistant plug with four or more legs. If the plug is exposed to moisture, cover it with heat shrink or silicone. You can do without it by soldering the wires directly.

Based on the length of the float holder, the operation of the device depends. In my case, the length is approximately 40cm. The float profile needs to be heated construction hairdryer and lay it on the coupling (this is done quickly), then glue it and connect it with rivets. The resulting clamp should ensure easy rotation relative to the coupling with reed switches. The float itself, after installing the plugs, is simply attached to the profile with rivets. The fact that the float design has a certain flexibility will prevent it from breaking in the future. A neodyne magnet is also attached to the structure so that it is within the distance of the reed switches. After drilling holes in the coupling, install the float stopper; it is needed for the correct actuation position when the device is operating.

To regulate and control the liquid level or solid(sand or gravel) in production, in everyday life used special device. It is called a water level sensor (or other substance of interest). There are several varieties of such devices, which differ significantly from each other in their operating principle. How the sensor works, the advantages and disadvantages of its varieties, what subtleties you should pay attention to when choosing a device, and how to make a simplified model with a relay with your own hands, read in this article.

The water level sensor is used for the following purposes:

Possible methods for determining tank load

There are several methods for measuring liquid level:

  1. Contactless- often devices of this type are used to control the level of viscous, toxic, liquid or solid, granular substances. These are capacitive (discrete) devices, ultrasonic models;
  2. Contact- the device is located directly in the tank, on its wall, at a certain level. When the water reaches this indicator, the sensor is triggered. These are float, hydrostatic models.

Based on the principle of operation, the following types of sensors are distinguished:

  • Float type;
  • Hydrostatic;
  • Capacitive;
  • Radar;
  • Ultrasonic.

Briefly about each type of device


Float models are discrete and magnetostrictive. The first option is cheap, reliable, and the second is expensive, complex design, but guarantees an accurate level reading. However, a common disadvantage of float devices is the need for immersion in liquid.

Float sensor for determining the liquid level in the tank

  1. Hydrostatic devices - in them all attention is paid to the hydrostatic pressure of the liquid column in the tank. Sensing element The device senses pressure above itself and displays it according to a diagram to determine the height of the water column.

The main advantages of such units are compactness, continuity of operation and affordability. But they cannot be used in aggressive conditions, because they cannot do without contact with liquid.

Hydrostatic liquid level sensor

  1. Capacitive devices - plates are provided to control the water level in the tank. By changing the capacity indicators, you can judge the amount of liquid. Lack of moving structures and elements, simple circuit devices guarantee durability and reliable operation of the device. But one cannot fail to note the disadvantages - this is the necessity of immersion in liquid, and demanding temperature conditions.
  2. Radar devices - determine the degree of increase in water by comparing the frequency shift, the delay between the radiation and the achievement of the reflected signal. Thus, the sensor acts as both an emitter and a reflection collector.

Such models are considered the best, accurate, reliable devices. They have a number of advantages:


The only disadvantage of the model is its high cost.

Radar tank liquid level sensor

  1. Ultrasonic sensors - the principle of operation and the design of the device are similar to radar devices, only ultrasound is used. The generator creates ultrasonic radiation, which, upon reaching the surface of the liquid, is reflected and reaches the sensor receiver after some time. After some mathematical calculations, knowing the time delay and speed of the ultrasound, the distance to the water surface is determined.

The advantages of a radar sensor are also inherent in the ultrasonic version. The only thing is that the indicators are less accurate and the operation scheme is simpler.

Subtleties of choosing such devices

When purchasing a unit, pay attention to the functionality of the device and some of its indicators. Extremely important questions when purchasing a device are:


Options for sensors for determining the level of water or solids

DIY liquid level sensor

You can make a basic sensor to determine and control the water level in a well or tank with your own hands. To perform the simplified version you need:


A self-made device can be used to regulate water in a tank, well or pump.