Showing results for 
Search instead for 
Did you mean: 

How to program limit switches as on/off switches using LabView

I am attempting to write a program in LabView (using an NI USB-6008 controller) which will turn a pump on or off based on the water level in a container.  I am using a floatation device along with limit switches (something like an electronic version of a toilet float switch) which I would like to use to signal the pump to turn on or off.  When the bottom limit switch is triggered, I want the pump to turn on and remain on until the top limit switch is triggered.  When the top switch is triggered, I want the pump to turn off until the bottom switch is triggered.  I can't just use a case structure because the pump would only stay on when the switch was actually being depressed.  After searching around, I've seen some indication that you could potentially use a toggle command, a trigger command, or an event structure to do this, but I'm not sure which (if any) would actually work best or the particulars about how to configure those commands to do what I want.  I am still learning LabView, so simplicity in answering would be appreciated.  Thank you.

0 Kudos
Message 1 of 3

Use a state machine architecture.

Read both digital lines for the "limit" switches. Depending on the reading, switch on or off the pump (in case a limit was triggered), otherwise, keep the status of the pump.

As water level shouldnt rise/sink very fast (i hope), a polling time of about 200-500ms sounds reasonable.



CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 3

hello sir, can you attach the coding of the limit switch and pumps. cause I have a problem to set two limit switch to control pump and solenoid valve. thanks you.

0 Kudos
Message 3 of 3