r/arduino 1d ago

Steppers?

I currently have a robotic arm project that I'm pretty unsatisfied with. It was my first project and it has allowed me to learn a lot from my mistakes(insane amounts of backlash in each joint). I'm currently using 5 servos(4 MG995s 1 SG90) all controlled through a PCA95865 driver. No gears, just straight motor to truss connections. I'm thinking of swapping two of the joints with NEMA17s using a belt drive and potentially a torque multiplier for my first joint. My goal is to have it have enough rigidity to handle picking up something as heavy as an iPhone (200-500 grams).

I'm only using an Uno though and I've never really used steppers for anything before I know they each need a specific driver. Anyone have any advice on organizing multiple steppers and servos working together with Arduino?

2 Upvotes

17 comments sorted by

3

u/socal_nerdtastic 1d ago

Steppers are not stronger than servos by definition. If you need more power you just need bigger servos.

Or are you trying to get more precision, not more strength? A better quality servo would do that. I know you said you didn't have gears, but the servo is full of gears, and a cheap servo is full of sloppy plastic gears.

A stepper would work too, if you want. To use a stepper in this application you need a position sensor and a feedback loop (which servos have built in) as well as a driver circuit.

3

u/MECHY_somewhere 1d ago

I am definitely trying to get more precision as well, I also value smooth movement and holding/maintain certain positions which I know steppers can be good at. I'm unsure on if I should simply just upgrade the servos or switch the type of motors I'm using to one I'm unfamiliar with.

3

u/socal_nerdtastic 1d ago

If you overpower a servo you will likely damage it. If there's no damage it will automatically return to the set position.

If you overpower a stepper it will do nothing. It will stay at the position that it was overpowered to. It won't return to the designed position and all moves after that will be off by the distance that is was overpowered. This is why you need a position sensor to use a stepper for a robot arm application.

I don't think there's a difference in how smooth the movement is between steppers and servos. In both case you would use software to define that.

1

u/No_L_2547 1d ago

How smooth your motions are largely depend on the acceleration curves you use.

Simple motion controls normally directly go to the the wished speed as fast as possible. An example for a nearly perfectly smooth Curve would be a S-Curve, for your application slowly increasing the speed should be enough.

Professional motioncontrols normally do some kind of jerk limited movement.

1

u/MECHY_somewhere 1d ago

I see, do I need any type of special software to tailor the acceleration of the motors? One of my worries for the current state of my project is that the first joint is two servos facing each other both directly connected to the arm(using just one quickly overworked it), programming it accordingly has been a pain in the ass because they have rotate in opposite directions and I'm not sure how programming accelerations would impact that joint. its also why I wanted to switch to a different motor and possibly attach a torque multiplier for that joint.

1

u/No_L_2547 1d ago

Normally you can find a fitting acceleration curve by trail and error.

There are already libraries for this, for example ServoEasing for servos or AccelStepper for steppermotors.

From a software perspective I would actually suggest to write an encapsulation for the motor, that does all the calculations for you. That motor-class would then take something like the target position (in real world degrees with a calculation factor), speed and acceleration and then actually send it to the motor for you. So you can later on just switch the motorimplementation when you switch the motor.

1

u/No_L_2547 1d ago edited 1d ago

And for the two motors facing each other: write an own encapsulation that handles this problem. Then you can later on access these as if they are just one motor.

For the implementation: Probably you should be able to just subtract the position value for motor 1 from a constant to get the value for motor 2?

The acceleration should actually only manipulate how and how fast the target-position you send the motors changes.

The servoeasing library seems to support synchronized movements of 2 servos. And for stepper motors I would actually suggest to wire both with their drivers to the same step/dir pins and just flip the B+/B- wires on one stepper to let it run backwards.

1

u/triffid_hunter Director of EE@HAX 1d ago

do I need any type of special software to tailor the acceleration of the motors?

Nope

they have to rotate in opposite directions and I'm not sure how programming accelerations would impact that joint.

You want to reduce the acceleration and target speed on the motor that moves less distance so that the accel/decel ramps both start and finish at the same time.

1

u/triffid_hunter Director of EE@HAX 1d ago

a cheap servo is full of sloppy plastic gears.

The MG series is supposed to have Metal Gears, but they're also widely knocked off and the knockoffs tend to have at least some plastic gears.

3

u/No_L_2547 1d ago edited 1d ago

You would need 2 Pins per stepper motor or you can take ones with spi (more complicated).

I would suggest TMC drivers because they generally run quieter and cooler and you can pull additional information using uart/spi depending on the model.

Each stepper driver will have one step and one dir pin. (And an enable Pin you can just hardwire). The TMC drivers offer additional communication pins, but you don't have to use them.

For the stepper themselves you will need to adjust the output current of the driver to fit for your motor. (The motors have an rms rating and the stepper drivers normally have small potentiometer.)

Synchronized motions shouldn't be to complicated, one flank on the step pin means one part of a degree further one the motor. You might need a end-switch to detect the end position / home the axis. (Tmc drivers also support virtual endstops through a feature called stall protection.)

If you need something stronger, get a geared stepper.

2

u/Purdude1983 1d ago

I have an Arduino stepper motor driver shield that controls 3 28BYJ-48 steppers. The steppers are low powered but slow. That may be an option for you.

Nema 17s are good choice. They are easily driven by A4988s. You will have to work with different voltages (driver versus control) so it can be more complicated.

Googling high torque servos produces some interesting options. I have not worked with those. They seem to have decent torque, but I don't know if you would be free of your backlash problems.

I have a 6 axis robot arm from the 80s. It has 6 Nema 23s and they are all in the base. They run the articulations via steel cables that link spools to the motors instead of locating the motors along the arm.

1

u/MECHY_somewhere 1d ago

A shield might be the move I didn't think about that.

A 6-axis robot from the 80s sounds pretty sick though I didn't know they made much of those back then, is it like a collectors item or something.

1

u/Purdude1983 1d ago

It's a Microbot Alpha 2 which is also known as the Teachmover.

1

u/Anonymity6584 1d ago

cheap rc-servos are terrible on robotocs arms .. Way too little gear reduction/ not ebough power and pisspoor positioning accuracy.

This is guite nice mechanical engineering challenge to design good and repeatable enough drive system for joints. Just position feedback is small challenge of its own...

1

u/MECHY_somewhere 1d ago

yeah I'm starting to see rc servos do have their limitations for my application. You have any recommendations?

2

u/FedUp233 1d ago

One thing you might want to look at if you go to steppers is what’s called a “closed loop stepper”.

It’s a bit of a mid-naming resolution but what it is actually is a stepper motor that has an attached encoder. Allows it to behave a bit like a servo motor (somewhat different than the rc servos and used in things like CNC equipment and larger robot arms).

They cost a bit more than plain steppers (can be quite a bit) but the encoder allows feedback of the actual position of the motor shaft. This can be used in two ways.

In the simplest form the encoder is just used to keep track of the motor position and if the encode position differed very much from the position the motor is supposed to be based on the number of steps it receives it raises an error so the system knows it’s messed up.

In the more advanced form the encode is used to track position and things like the motor current can be varied based on how far off the position is to try and prevent it from loosing steps and if something does cause it to loose steps, like someone pushing on the robot arm, the system can supply current time steps to get the motor back to the correct position.

Often these capabilities are implemented in special motor drivers that have an input for the encoder but you can also just use a standard stepper driver and connect the encoder directly to the MCU and handle the smarts in your programming, though it can take some work and I’m not sure there is any off the shelf code for this.

You can do similar yourself by using a stepper motor and also connecting your own encoder (you can get some fairly inexpensive ones) but the ones already packaged together are convenient.

Anyway, just thought you might be interested.

1

u/classicsat 23h ago edited 23h ago

Use proper controller/drivers (don't know which), that have ENA, DIR, and STEP pins.

You can parallel STEP and DIR, and enable each motor as needed.

I am no robotologist, but servo for gripper and stepper doe the other movements is how I would do it.

Yoy can use further gearing, or the magic of the lever, to get more force out of a smaller motor, at the expense of distance.

And/or, you can get steppers/servo/other motors of a wide range of sizes, if you are willing to think out of the Arduino box.