Australia
Asked
Resolved Resolved by DJ Sures!

Using Stepper Motors With ARC

Hi .. I am new to ARC platform.  I have successfully created a project and exercised servos.  I know I can add DC motors via the Sabertooth controller .. my issue is that I would like to use Stepper motors (using a single Ez-b channel per stepper) .. I use the Pololu Tic T500 'smart' stepper controller which provides interface options:

  • TTL serial
  • I2C
  • RC hobby servo .. so my thought is that I could 'add' this T500 + servo into my Ez-b project as either a:
  • vertical servo   or
  • continuous servo .. and the Ez-b will treat the T500 + stepper as if it were a servo which is exactly what my hobby RC radio does.

Please advise if I am taking the correct approach here? Or should I be using this robot skill https://synthiam.com/Support/Skills/Servo/Stepper-Servo?id=21134


Related Hardware EZ-B v4
Related Control PWM Slider

ARC Pro

Upgrade to ARC Pro

Subscribe to ARC Pro, and your robot will become a canvas for your imagination, limited only by your creativity.

PRO
USA
#1   — Edited

If you want to emulate a servo (horizontal, vertical) you will need feedback input e.g. potentiometer: https://www.pololu.com/docs/0J71/4.9

If you don't have feedback input your best shot is: https://www.pololu.com/docs/0J71/4.8 you will need to adjust max and min pulses to the EZB v4 PWM interval and then you can use the smart controller as Continuous servo: https://synthiam.com/Products/Controls/Servo/Continuous-Servo-16097

bear in mind a Continuous servo does not support absolute position e.g. move to angle 45, 90 etc basically the PWM is used to control the velocity.

PRO
Synthiam
#2  

My experience with stepper motors has only been on 3d printers. They move to each extreme on startup, and then count the "steps" it takes to move into a position. It's a known position because it's your design, so X number of steps brings you to Y cm away from home.

If you used the TTL, you can instruct exactly how many steps from home you want. So that is the next best thing to adding a potentiometer to always know position. The only thing with the TTL and instructing steps is that you'll need someway to know the HOME position. Usually it's a little momentary switch that is hit at the lowest or highest position.

Then you instruct how many steps to move. Keep track of those steps, and that way you always know where the stepper motor position is.

Without reading the documentation, I imagine that stepper motor controller allows specifying the steps via TTL. If it doesn't, then we can help you whip something up using Arduino connected to the EZ-B.

Well, actually you can have the EZ-B perform the steps itself without arduino at all, directly connected to the stepper motor hbridge. But that's over complicating things because the EZ-B has better things to do :D

PRO
Synthiam
#3  

It does seem the Tic supports a home position on its own using a micro switch or any sort of momentary switch. It’s documented here: https://www.pololu.com/docs/0J71/5.6

then, if you use serial ttl, there’s simple commands to be send that tell how many ticks to move. It seems to handle that itself. That’s not a bad little stepper controller board.

might have to make a plugin for it.

Australia
#4  

Thanks for your prompt response. So I see where you are going DJ.  The Tic T500 (and certainly the others in the Tic range) samples a micro switch to determine HOME.  Operation of this switch would be communicated back to Ez-b via TTL serial. Now, with my limited experience on ARC sware .. I select Project>Add Controls .. but which control would I select to communicate with my Tic controller via TTL serial? and where in the Ez-robot 'brain' would I connect my Tic? Would it be in any of the 24 digital ips (so serial coms is only in one direction Ez-b to Tic) or would it be the single serial port? .. in which case I only get to run a single Tic per brain.  Please advise .. and thanks in advance. Also, is it the case that if you do develop a 'plug-in' for the Tic controller would there be a control in the control list specifically for the Tic controller .. as is the case with the Saber tooth DC motor controller?

PRO
Synthiam
#5   — Edited

I'd recommend using ARC, not ARC. With ARC you can use JavaScript, which is great for things like this. Specifically since it's going to be byte data.

Tic Settings Set the Tic for

  • Serial TTL mode
  • 9600 baud
  • "quick" serial command mode
  • disable CRC

Connect Tic to EZ-B v4 - We'll use UART #0 so take a look at the EZ-B v4 datasheet to locate it

  • Connect the Tic RX to the EZ-B v4 UART 0 TX
  • Connect the Tic TX to the EZ-B v4 UART 0 RX
  • Connect the Tic GND to EZ-B v4 GND

Program I did have a bit of trouble understanding the documentation. They switch terms throughout it and there's no standard for the terms they use on the communication protocol. They seem to switch between calling different protocols 7 bit or compact or block. It's a very "wordy" document, but not very "to the point" like most datasheets are. The datasheet should just outline a very specific command structure and move on. But this document was written by Stephen King or someone who loves to write :). I tried my best, but PTP might be more help on this part...

  1. For TTL Serial, you'll want to connect the Tic to any of the 3 UART ports on the EZ-B. You'll find them listed in the datasheet

  2. Project -> Add -> Scripting -> Script Because we'll create a little function that will move to the specified location easily

  3. Edit the Script and give it a Title. Something like "Set Goal Position"

  4. The code you'll use will be something like...


var goalPosition = getVar("$goalPosition");

var data = [];

data[0] = 0xe0; // set target position
data[1] = goalPosition >> 24;
data[2] = goalPosition >> 16;
data[3] = goalPosition >> 8;
data[4] = goalPosition;

UART.hardwareUartWrite(0, data);

-or- this is cleaner and quicker


var goalPosition = getVar("$goalPosition");

var data = [
         0xe0, // set target position
         goalPosition >> 24,
         goalPosition >> 16,
         goalPosition >> 8,
         goalPosition];
         
UART.hardwareUartWrite(0, data);

-or- this is even quicker and shorter lol


var goalPosition = getVar("$goalPosition");

UART.hardwareUartWrite(0, [
         0xe0, // set target position
         goalPosition >> 24,
         goalPosition >> 16,
         goalPosition >> 8,
         goalPosition]);

(sorry, i get carried away with fun JavaScript capabilities)

Calling it From any other script, when ever you want to move the stepper motor, you simply do this. This sets the position into the global variable $goalPosition, and then executes the script that you created.


// 1000 is the position. You can use a variable here. Or a value from a slider or something
setVar("$goalPosition", 1000); 
ControlCommand("Set Goal Position", "ScriptStart")

Or, you can put that code that sets the goal position into a Slide Script and you can control it manually: https://synthiam.com/Products/Controls/Scripting/Script-Slider-16074

Really though, it would be cool to see this turned into a plugin. The Tic board seems to be something useful to support.

Australia
#6  

A thorough treatment of my enquiry .. thanks DJ.  I can work with this.  One last question if I can pls then I will implement. As I am limited to 3 UARTs per Ez-b brain, I would want to run more than one brain in a single comprehensive robot.  I have seen other 'makers' do this.  Tho I am not certain that multiple brains can be managed by a single Project (perhaps they are running 2 x projects which would be 'messy') .. I have not seen a brain addressing method ??  I would be happy to use 2 x brains in my current 'large' project to avail myself of additional ADC as well as UARTs and digital inputs.  Please advise ...

Australia
#7  

DJ .. as an additional incentive to create a plug in for these Tic controllers, I just read that multiple Tics can be addressed from a single UART .. at the expense of some GPIO .. well a brain has 24 GPIO and only 3 x UARTs .. so this seems a fair tradeoff.

Australia
#8  

DJ .. illustration of several Tic controllers being managed from a single Ez-b brain: User-inserted image

Australia
#9  

Please advise difference between ARC and ARC?  I am only familiar with the ARC utility, do you have a link to ARC pls?

Australia
#10  

Actually .. pls disregard my last question .. I just found ARC and understand it to be the evolution of ARC

PRO
USA
#11   — Edited

I don't know if this helps but:

Did you see my car

Parts: IO tiny, ARC, Ez-battery - L298N Motor Drive Controller Board Module Dual H Bridge DC Stepper on Amazon, you can get 5 of them for 12.99

https://synthiam.com/Community/Questions/H-bridge-for-4-motors-robot-car-18995

I also have used the A4988 StepStick Stepper Motor Driver Module + Heat Sink

PRO
Synthiam
#12  
  1. Details of ARC are posted here: https://synthiam.com/Products/Releases/ARC-Beta-2020-01-27-00-19052 Download is from the same page as ARC.

  2. microcontrollers generally have 1 uart, if at all. Multiple aren’t usually needed unless you’re talking to many different things. In your case, the documentation of the Tic allows multiple to be assessed. That makes it possible to use one uart to control many Tic’s.

you will have to modify my code example to use the 32bit block commands? Something like that... again, they’re documentation is super wordy and isn’t direct like a normal data sheet would be. I don’t think I’ll have time to read their novel haha but I’ll try to help as you go along. See if they have a forum that you can ask.

ideally, an ARC skill plugin for the tic would be easiest because you wouldn’t need any code at all.

  1. up to 128 ezb’s can be controlled by one ARC project. Right away, you can see the connection control has 5 ezb connections. To add more, use the Project -> add control. It’s in the general tab.
PRO
USA
#13   — Edited

Quote:

But this document was written by Stephen King or someone who loves to write
I was watching "The Outsider" https://www.imdb.com/title/tt8550800/ based on SK book :)

I agree the documentation is verbose and the controller is a smart allows multiple configurations.

Quote:

I don't know if this helps but:
@EZang: Does not help your setup does not use stepper motors, and the cheap/affordable controllers can't be used with EZB to drive step motors, although you can use Arduino code, we are discussing different setups.

@All: Maybe I missed something, if the goal is to drive the step motors like DC motors (with velocity control) it's not easier to configure the controller for PWM and use the Continuous servo control ?

If the goal is to emulate an absolute position servo, then you have 2 setup options:

  1. add a Potentiometer, the controller maps the potentiometer feedback to the configured PWM interval.
  2. add a Limit switch (Home position) and then the controller handles the home position and manages the steps.
PRO
Synthiam
#14  

ptp, you don't require a potentiometer with a stepper motor - that's why it's not mandatory for this application. If the physical design doesn't account for a potentiometer to be installed, then a stepper motor can still operate as a servo. This is because it moves via steps. So you instruct how many steps to move in either direction. Keeping track of those steps and related them to a servo position works.

For example.. Servo 1 degree = 0 steps Servo 180 degrees = 100,000 steps

So if you move to a specific position, you'll need to keep track of where you were and how many steps to get back.

PRO
USA
#15   — Edited

@DJ, the main question is how you want to control the stepper motor ?

  1. velocity control you can emulate Continuous servo

  2. positional servo

Pololu offers 2 different methods:

2.1) add a potentiometer can be a multiples turns connected with gears and you have absolute position and then you emulate a servo configuring the PWM interval

OR

2.2) add home switch, and the controller handles everything for you:

Quote:

If you are using the RC position, Analog position, or Encoder position control modes, you might want to enable automatic homing so that you do not have to send the Go home command to the Tic. If you check the Enable automatic homing checkbox in the Advanced settings tab, the Tic will perform the homing procedure whenever it is being commanded to go to a specific position but it is uncertain about is current position (e.g. immediately after motor power is applied). The Automatic homing direction setting lets you choose whether the automatic homing will drive the motor in the reverse or forward direction.
Continuous/Velocity servo or a Positional servo (with additional hardware) you can emulate a RC servo and connect to an EZB digital port without any extra code (JavaScript or EZ-Script) so the question still stands the OP has one smart controller and can emulate a PWM servo makes sense more advanced scenarios (e.g. UART or scripting) ?

PRO
Canada
#16   — Edited

The application of the stepper motor may help determine the best way to drive it.

Is it being used for driving wheels on a mobile robot platform or on a rail system where limit switches can be used?

Is high torque a requirement? Steppers usually have low torque unless a high voltage (24V) is applied. High voltage is difficult to use on mobile robots.

PRO
Synthiam
#17   — Edited

Good point, ptp. Guess it comes down to what his application is. I seem to be enjoying exploring the idea of controlling the stepper as a servo by knowing/counting its steps - merely because I find it intriguing.

That might not be his best usage case for the application. guess we’ll have to see what he comes back with :)

i should add that the servo would be easy and the best solution

Australia
#18  

Wow .. thanks guys for your enthusiastic input.  I have more than one option to explore now.  I want to use steppers as a substitute where HDD Servos simply are not holding the load.  I am building a B9 robot full scale from Lost in Space original series .. many B9 builders have used EZ-build as their core controller.  So I have an arm about the same dimensions as a human arm and while servos perform well at the extreme end of the arm (claw and wrist) where weight is minimal .. as I move toward the shoulder I have two articulation points .. call them elbow and shoulder.  The elbow joint must support the forearm weight and the shoulder must support the entire arm weight.  I treat these 2 joints (elbow and shoulder as absolute position servos .. in exactly the way your humanoid robot does).  Now .. in addition to this I have a carriage which extends/retracts the entire arm assy on a rack & pinion .. I want to drive the pinion with a stepper emulating a continuous servo. What I have taken from your suggestions:

  1. I can upgrade to ARC and write Java scripts to communicate with multiple Tic controllers from a single EZ-b UART via simple serial protocol .. ANDing the collective TXD lines from the Tics.  I guess we must assume from this that the Tic controllers do not 'solicit' a packet to the host .. they only answer when they are polled .. so no risk of packet collision.
  2. I can force the stepper 'wrapped' by Tic controller to  emulate a servo either absolute position or continuous and communicate with Tic from one of EZ-b 24 x digital channels via its RC servo interface .. the stipulation here is that I introduce a home micro switch to the Tics input so that the Tic can manage homing .. removing that responsibility from the EZ-b and therefore eliminating the need for feedback from the stepper.

I don't actually know if the steppers I am using will handle the torque required in practice .. I have assumed they will but I hear you saying that steppers do not have high torque which concerns me .. my fellow B9 builders have used DC gear motors (typically a windscreen wiper motor) for these functions via a Sabertooth .. I may have to take this path.

Regardless of the path I end up taking, the real win here is that I have learnt a great deal from you guys in a short time.  This bolsters my confidence using EZ-robot and ARC .. I will in turn pass this confidence on to my fellow builders.

Thanks DJ and associates for your time.

PRO
Synthiam
#19  

I think that #2 is what ptp is suggesting, and i am keen to agree with him now.

One of the things we used for the 6 foot JD are 3d printed shoulder brackets from the Inmoov robot. They work really really well and are very strong. Do you have a 3d printer?

Australia
#20   — Edited

I do have a 3D printer .. please advise type of motor you use on your 6 foot JD and/or Inmoov .. as this will have similar demands to my build.  I would be very interested in looking at the STL files for these shoulder brackets pls.  I was hoping the server emulation approach would suit .. so you have sured up that idea.  However .. nice to know I can Java script solutions also .. using ARC.

PRO
Synthiam
#21  
  1. Either way, you'll have to use ARC eventually because it is replacing ARC :)

  2. The motor is merely a large servo. But the bracket STL files matter most. They're from the InMoov shoulder. I'll have Jeremie post the STL files for you here when he sees this. He's "working from home today"

  3. The servo emulation with Tic and a stepper motor will work real good i think - if the motor can get enough torque

PRO
Canada
#22  

Hello @mbrooks,

A rack & pinion system with linear slides may be ok for a stepper motor as it doesn't have to exert too much torque. The motor isn't carrying much of the weight in that type of system, it's mostly on the rails.

As you can see here, even steppers that are huge and are labeled "High Torque" don't have nearly the amount of torque as a 40kg/cm servo or DC gear motor. Geared Steppers do exist but they are rare.

Here's where I got the STL files from initially. I modified them to work with a different type of servo. I will have to ask EZ-Robot if they are ok with me publishing the files.

PRO
Synthiam
#23  

Jer - do you have a picture or video of the assembly we're talking about so he can get an idea of what to expect?

PRO
Canada
#24   — Edited

Yes, there is a detailed build tutorial with many pictures on the inMoov website.

Australia
#25  

Hi DJ / Jeremie   I found my way to the inMoov construction site and found this very useful.  I am going to order some Hitec HS805BB 'giant' servos ex US.  I will use these for my 'shoulder' lift in exactly the same way as the inMoov does.  I do see what you mean about these steppers and tho we know they will 'hold' while energised .. I have no fail safe for power down.  I also have the servos supplied in your EZ-robot kit which are higher torque and generally more robust construction than the 'standard' plastic geared Futabas I have been using.

Thanks for your help guys ...

PRO
Synthiam
#26  

Sweet - looks like jeremies solution is the best fit. No need to use the tic then :)

using servos with the inmoov shoulder design is great because it’s simply using regular servo function with no additional work needed

Australia
#27  

I will be using Tic + stepper for my carriage rack & pinion but I will use the Hitec HS805BB super servo in the shoulder .. all good now .. thanks Guys.

#28   — Edited

I'm very interested in your new B9 arm design using these new motors and servos. I've been down a two year prototype path a few years ago when I was designing my B9 arms. Your arms sound a lot like what I built with the various joints needing to be moved and controlled.

Did you 3D print your wrists and claws yourself or did you buy the set Bob R sells through the B9 Builders Club? When I designed and built my arms all I had available to me were the wrists and claws made by a vendor that is no longer active. These were very heavy and solid. It's been a while so I really don't remember the load I calculated that I was putting on the elbow joint at rest or while moving. Any servo I found simply could't lift the needed load or they would destroy their self's. Perhaps with the new lighter claws it's possible now to use these fairly inexpensive heavy duty servos and have them stand up to the punishment.

Something I learned in my search for the right motors and support materials in my B9 arm was that when figuring the load being placed on these parts you also need to figure in Joint Rotational Acceleration (top speed your motor will be moving the arm). There are several on line robot arm torque calculators and tutorials available that will help someone get an idea how strong motors and materials need to be. Here's just one from The Society Of Robots: https://www.societyofrobots.com/robot_arm_calculator.shtml . Please forgive if you already have this information.

As you probably know that among the new B9 Robot STL files now available there is one that lets builders print their own wrists and claws that are very light and very accurate to the original robot. Less weight is good. I have a set of Bob's light weight 3D printed claws that I'm looking forward to finishing and painting to replace my very heavy set I currently have on my B9 Arm.

I'm excited that there are now builders like you that are looking for a better way to build a fully articulated B9 arm that will fit in the torso and can move in and out. When I designed my retractable and fully articulated B9 arm nobody had been able to do it before. When I was discussing it with other builders I kept getting comments like: "it can never be done", "it's too experience to build", "there's not enough room inside the torso for all that", "the robot will fall over when the arms are out and moving around". All that just made me push forward and find a way. My biggest challenges were building all that so it worked, was as light as possible and have it fit through a 6' torso hole and inside of Will Hoff's rubber arm skin. Another challenge I had was getting a successful auto tune on the Kangaroo I was using with my Sabertooth for position and speed control.

I'm convinced there are better ways then my design that are simpler and cheaper to build and operate. There are many more people out there that are smarter in robotics then me and have better design ideas. There are also new and evolving equipment for this kind of stuff that I have no idea about or how to use. Good luck on your build and have fun!

Just for kicks here are just a few reasons I decided to use the DC Worm Gear Windshield motors and material I did:

Worm Gear Windshield Motors instead servos:  PROS: Quite (servos are so loud) Super strong Worm gear will hold position when powered off Durable. They last forever on cars. Made out of steel. Can be bought in different shapes, sizes, torque values and speeds Easy to control with motor controllers and micro controllers like Sabertooth/Kangaroo (once tuned) and EZ Robot/Synthiam Very easy to control if using a Sabertooth in RC mode Using the Sabertooth/Kangaroo I was able to get smooth, ramped and natural movements with the DC motor.

Cons:  Large Heavy Power hungry (mine pull just about 25 amps each top load) Because of size constraints of a B9 arm they are hard to mount a feedback device on like a pot or encoder Using ARC or ARC they are harder to send control signals to then servos.  Must have arms dead center before retracting into the body of the robot or extreme damage can occur. True with DC motors or servos. For some reason the Kangaroo has trouble with auto tuning this type of extended load. I ended up having to set a lot of the PID Coefficients manually.  Some slop develops in the worm gear making centering the arm up to dock and move back into the torso difficult.

I hope this helps and I'm looking forward to see where you go with all this! Have fun!!

PS: If you need to get more power out of a servo and abuse it more then it's designed considder a gear box for the servo to sit into. servo City has very nice sets that really preform. Many of their gearboxes have built in pots and can let the servo extend it's limits:  https://www.servocity.com/servos/servo-gearboxes

Australia
#29  

David .. ok well thanks for all of this.  I am using the claw and cuff designed by Ian Hughes ..which I then animated after the style of Robert Rossi's animated claw.  My standard Futaba (4.5kgcm) servo works fine for the claw.  I then looked at your current arm and decided to have a:

  • wrist left/right joint
  • elbow left/right joint
  • elbow/shoulder up/down joint (bicep)
  • carriage extend/retract

so the Futaba works with the wrist joint also.  I needed the EZ-robot servos (19kgcm) for elbow joint and I am going to try some nice CYS-S0650 (55kgcm) servos on order at present.  I guess I was just trying to see what I could do as an alternative to your 'bicep' DC motor .. the 25A current draw a bit daunting .. but it does look 'the business' doesn't it.  I will end up milling and machining my arm components as you have .. for now 3D prints will suffice.

So the worm gear slop was the cause of your centering issue .. yes .. makes sense.  You have saved me finding out short comings of Kangaroo the hard way .. thanks for that. Yes .. a couple of good heads up for me here .. appreciated.