Log in

View Full Version : Restricting Window Motors Number of Turn


cilginbilgin
04-02-2012, 17:30
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...

David Brinza
04-02-2012, 18:04
You'll need some form of sensor for feedback to the controller. Options include: digital encoder, potentiometer, limit switch, magnetic sensor...

DonRotolo
04-02-2012, 18:17
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.

Ether
04-02-2012, 18:36
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...

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.

cilginbilgin
05-02-2012, 05:02
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.

http://imageshack.us/photo/my-images/812/ballholder.png/

cgmv123
05-02-2012, 07:59
Here we have a drawing of the mechanism. Window motor will control the damper. We want damper to go down and up.

http://img812.imageshack.us/img812/6167/ballholder.png

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.

cilginbilgin
05-02-2012, 14:00
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.

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

Ether
05-02-2012, 14:17
Here we have a drawing of the mechanism. Window motor will control the damper. We want damper to go down and up.

http://imageshack.us/photo/my-images/812/ballholder.png/

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.

cilginbilgin
05-02-2012, 14:58
Thank you David, Max, Don and Ether. We will try to do it without sensors because mechanics in our team are lazy.

cgmv123
05-02-2012, 16:49
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.

cilginbilgin
12-02-2012, 10:29
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.



We tried to figure out how to restrict window motors and we created a while loop in the timed.vi because using while loop in the teleop.vi 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!!!

Ether
12-02-2012, 15:02
We tried to figure out how to restrict window motors and we created a while loop in the timed.vi because using while loop in the teleop.vi 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;

doSomething;

sleep(3000ms);

doSomethingElse;

}

"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.