Stepper Driver to CIM

This doesn’t have to do necessarily with FIRST, but this seemed to be the best place to ask it. If I am trying to connect a couple of cim motors to a grbl shield (https://www.synthetos.com/project/grblshield/) what do I need to do? Do they hook up directly or is there something in between, since they are supposed to be stepper motors coming off of the grbl?

That shield is meant for stepper motors, which CIM motors aren’t. In addition, CIM motors use a vast amount more power than is available from that controller.

You’d be better off controlling it with a talon and some pwm code on your arduino.

Hope this helps.

The thing is that I want to use CIM motors, but need to program it as a CNC device. I figured that the grbl shield was the best option, but can’t figure out how to hook it up. I was thinking of doing it through the talon, but still, I’m unsure how to hook it up to the grbl shield. Any thoughts?

If you want position (or velocity) control of the CIM, you will have to have an appropriate sensor, and use that sensor to perform closed-loop control of the CIM. The CIM is not a servo; and it’s not a stepper motor.

I’ve got the location problem already thought of using other means, though that could be a whole other problem hooking that up.

You would be much better off just using a stepper motor in my opinion. CNC machines typically use stepper motors and they aren’t that expensive.

Reason why I was avoiding stepper motors was that the design I want to do is less of a CNC machine and more of a Roomba that only does certain paths instead of covering every spot of the area. Want to make it easily programmable, so I figured making it act like CNC machine would make that easier. Steppers, as far as I knew, wouldn’t be able to drive something like a robot.

This is definitely an application for closed loop speed control, and not a stepper motor + stepper motor driver. Stepper motors and drivers allow for open-loop position control when there is no chance of the motor stalling (skipping steps) or slipping. In a Roomba like scenario, the robot is driving on carpet indoors, and could potentially find itself running into solid objects that would either stall the drive motors or spin the robot’s wheels in place. With a stepper here you wouldn’t be able to maintain reasonably precise positioning in these scenarios.

As others have said, you can’t drive a CIM with a stepper motor controller, nor can you recreate the accurate open-loop positioning of a stepper motor with a CIM.

I think the simplest way to accurately do something like this would be to use undriven follower wheels hooked up to encoders for position feedback. Properly done, these will allow for decently precise position information across a variety of different floors, and if your drive wheels slip (e.g. hung up on a small object, driving into a wall) you won’t lose any precision since the follower wheels would not be moving.

TheDRV8818 stepper drivers from TI used on the grbl sheild are for stepper motors and are not compatible with brushed motors. Stepper motors are electrically and fuctionaly different from brushed motors (like a CIM). Closed loop speed control with talons and encoders are the way to go.

This topic confuses me.

Driving a CIM open loop is easy with existing FIRST motor controls.
Get a Talon, Victor or Jaguar and the power electronics are done.
Arduino can easily produce PWM.
Most servo CNC controls use PWM on the low end anyway.
They close the loop with encoders, potentiometers or other sensors in the control system.

Driving a CIM closed loop could be done with a Jaguar alone but that would hybrid part of the control into the Jaguar.

I use steppers to drive non-FIRST robots all the time.
Position in the environment exceeds the sort of sensing most CNC controls do.
That is why CNC machines can be very dangerous.
They do not ‘see’ hands in the work area.
There is no reason you can not use a stepper to drive a robot at all.

I know this post is 60 days old but I just came across it.
I am more confused why you would want to drive a robot around on G-code or M-code.
I doubt Mach 3 or BobCAD support a driving milling machine :slight_smile:
Then again a router on wheels has been done an I doubt the software would know either.

I have considered using a FIRST size robot to haul around loads but at low speed and not under CNC control.
Bolt the milling machine to the robot frame?
That is a strange way to look at a portable machine tool.

Kidding:
Hey the driving milling machine needs some flood coolant.
Drive it through the locker room showers!
No…no…stop milling Lexan in the hall way now you need to tow a vacuum.

Not kidding:
I want to build a FIRST motor based CNC system.
I may even try to use the Talon or Victor for that purpose.

It only makes good sense when you think about it:

Every year we accumulate more CIMs and motor controls (drivers in CNC parlance).
We have the ever growing pile of parts.
A CIM is a 100+A 12V motor. That’s plenty big enough to drive a CNC axis.
You need to control the speed of the CIM which we do all the time.
You need feedback and that’s a concept we basically teach all the time.
All the community needs are viable plans and a working example.
It’s not like we couldn’t use a CNC machine in the competition!
So why not part the never ending pile as an act of technology recycling?

We could use but don’t need fancy linear bearings.
You can use a piece of black pipe or even 80/20 extrusion as the linear system.
Just use skateboard bearings or whatever you can find.
You can gear down the axis with the cogged belts which is common for servo systems anyway.
You could probably use AndyMark gear boxes but the backlash would increase.
You don’t need fancy ACME or roller ball screws, you can pull with belts or rack and pinion.

If you sit and think about this for a while you’ll realize that you are sitting on a mountain of CNC parts.
Every year you participate you could be building a robot to make building more robots easier.

Parts required to make this work:

  1. A computer to act as the control system.
    3D printers can use G-code and M-code but I doubt the Arduino CNC controller has the power to drive a larger CNC.
    There are plenty of PC based CNC control systems: EMC2 (Linux), Mach3 (Windows), KCAM (Older Windows), TurboCNC (DOS).
  2. A suitable interface between the computer controller and the FIRST motor controls.
    This for the most part already exists off the shelf.
    I suspect the FIRST control system could be rigged to do this if you did not want to buy or build this.
  3. Plates to put the CIMs on the machine with the necessary gearing to drive an axis at acceptable velocity and thrust.
    This is perhaps the part most likely to require machine tools already to make.
  4. A machine design for a gantry router.
    I already have a pile of my own and other people’s designs for this purpose.

Entirely correct! If it helps this is how a common CNC is done these days. They use DC servo motors that are servo-ing on velocity and/or current. Usually this servo loop is hardware-based and built into the amplifiers that drive the motors w/ tach output. The system servos on position using external position sensors, optical scales and such. The position servo is done in software or (in a more expensive setup) in a FPGA or a dedicated computing engine of some sort.

Eli,
I have to ask how big you are planning to make this robot? The CIM motors are obviously capable of driving a full size 150 lb robot. I suspect what you want is something much smaller and not nearly as fast. While not a big fan of FTC motors, they do the job on that size robot every year and the hardware for driving them is available. Arduino support is also available on the net.
I seriously doubt that a CIM driven CNC would give you the accuracy needed or do a better job than stepper motors. The brush spacing won’t give you the accuracy needed for precision machining.

I will see you in 80 days from my trip around the world :slight_smile:

Considering that you will gear down the CIMs significantly to achieve the target IPM feeds the brushes are not nearly as significant an issue as they would first appear.

I do not disagree that steppers driving directly into an axis are far more likely to produce the fine control easily that someone would desire for this application.

However even my Mitsubishi HC-KFS43K servo motor with encoders and controller are geared down on my machine.
These are no toy servos.

Especially if the axis in question is a lead screw you immediately gain gear ratio.

Besides I can easily demonstrate my point right now.
Find a really high precision X/Y table in a machine shop and turn the cranks.
Many of them require multiple complete revolutions to travel extremely tiny distances.
You don’t even need nearly that level of gearing.

Plus you will be magnifying the trust of the axis by gearing down the CIM.
Put the encoders at the output side of the axis and they will move slower and you can measure where the output is.

If you gear your stepper motors correctly, you can use them for anything, including robot that weigh over 1000 pounds.

I guess that depends on your definition of “use them”.

**

Steppers are great for applying lots of force at low expectations of speed.
You can gear a stepper up to get more speed from the resulting output.
This works because the stepper pours torque in while moving slowly.

Other kinds of motors generally need to be geared down.
They produce power and speed in varying characteristics.
Most motors for CNC need to be geared down they move too fast.
Gear a motor down and the output torque increases.

Upside to a DC motor on CNC if you are cutting fast under power you can get there by gearing down.
Upside to a stepper on CNC if you cutting slowly you can move accurately easily and cheaper.

Gantry mills are typical for working over largish working areas.
A 4’x8’ sheet of plywood for example.
How long would you like to wait for the stepper to do that job?
If the load is light like a plasma cutter that is one thing.
What if you are pushing around a 1/2+HP router with a big face mill on a deep cut?
A stepper will finish the job and you can even close the stepper loop with a sensor but is your CNC control smart enough to advance a missed step or microstep? Many are not. A detected error will just cause a stop.
On the other hand with a DC motor as noted the resolution of movement is never taken for granted.
A DC motor can take a heck of a beating as FIRST motors do and like FIRST motors they can be operated overloaded.
A DC motor will maintain the torque even as the rate of movement increases.

There is no magic ‘right answer’ to this.
My point stands: you have CIMS and a way to drive them.
An equivalent servo control and motor would be many hundreds of dollars per axis.
FIRST teams build gearing systems all the time.
Where as more hobby people with no tools, way to fabricate anything or idea how to make or program controls will undoubtedly start with steppers a large percentage of FIRST teams are not faced with those limits.

So say that you do decide to use CIMS…

What would your electronics setup look like. Do you have a specific set of encoders in mind? What board will interface between the motors and PC CAM software?

There was someone who used CIM motors to make a 3D printer that printed concrete…That was some time back.

Your posts are like poetry…take it or leave it.

At the moment I would start by seeing if I can get a Victor, Talon or Jaguar to act as the servo driver. In brake mode I should be able to make the CIM stop it’s momentum quicker considering that if it’s turning a lead screw it will be geared down pretty hard to start. Otherwise if the linear motion is provided by belts or rack and pinion the electronic braking might be helpful getting the axis to rest at the right position.
If none of the FIRST controls will do what I want it is no issue for me to retrofit my Parallax Propeller based motor control I already created.
I never sent it for FIRST approval but FIRST has nothing to do with approving this.

I would use a bank of yard tractor lead-acid batteries for the power supply to those motors.
It would not only provide adequate current on demand but I have built plenty of UPS from scratch and I can charge those batteries while they supply the load.
These batteries are relatively cheap and readily available just about everywhere.
I have 4 sitting on charge right now because I use a string of 4 occasionally as a 48V power source.
I have used them with FIRST motor and motor controls before.
These batteries also solve the underlying power supply issue that the FIRST motors create.
Normally CNC motors would increase in voltage not current.
Increasing the voltage makes the driver and power supply lighter from a standard American wall socket.
In the case of FIRST those little modules are current hungry not voltage hungry.
They will need the low internal resistance of a battery to operate predictably or something like a automotive grade size roll-around car battery charger / starter.
I think the batteries are more realistic. Plus power interruptions on long jobs are then reduced by the battery.
It’s not like FIRST teams also don’t have access to batteries themselves.

Plus FIRST robots come equipped with a PDB which is already setup to protect the motors and power source from the typical currents involved in this project. So that can be reused.

I am awaiting a part or so for the 600ppr encoders from China that I am testing in the other topic. If they work properly I may as well use them as the quadrature will produce 2,400ppr.

I am already setting up Mesa Electronics Anything I/O board with a 400k FPGA for a more portable gantry mill I am assembling right now. If that gives me headaches I will revert to the Gecko stepper driver I used for a customer project recently. That will be used with EMC2 in Linux on an old computer as the CNC controller. That mill will start with Vexta bipolar NEMA 23 steppers I have right now. I have those steppers in both 0.9 degree and 1.8 degree models. I have adequate LiniSteppers (and 28V switching power supplies) on hand for those steppers as well as some cheap stepper drivers rated around 4A I have a pile of. Those Vexta steppers are between 180 oz-in and 270 oz-in. As a starting point that is workable. I believe that I can use the Mesa Electronics module with slight modification to produce adequate PWM to drive a FIRST motor control but I will test that to be sure. I should be able to service the encoders with that module. If modification from the default is required it is something I can do.

It might be possible to use a cRIO for this purpose even with the FIRST firmware still in it. I would really have to tinker with it and at least for EMC2 I suspect the odds are pretty high a custom driver would be required. Information does exist for that purpose but for now there are enough challenges. A working CIM driving an axis under power and load will eliminate the first issue which is to remove the doubts that it can be done.

I am working with someone, I hope, to start work on a CIM based module that will bolt onto those NEMA 23 mounts. A NEMA 23 stepper output shaft is around 1/4" but of course the direct shaft coupler at that attachment point can probably be sized up to accept larger or even differently shaped shafting.

Ultimately I hope to make the end product literally as compatible with upstream software like BobCAD, Rhinoceros and SolidWorks as any other CNC machine. Using the CIMs in place of the steppers should be a transparent change beyond the controller. Though as a closed loop the CIMs will likely require calibration but that issue exists for all closed loop servo drives. Someone will always have to calibrate the PID loop that the servo and encoder form. Just a fact of life.

If your typical stepper has a full step of about 1.8 degrees.
That means that it will give you at least 200 discrete steps per revolution.
If you drive that into a 10tpi lead screw.
For each revolution at the end of the screw the linear motion will be 0.1".
So with 200 discrete locations per revolution the maximum full step revolution is 2,000 per inch.
With microstepping you can get repeatedly down to 10x the resolution at 70% or so power.
So in theory the upper end resolution on a 1.8 degree stepper with a 10tpi lead screw is 20,000th of an inch.
With a very repeatable 2,000 of an inch resolution.

To replicate this with a brush motor let’s assume we could power our way into 2 positions - 4 positions per revolution.
The 1.8 degree stepper output resolution as our model at 200 discrete locations per revolution.
So if you had gearing that could get you 100:1 or 200:1 you’d have something that was similar resolution.
At say 2500RPM (where the CIMs put out max power) that means you could get between 25 and 12.5 revolutions per minute.
Keeping in mind CIMs are intermittent duty.
In practice these ratios would be generous or fivalous depending on the goal in mind.
Of course these would drive the same 10tpi lead screw.
So if you used a 100:1 ratio you could move 2.5" per minute.
So in the end you end up with similar resolution but think the CIMs move a 150 pound robot.
Force in the tons is possible at the output axis hence why a CIM can lift a trailer.
We will loose some of that power because of the way we are controlling the CIMs but who really cares?
When I use the existing NEMA 23 steppers I have I will loose some of the power they offer because I will at time travel at higher speeds than they put out maximum power at. So between the 2 we trade off.
So with the steppers we’d have to go slower to maintain the power.
With the CIMs we would have power to even go faster.
In the end both would likely produce similar amounts of power just at different points in operation.

In this example situation:
At 2.5" per minute the stepper is loosing power quite significantly.
At 2.5" per minute the CIM is nearing peak power.
On the other end. When moving slowly:
When the CIM is moving at lower speed it’s putting out less power.
When the stepper is near stall speed it is putting out maximum power at full step (less power at microstep).

Normally it would make no financial sense to start with the servos initially.
Between the drivers and the steppers it’s maybe $100 an axis.
Between a $25 CIM, a $50 motor control, an encoder at $20-$40 and the gear boxes.
Plus the CIMs draw lots of current compared to more typical CNC motors so the wire is heavier, the batteries and the current safety.
Why do it? Cause FIRST is going to make you do it anyway :slight_smile:
You are driving around with many of the same requirements on your robots now.
Plus FIRST teams usually get an 80/20 discount.

Besides nothing stops you from hybriding the drive (use both steppers and servos). Think about it.
Look at a AndyMark dual CIM gearbox. What if you opened the circuit to one motor or the other?
What if one motor is a stepper and the other is a CIM?
It would merely spin like an unloaded generator while the other motor does the work.
You could exploit the advantages of both motors.

I really and quite seriously doubt:
That so many teams would sneeze at the lower resolution we could target at higher feeds either.
However equivalent resolution to the steppers are possible with the CIMs.
When so many teams can’t get in range of a CNC machine at all without impacting their build budgets…
Certainly not servo CNC…
This would let them roll their previous build budgets forward.
Just a bit more repeatable than a hand drill in the pits. Just a bit.

Besides if the speed of the unloaded rapids is an issue FIRST has already shown you how to fix that.
You switch gears.

The inability of the CIM to be indexed to smaller increments can also be changed mechanically.
If you put a wheel on the output of the CIM separate from the gearing.
Give it adequate diameter to ride another wheel against it.
Cut rounded dents into the perimeter of the wheel in which the idle wheel can interlock.
Support the idle wheel on a spring assembly.
When the CIM turns the idle wheel will roll over the perimeter of the larger wheel.
With the dents at even increments at low speed, where the CIM has the least power, the CIM will tend to index the dents.
At higher speed the CIM will tend to just make the idle wheel kick right out because of the increasing power.
This will mechanically tend to make incremental rotation for the CIM much more dependable.
Regardless of the brush locations or even the encoder.

I am providing this link because it gives what I consider good and well explained advice on milling aluminum in a gantry mill.

It considers what if the spindle is much faster than the spindle of a bridge or turret mill.

It considers the ideal feed rates which are much higher than what a stepper driven gantry mill is capable of in many cases.

It shows the interrelated factors that influence the designs.

Most importantly:

  1. Don’t slow down the feedrate too much!

If you go too slow on your feedrate, you run the risk of making your tool rub rather than cutting. This is a much bigger risk for CNC Router users than mill users simply because the spindle is going so fast. In order to maintain recommended chiploads with rpms that high you’ll have to keep the cutting moving smartly. Our 3/16″ cutter at 21K rpm wants to feed at 91 IPM, for example. If you slow down too much, say to 1/4 of that, many will think they’re babying the machine and tool. Nothing could be further from the truth. If you wind up going slow enough that the cutter starts rubbing at 20K rpm, you’re going to heat up the whole works and drastically shorten your tool life. For more on this rubbing phenomenon, see our article on chiploads and surface speeds.

It would be very easy to gear down a CIM from a peak power output at 2,500RPM to 900RPM turning a 10tpi lead screw. You’d be close with a 2.5:1 ratio. Versus the 100:1 ratio I used above while targeting a replication of 1.8 degree stepper resolution.

I can with certainty write that my Oriental Motor PK268M-02A bipolar, 4 wire, 0.9 degree stepper motors will loose steps and bring operations to a dead halt at anywhere near these feeds.

Therefore the ‘sweet spot’ is somewhere between a gear ratio of 2.5:1 and 100:1. The lower one makes the ratio the more the precision will suffer. The higher one makes the ratio the lower the feed rate will be limited and depending on what you are carving your way through that could be a problem. With steppers the only way you could get near these feed rates would be a high power stepper geared up. Gearing it up reduces the resolution by that ratio.

Once we accept that we must loose stepper resolution by gearing up to get to the feeds to reduce the tooling issues it makes the CIM look much more reasonable. Plus in reality the Acme lead screws on most machines will limit the tangible resolution much more than it would appear. Most small gantry mill kits list a repeatable resolution of 0.005" or so for this reason. They might move into smaller increments but it can be unreliable to repeat it over and over.

Now we can slow the feed rate if we can turn the spindle slower.
So how about if we can get closer to a bridge or turret mill speed of 5,000RPM?
We could buy a cheap Chinese motor, motor control, power supply and mount off E-Bay for $150+.
400W Chinese spindle motor
However we have 2,500RPM+ CIM motors and motor controls.
Plus we are already providing batteries to drive the other CIM.
So we could gear the CIM 1:2 for speed and get 5,000RPM.
At more torque than the Chinese set as well (interesting the torque ratings on the Chinese motors are 0.35 or 0.5Nm).
Most of those are 0.5Nm or about 70oz-in a CIM at 2,500 RPM is closer to 170 oz-in (do consider the gear ratio).
You’d need to provide a spindle with the ER11 collet fixture to do this.

My point is that the accuracy of the CIM motor is dependent on the brush spacing and the size of the brush assy. The CIM has approximately 6 distinct positions (steps) per rotation or 60 degrees +/- 90 degrees per step (based on the brush contacting two commutator segments +/- 1 segment). In a rough calculation using the above example of 100:1 reduction, the per step accuracy of the CIM would produce about 0.0004" +/- 0.0006" per step at the output of the lead screw or 0.1" +/-0.25" for 1 rotation of the lead screw, worse case. The 1.8 degree stepper as shown above will produce as described 0.0005" +/- 0.00002" per step or 0.1" +/-0.004" per rotation, worse case. While it is possible to produce better accuracy in the CIM in a closed loop configuration and with higher reduction ratios, there is a diminishing return on investment. This example does not take into account the accuracy of angular position within a 100:1 transmission and assumes it to be infinitely accurate.