Go Down

Topic: Controlling Stepper position using limit switch (Read 76 times) previous topic - next topic

zaxelson33

Nov 13, 2014, 05:02 am Last Edit: Nov 13, 2014, 05:05 am by zaxelson33
Hey guys!

Ok so I am a bit lost here. My project that I am working on for school requires me to control the position of a 100 gram capsule up and down over a distance of 20 feet. I need the motor to stop the capsule at the bottom and at the top as well. The system needs to have dead man switches for both up and down movement so the user has to actively be holding the button for the capsule to move.

Here's where I'm at. I am thinking of using a stepper motor and just count the number of steps up and down. I want to use a mechanical limit switch http://www.amazon.com/Micro-Limit-Switch-Straight-Action/dp/B0050HKB8O that is hung upside down so that when going up, a stopper hits the hinge on the limit switch and stops the motor, and you can no longer press the up button. Now when I go down I want the release of that limit switch to be the start point for the count for the steps of the motor.

Here is an issue I want to address with this system. Say the capsule is not all the way at the top where the stopper has the limit switch depressed. When I engage the down button, I want the system to go up first until the switch is depressed, then reverse direction, restart the motor step count and step down the 20 feet. That way I will know the position of that capsule at all times Ill attach a simple sketch of this system. I know what I want to do in theory, but have little knowledge of how to assembly to circuit, what components to use and how to code this! I would greatly appreciate any help guys! thanks

P.S I am open to using servos with encoders or DC motors with encoders if its cheap, but I need to repeat this 6 times so I figured small steppers would be the best and cheapest way to go.

Robin2

If you are using a stepper motor I suggest you arrange for the limit switch to be triggered at startup to establish the zero position. Then it should not be necessary to do it during normal operation.

Perhaps, at startup, nothing will happen until a button is pressed and then it will seek the limit switch and zero the stepper's location.

If you have a limit switch at top and bottom you would not need a stepper motor - any cheap DC motor should do.

...R

zaxelson33

Hey thanks for the reply.

That's the problem, the capsule is going 20 feet underwater (its going in a reactor) so I cant have a switch at the bottom. I was thinking along the same lines as you are. Upon start up, I want that limit switch to be my zero mark, so when it's depressed it resets the encoder.

Do you have any idea how I would code that switch to cut power to the "up" button when it  gets depressed, and also be the reset for my encoder going back down? Also I need to duplicate this 6 times, does an Arduino Mega have enough pins to accomplish that?

wildbill

Assuming you use a stepper motor driver for each motor you'll need one pin for step and one for direction. Another for the limit switch and then a pin apiece for each up & down switch. If you need independent control of each stepper, that's five pins per motor giving thirty altogether. So, the Mega has enough.

You needn't 'cut power' to the up switches - just arrange that they're ignored by the code when the limit switch is engaged.

daniellyall

you should be able to do it with one limit switch have it so it homes in a positive direct (up) first zeros out

then it just needs to go -20 feet stop (for how long you wont it to stop) go +20 feet stop at +20 feet or second limit switch or home switch at top of travel.

it would be cheaper with a stepper motor and a good driver plus a arduino you need to now what the weight of the object to be moved is plus the drag of the what ever its going into.
that will tall you what size motor you need and power supply and driver required


Go Up