Motion detection

To save energy I want to disable the stepper after the movement. But I also want to keep the position. Is there a way to detect, if somebody tries to move it? If yes, I could reenable the motor and block it.

Fundamentally only closed loop motors (that integrate sensors that tell their position) will be reliable this way.

With trinamic drivers, you can set a reduced holding current though, which does save energy. Depends on the machine, but .1A is common. It doesn’t notice being moved and move back though; that’s where closed loop is necessary. But it can at least hold position without full current.

These days, closed-loop servos have come way down in price, and they do exactly what you want, well.

1 Like

Thank you for your reply :slight_smile:

Since the steppers can also act as a power generator, I was curious if we could measure the output of the stepper and use this as a trigger. But I would have to limit the peak otherwise l’m going to fry the Wemos.

This is essentially how switchless homing works; the trinamic drivers can measure back-EMF when you hit a hard stop. But this requires a hard stop; you are exceeding a threshold for a simple measurement.

You could in theory treat a stepper as a quadrature encoder and thus know both direction and distance of a move, but the generated voltage is proportional to speed, and so the slower the stepper moves, the smaller the signal. Switchless moving is moving the motor at a known speed and knows what back-EMF voltage will be generated by a hard stop and can reasonably have a single trigger threshold. But a human moving something you won’t be able to tell reliably what the change in position is by just measuring voltage on those wires; initial velocity will at least often be slow enough that the resulting voltage will be small. I would expect noise to overwhelm the signal.

I’m not an EE and there are some on this forum, so if they say that I’m wrong, listen to them. But I think that if this were cheap and easy we’d probably all be doing it rather than putting encoders on motors. :smiley:

Here’s a closed-loop stepper motor — that is, an absolute encoder that attaches to a stepper motor and corrects for position — that’s not super expensive:

You can also buy just the board and all other components to add to an existing stepper motor:

If you use servos, you want a Return Energy Dump. The back-EMF from a servo hitting a hard stop can actually fry connected electronics.

1 Like

Great explanation from a non-EE! :+1:

Thank you for your detailed reply. :slight_smile: OK, I got it. I’ll go for a closed loop motor.

1 Like

Gotta ask why do you want to do this :thinking:

I’m building a catfeeder - dont ask why :wink: - and I dont want to let the cat move the lid.

Well I could also add a PIR sensor or use a geared stepper. But at the moment I’m looking for another solution.

1 Like

Classic answer here would, I think, be a servo, of the kind used in RC, where it uses only as much current as needed to drive to a setpoint. Move it by changing the setpoint.

Here’s a random page I found with some discussion of “RC servos” — there’s no particular reason that they actually have to be radio-controlled, but it’s a common hobbyist application.


Moving upper lid of a round unit:
I would make a two-piece lid that rides in a set of grooves cut around the perimeter, one on top of the other. The upper 1/2 is stationary and overlaps the lower. The upper overlaps the lower when the unit is closed.

To open: rotate 1/2 the lid (the lower) until it hits a switch sitting at 1/2 the circumference.
To close: rotate in the same direction until it again covers the hole and releases the switch(s).

DC Gear motor, Arduino, 1-2 switch(s), and Mosfet driver.

1/2 shape like above:
Set of lids configured in 1/2 a circle.
Do the same as above but to close reverse the lower section. May need a second switch.

  • DC Gear motor, Arduino, 2 switches, and HSwitch driver.

Alternate idea:
Make the top stationery with the feeding area cut away.
Rotate an internal bowl until it lines up with the feeding opening.
In this approach, you could make the bowl multi-segmented and feed for a week by moving the bowl each day to a new segment.
You could drive the bowl from the edge which has a gear rack. The position could be detected by microswitches that detect detents in the bowl’s bottom or edges surface.

Note: If the lid(s) ride in groves in the top I doubt the cat could get enough leverage to slide the lid circumferentially and open to the feeding area irrespective of the type of motor used. If you use a DC gear motor the friction in the gear stack would prevent moving it when no power is applied.

1 Like

BTW the servos that @mcdanlj recommended are also a good choice for motion control.
I have used them many times for positioning and they are easy to implement as there are many Arduino libraries and RC servo driving boards.
They are generally inexpensive at lower torques and get more expensive at the higher end.

The torque requirements will probably be the limiting factor using these.

1 Like

Looks like they are currently having some teething issues with this board.

They haven’t open-sourced the firmware, but if they did it would probably be possible to use this board as a servo controller with alternative firmware.

1 Like

@Jon_Charnas did some digging and it looks like MKS used some GPL firmware without releasing source. sigh

The site links to the source which has a note about this:

MKS has taken this firmware but has not provided source back and hardware designs back to the community.

Having been an RC pilot over a decade, no. The torque won’t be. The budget to achieve desired torque will. You can get very beefy servos. But they get pricey real fast, and need a whole lot of power (i.e. 2-cell lipo voltage, if not higher).

1 Like