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

Stay at the forefront of robot programming innovation with ARC Pro, ensuring your robot is always equipped with the latest advancements.

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

Loading...