Water level indicator in LabView : tutorial 28

In this tutorial I will help you to design a mini project in LabView that will give you an indication of the water level in a water tank. If the level of water goes beyond a certain minimum or maximum limit, specified by you, then an LED will be turned ON. Two LEDs will be installed one of which will turn ON if the water level is less than minimum limit and the other will turn ON if the water level is greater than the maximum limit specified by you. At the end of the tutorial you are provided with an exercise to do it by yourself, and in the next tutorials I will assume that you have done those exercises and I will not explain the concept regarding them

Water level indicator in LabView example VI

  • I will now design a VI on LabView that will give indication whenever the water level in a tank decreases from a specified lower limit or whenever the level of water increases from the higher limit specified b y the user.
  • To do so, first of all create a VI as we have discussed in tutorial 1 and save it for future use by pressing <Ctrl+S>. From the control palette on the front panel select Numeric and then select Tank as shown in the figure below,Water level indicator in LabView : tutorial 28

Figure 1: Tank placement

  • Place the tank on the front panel and adjust its size according to your need. Now from the control palette on the front panel select Numeric and then select Vertical pointer slide as shown in the figure below,Water level indicator in LabView : tutorial 28

Figure 2: Pointer slide placement

  • Place three similar vertical slide bars on the front panel. These vertical pointers slides are of type control, and one of them is used to control the minimum limit or lower limit of water level in the tank, one is used to control the maximum limit or upper level of water level in the tank and the third is used to control the water level in the tank. The resulting 3 slides and a tank are shown in the figure below, Water level indicator in LabView : tutorial 28

Figure 3: Tank and controls

  • Now for the indication of maximum and minimum levels, we need two indicators i.e. LEDs for visual indication. From the control palette on the front panel select Boolean and then select Round LED as shown in the figure below,Water level indicator in LabView : tutorial 28

Figure 4: LED placement

  • Place two such LEDs below the vertical pointer one for the indication of lower limit of water level in the tank and the other for the indication of upper limit of water level in the tank as shown in the figure below,Water level indicator in LabView : tutorial 28

Figure 5: Front panel

  • Now lets’ move toward the block diagram part, first do the straight forward tasks that is to connect the tank control to the tank indicator directly as shown in the figure below,tank control and indicator

Figure 6: Tank control and indicator

  • Now we have to design a VI that will compare the current value of water level with the specified upper and lower limit. From the function palette on the block diagram window select comparison and then select greater or equal? As shown in the figure below,tank control and indicator

Figure 7: Greater or equal ? block placement

  • If you have any ambiguity regarding the working of this block, refer to LabView help center and see its working in detail. At the input side of this block connect the tank level control on upper input and at the lower input connect the maximum limit control, and at the output connect the maximum level indicator i.e. the round LED as shown in the figure below,tank control and indicator

Figure 8: Maximum condition block

  • Do the same for minimum condition indication too. From the function palette on the block diagram window select comparison and then select less or equal? As shown in the figure below,tank control and indicator

Figure 9: Less than or equal to block placement

  • At the input side of this block connect the tank level control on lower input and at the lower input connect the minimum limit control, and at the output connect the minimum level indicator i.e. the round LED as shown in the figure below,tank control and indicator

Figure 10: Minimum condition block

  • The complete block diagram for water level detection is shown in the figure below,water level indicator in labview

Figure 11: Block diagram

  • This block diagram will only run once, if you want it to run continuously use a while loop and place the whole block diagram inside the while loop. From the function palette select structures and then select while loop, this while loop will be then dragged at the outer boundary of the block diagram, refer to the figure below,water level indicator in labview

Figure 12: While loop placement

  • After placing the while loop the block diagram will look like the one shown in the figure below,water level indicator in labview

Figure 13: While loop placed

  • Now, to add the termination condition for the while loop click right on the red button and from the dropdown menu select create control as shown in the figure below,water level indicator in labview

Figure 14: While loop termination control

  • This will create a stop button by pressing which during the run time the loop will terminate. Now set the lower and upper limits of the tank as shown in the figure below,water level indicator in labview

Figure 15: Minimum and maximum values

  • Remember that the lower limit should always be less than the upper limit. Now run the VI and change the level of the water tank from the tank level control. If the level of the tank is below the lower limit the minimum LED will turn ON as shown in the figure below,Water level indicator in LabView : tutorial 28

Figure 16: Less than minimum value

  • If the water level is in between maximum and minimum value then both the LEDs will be OFF as shown in the figure below,water level indicator in labview

Figure 17: Within range

  • And if the water level is higher than the upper limit the maximum LED will turn ON as shown in the figure below,water level indicator in labview

Figure 18: Greater than maximum value

Exercise:

  • Update the VI we have just designed to display the water level in a numeric indicator, and both the minimum and maximum limits of the water level also displayed in numeric indicator.

<< Previous tutorial                                Next tutorial>>

Leave a Comment