Controlling 2 stepper motors simultaneously

Hi there. I posted this on discord under coding and got some help there, but there are general questions.
I want to build a project which uses 2 stepper motors and two linear guides to raise or lower a post. The steppers will be between 4 and 10 feet apart. They must operate identically. The guides raise 100mm on each side and only need small motors (maybe 6kg weight).
I need limit switches for top and bottom, plus a user controlled stop button and up and down controls.
Lastly the device needs to sense when it makes contact and this cannot be set by limit switches - they only control top and bottom travel. At some point in between, the device will contact a board which can be of any thickness. It sounds so far, like the best way to do this is to watch the motors current use, which will rise when the motor encounters an obstacle.
I'm looking to do this on an Arduino uno, with either A4988 breakout boards or a motor shield. The question of how to sense when the motor encounters resistance needs to be solved. Any and all help much appreciated. I've built a couple of arduino projects, but this is more complicated and in the past I've been able to reuse a lot of code ...

You REALLY, REALLY need to show a drawing of your project. When I consider a post, I see something that has one end in the ground and the other vertical into the air.
Most projects that want to sense a contact with something will add a component that moves when contact is made and let that movement control a micro-switch. That is what they were designed for.

That is only true with a DC motor.
But you want to use a stepping motor. When the stepping motor is stationary it is drawing the maximum possible current. So as you do not have a DC motor that strategy will not work.

What happens with a stepping motor when asked to move too fast is that it doesn't move at all.

OK, though I'm not sure it helps much.

The green objects are the stepper motor and linear drivers, which will raise and lower the crossbar. A random exampleof a board is in blue. The motors will lower the crossbar until it touches the board - and here is where it needs to stop, when it encounters resistance. The limit switches will merely stop it at maximum height and when it reaches the table, if there is no blue board in place.
Even a well aimed, precise laser powered switch, over a distance of as much as 10 feet, won't accurately stop the motors. Especially with dust or whatever...

I am out of my depth, but this is on the forum...

Detecting "Physical" Resistance from Stepper Motor - Projects / General Guidance - Arduino Forum

So did you see the posts in that link that said it is impossible just like I said?

I can think of at least five ways to sense a position part way up. I used to work with passenger elevators, and we used several devices none of which use a laser.

If you look at the drawing I added, it may be clearer. The crossbeam rises and falls controlled by the stepper motor and the linear rails. One of the rails will have two limit switches (top position and bottom, which matches the height of the table).
Problem is, when the crossbeam hits the board in blue, it will not stop but will strain to continue. I need some way of making sure it stops on contact. But as the board can be of any size and placed anywhere on the table, a limit switch approach won't work. (I considered having a limit switch which could be slid along the crossbeam so it would sit above the board, but that is extra work for the user and would require a long wire etc etc).
According to what I've read, you can read the current off a stepper motor and when it encounters resistance there is a very small rise in current, which you can track to then stop motion. Well, maybe.

There was a lot of back and forth on the issue. User "system" stated that it does work and he coded it....
I could not see a definitive answer.

The problem is that the board (in blue) can be anywhere on the table, can be thick, thin whatever. What kind of sensor could you use that would detect its presence that would not have to be placed directly above the board so that it could contact it?

That is not true, you are miss understanding what you read.

To get two stepping motor to do the same thing simply wire the motors to the same signal. Just like they do with CNC machines on the X Axis.

That part seems clear to me.

The knotty issue is still the issue of detecting the board somehow when the crossbar touches it.

system said this:

Blockquote

system

Dec 2012post #4

You can measure the voltage on the winding of the stepper. Any winding of 4. It may only be a few mV different when there is a load, depending on the motor and controller. You only need a resistor to hook it to A0 on Uno. Have you seen my code under the Motor section of this forum? It does exactly what you want.

Blockquote

Your diagram does not tell me much. You need to provide a real drawing/diagram so that someone can help; I have other things to do, good luck.

Blockquote
Your diagram does not tell me much. You need to provide a real drawing/diagram so that someone can help; I have other things to do, good luck.
Blockquote

Sorry, there are no more drawings as I haven't built it yet or obtained the parts. What exactly do you need to know from more specific drawings? I think the layout is extremely self explanatory. The issue is simply that of how to tell when the motor encounters resistance. Or to find some other method of telling when the crossbeam touches the board.

But whatever, thanks.
:slight_smile:

With modern high-power stepper drivers, they adjust to constant current, regardless of supply voltage variations, and load variations. Monitoring the millivolts of the high-frequency PWM that they use to provide the constant current isn't useful.

You could dangle a physical sensor beam under the crossbar, like on the entrance of a parking garage, and instrument its ends with a pair of normally closed microswitches. When one end or the other of the dangley bar pushes a switch against the crossbar, it opens the circuit.

How far can you rack the system between the two steppers before it binds? Can you raise one side 30mm above the other and still have it work?

This is good:

If you want to drive the steppers independently, the Mobatools stepper examples have some good examples of controlling multiple motors with some reference sensors:

Or maybe you could put a GRBL controller on it and do it with GCODE.

Stretch a piano wire attached to a strain gauge between the columns, stop when strain gauge reading goes up.

Blockquote
That is only true with a DC motor.
But you want to use a stepping motor. When the stepping motor is stationary it is drawing the maximum possible current. So as you do not have a DC motor that strategy will not work.
Blockquote

Let me ask a different question then - you say this can be done with DC motors. Do you think I could control 2 DC motors on linear guides via arduino and have their behavior be identical enough that they would not get out of alignment and create 'racking'?

Thanks...

Now that's an interesting idea.
the problem is that the whole thing has to be mobile - able to be moved to different table setups - and the length could be anywhere from 2 ft to 10 ft depending on setup. So that might be difficult - but a great idea, thanks!

No, that's why I was using stepper motors which could be kept in sync with greater accuracy. I think it would cease to be useful if there was more than a 5mm difference from one side to the other.
thx!