Restricting Window Motors Number of Turn

Hi everybody,

We wonder if we can restrict our window motors number of turn in our code. Regardless how long we push the button we want the window motor to stop at some point.

Is it possible to do it in our code?
Thanks in advance…

You’ll need some form of sensor for feedback to the controller. Options include: digital encoder, potentiometer, limit switch, magnetic sensor…

That sensor David mentioned will tell your code exactly where the motor shaft is, and thus how many times the motor has turned. It is not terribly difficult. Your choice of sensor depends on how many turns you need to count and what your budget is.

Note that trying to do it by “dead reckoning” - that is, by guessing the motor’s position according to time that it has been supplied power - will be disappointing.

If you could provide a bit more detail about your design and what you are trying to achieve, it might be possible to give you a more targeted answer concerning what type of sensor to use.

Here we have a drawing of the mechanism. Window motor will control the damper. We want damper to go down and up.

I changed the quote from a URL to an embedded image.

Limit switches are your best bet. There are some Honeywell ones in the kit to use. One that triggers when the damper touches the holder and one that triggers when the damper is fully open.

Is that for sure? Because mechanics in our team refuses to use limit switch.

Since you’re using a window motor, and it looks like you’ve got hard stops at each extreme, you may be able to get by without a sensor if the load on the damper is known and sufficiently consistent so you can time it properly.

Thank you David, Max, Don and Ether. We will try to do it without sensors because mechanics in our team are lazy.

Keeping track in code would be harder in my mind. And electrical has control over sensors on our team.

We tried to figure out how to restrict window motors and we created a while loop in the because using while loop in the is not recommended. Are we supposed to put the while loop in the timed vi or in which vi should we use the while loop??? Thanks in advance!!!

I’m not a LabVIEW guru and I don’t have LabVIEW installed here so I’m not equipped to give you LabVIEW-specific examples, but I think you want to put the equivalent of this into the periodic tasks vi:

while (1) {

if (!run_me) {sleep(20ms); continue;}

run_me= false;





“run_me” is a boolean global variable. Whenever your TeleOp code sets it to “true”, the code in red runs once.

The “doSomething” would be to turn your motor on. The “sleep(3000ms)” would be how long you want to leave the motor running. The “doSomethingElse” would be to turn the motor off.

The “sleep(20ms)” is there to limit how fast the code polls “run_me” while waiting for it to become true. Without the sleep, this loop would always want a slice of CPU time. That would waste resources. Make the 20ms as long as tolerable and only as short as necessary.

Perhaps a knowledgeable LabVIEW person could post a code snippet.