Welcome! Log In Create A New Profile

Advanced

3-axis closed loop motion control

Posted by AleksClark 
3-axis closed loop motion control
January 12, 2017 08:36AM
Greetings! I'm a long-time hacker who hasn't had much time for anything except scavenging parts until recently. Now that I've got a 3d printer, a lot of projects seem much more in reach, and I wish to contribute to the world of OSHW 3d printers. The thing about scavenging for parts is, you inevitably take apart a lot of 2d printers, and as such you end up realizing that newer printers don't use steppers anymore, with obvious cost benefits. It's clear that 2d printing quality has increased, while cost to manufacture has decreased. I suspect stepper motors are about as cheap as they can get atm, so the next breakthrough in reducing printer cost is going to be DC motors.

What's I'd like to do then, is to develop fully closed-loop DC motor control in 3 axis, WITHOUT pretending to be a stepper. Projects just as [hackaday.io] exist, but they don't go all the way:

  1. they are emulating steppers, with STEP and DIR signals. this is nice in that you don't have to re-write firmware, but it doesn't take full advantage of a DC motor's continuous feed rate, as opposed to a stepper's steps
  2. they generally rely on on-shaft quadrature control, which is nice if you have a 0-backlash ballscrew, but not so helpful in controlling position if you've got a $2 piece of threaded rod that's bent in a few places

The benefits of closed-loop control should be pretty obvious:
  1. cheap DC motors instead of steppers, for a given torque
  2. no skipped steps ruining prints
  3. smoother motion profiles, as DC motors are ramped up & down

Downsides are:
  1. more expensive electronics (faster uC's, mainly, and these are getting cheaper every day)
  2. additional parts (encoder, strip)
  3. more complex firmware

My purpose in posting here is twofold:

First, I want to know if anyone knows of similar project. NIH is not a problem for me, if there's another OSHW project out there doing this, I'd love to contribute to its development. There are at least two closed-source implementations I've come across, and one of them I *believe* is using on-shaft encoders, not linear ones, it's possible both are.

Second, does anyone know where I can get optical encoding strips for cheap? I could get them by just gutting a few identical printers would get me enough strips to be going on with, but that's hardly an ideal, from a manufacturing standpoint.
Re: 3-axis closed loop motion control
January 12, 2017 11:51AM
Quote

Second, does anyone know where I can get optical encoding strips for cheap?

I think that issue is exactly why the existing projects are using shaft encoders.
Re: 3-axis closed loop motion control
January 12, 2017 11:59AM
I found these, ordered some: [www.aliexpress.com] Enough strips for 5 1Mx1Mx1M printers if you cut them in half (I'm envisioning a jig with a box cutter blade)
Re: 3-axis closed loop motion control
January 12, 2017 12:01PM
Excellent. And I see they have the sensors too, although I didn't have time to figure out the price differences and come up with a total printer cost. But looks interesting for sure! 180 lpi seems a bit low resolution, but I guess interpolation can be used.
Re: 3-axis closed loop motion control
January 12, 2017 12:33PM
Quote
JamesK
180 lpi seems a bit low resolution, but I guess interpolation can be used.
Quadrature sensors should result in a 4x resolution increase, for a 720lpi total. Sensors I've found so far seem to run $10/piece though, which is disappointing...
Re: 3-axis closed loop motion control
January 12, 2017 01:20PM
Quote

Sensors I've found so far seem to run $10/piece

Far from out of the question for a high-end printer though. It depends on how the advantages/disadvantages and costs stack up vs rotary encoders. From your first post it sounds like you had this in mind as a cost reduction strategy compared to steppers. I'm not sure if that is viable or not, but closed-loop as a quality/reliability improvement is certainly of interest to me, even at higher cost.

Edited 1 time(s). Last edit at 01/12/2017 01:21PM by JamesK.
Re: 3-axis closed loop motion control
January 12, 2017 02:15PM
Yea, there's a spectrum of course. Say you're using high-quality $30/each steppers, and you end up paying $25 for a DC motor, strip, and sensor, that actually produces better quality, that's still a definite cost reduction, it's just happening at the middle of the market instead of at the bottom. It should trickle down if interest rises. Ultimately what I'd like to see is lulzbot/monoprice/et. al. selling $100 or $50 entry-level printers that print decently, and I think it could actually happen with DC motors.
Re: 3-axis closed loop motion control
January 12, 2017 03:08PM
The New Matter MOD-t printer (yes I know, closed-source) uses DC motors with optical encoders for all the reasons mentioned, and they are cheaper than NEMA steppers. They also eliminated the limit switches which always seem to be a nuisance.
Re: 3-axis closed loop motion control
January 12, 2017 03:23PM
Quote
LoboCNC
The New Matter MOD-t printer (yes I know, closed-source) uses DC motors with optical encoders...

Yep! That's one of the ones I'd seen, and it's the one I'm pretty sure is using on-shaft encoders.
Re: 3-axis closed loop motion control
January 13, 2017 04:03AM
There are a few OS/DIY projects regarding closed loop motion control, but none I know of has implemented it in firmware directly. A new controller or shield would be required.
As long, as you don't find a software guru willing to write firmware for it, your project is just a dream.
Re: 3-axis closed loop motion control
January 13, 2017 04:59AM
Quote
AleksClark

The benefits of closed-loop control should be pretty obvious:
  1. cheap DC motors instead of steppers, for a given torque

I'm not sure that is obvious, despite people frequently claiming it. The costs of 2d printers are misleading, because the cost is mainly driven by mass production, not just technology. If you are making 100,000 2d printers, it is worth spending $50k to make it $1 cheaper. But if you are making 1,000 3d printers, it is not worth the investment.

A Nema17 + driver costs around $15. So far no one has designed a DC motor + encoder + driver for less than $15. Tarocco mentioned above is $40 just for 1 axis driver.

I bought some of these [www.ebay.com] to play with, but I'm not a hardware guy. If someone could build a driver board, writing the software should be straightforward. For proof of principle, I would build a 3 axis motor driver encoder interface. Target cost is < $35, assuming motor + encoder costs about $4. I think that's doable, just needs someone to do it.

Then someone needs to design a printer with different belts and motor mounts.


What is Open Source?
What is Open Source Hardware?
Open Source in a nutshell: the Four Freedoms
CC BY-NC is not an Open Source license
Re: 3-axis closed loop motion control
January 13, 2017 09:49AM
Quote
bobc

I bought some of these [www.ebay.com] to play with, but I'm not a hardware guy. If someone could build a driver board, writing the software should be straightforward. For proof of principle, I would build a 3 axis motor driver encoder interface.

I've gotten a proof of concept extruder working with the following:

* Small DC motor with encoder
* Arduino Nano
* This firmware on the nano: [github.com]
* This driver board: [www.ebay.com.au]

This is driven by the normal direction and step signals, and with a bit of PID tuning on the arduino, controls the motor in a nice closed-loop fashion.

Edit: That motor doesn't look like it has quadrature encoding on the speed sensor, so you won't be able to get proper closed loop control. You'd have to add another sensor on that wheel to get proper closed loop control. It doesn't matter where you put it, you'd have to be extremely unlucky to get it perfectly in phase with the other sensor.

I hope this helps.

Edited 1 time(s). Last edit at 01/13/2017 09:55AM by nebbian.
Re: 3-axis closed loop motion control
January 13, 2017 10:14AM
Quote
o_lampe
As long, as you don't find a software guru willing to write firmware for it, your project is just a dream.
Yes, I do realize that the hardware is fairly trivial atm, and the bulk of the work is software, that's why I chose this particular avenue of contribution smiling smiley

Quote
bobc
A Nema17 + driver costs around $15. So far no one has designed a DC motor + encoder + driver for less than $15.

H-bridge: $1-2
Motor: $7 ish, and it's probably overkill: [www.ebay.com.au]
Encoder Strip: $2 (see above ali express)
Encoder: Currently about $10

So that's $21 using just what I've been able to find. The thing is though, stepper motors used to cost $20 by themselves, before they were popular for printers. Same for driver boards. Once/if this technology is proven viable, we can expect strip and encoder costs to drop a LOT (currently they're relatively niche - 2d printer part replacement), and dc motor costs to drop as well, although probably only a dollar or two.

This completely leaves aside the point that this should be a /more/ accurate form of motion control, since the loops are closed - if it out-performs steppers by 30%, and costs 30% more than steppers, then it's still a win.
Re: 3-axis closed loop motion control
January 13, 2017 10:21AM
You probably need to add a gearbox to your prices, and I'm not sure if brushed DC motors are the right way to go. At least the drone market is reducing the prices of nice BLDC motors smiling smiley
Re: 3-axis closed loop motion control
January 13, 2017 10:22AM
Quote
nebbian
I've gotten a proof of concept extruder working with the following..
I hope this helps.

Cool! the extruder can probably live with on-shaft feedback. Got any pics/freecad docs? grinning smiley
Re: 3-axis closed loop motion control
January 13, 2017 10:28AM
Quote
JamesK
You probably need to add a gearbox to your prices, and I'm not sure if brushed DC motors are the right way to go. At least the drone market is reducing the prices of nice BLDC motors smiling smiley

Yea, I dunno. A gearbox would drop the torque requirements, and backlash would be handled by not using on-shaft feedback, but it would come at the expense of complexity & speed. I do see people doing pretty cool stuff in the ESCs, getting feedback from the motors without additional sensors, but my suspicion is that I should KISS with an over-spec'd brushed DC motor, get the software working, and then look into brushless, real torque requirements, gear boxes, etc.

The beauty of closed loop is that with the software in place, I could drive it with hamster wheels if I wanted tongue sticking out smiley
Re: 3-axis closed loop motion control
January 13, 2017 10:44AM
Quote
JamesK
You probably need to add a gearbox to your prices, and I'm not sure if brushed DC motors are the right way to go. At least the drone market is reducing the prices of nice BLDC motors smiling smiley

+1 to that. Stepper motors and BLDC motors have no brushes to wear out.

BLDC motors come in two sorts: ones with commutation sensors, and ones without (so the controller has to use back EMF sensing). The ones without commutation sensors might not work in this application, because at low speeds there is probably insufficient back emf to detect. The ones with commutation sensors should be ideal if the price is right, because you won't need a separate encoder.



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: 3-axis closed loop motion control
January 13, 2017 10:51AM
Quote
dc42
BLDC motors come in two sorts: ones with commutation sensors, and ones without (so the controller has to use back EMF sensing). The ones without commutation sensors might not work in this application, because at low speeds there is probably insufficient back emf to detect. The ones with commutation sensors should be ideal if the price is right, because you won't need a separate encoder.

So, I think the interesting thing in this thread is the suggestion to use linear encoder strips, along with the evidence that they're not as expensive as I'd thought. That fits well with sensorless BLDC since there's no (obvious?) need for two sets of position sensors per axis.
Re: 3-axis closed loop motion control
January 13, 2017 12:22PM
Regarding linear encoders vs motor shaft encoders, keep in mind that if there is any backlash or flexibility in the system, trying to servo-out the backlash can be difficult to do and often introduces hunting behavior or other instabilities. Industrial systems sometime will use two encoders - one on the motor to stabilize the position control and a second linear encoder to correct for backlash. In 3D printing where there are lots of rapid reversals of the motion, the backlash problem is particularly difficult.

Also keep in mind that for accurate, stable closed-loop control, particularly while moving, it's good if position sensor has at least 10x the required positioning accuracy. The 180 LPI (720 quad counts/in) encoder strips used for printers might a little marginal without some additional interpolation.
Re: 3-axis closed loop motion control
January 13, 2017 12:41PM
Thanks for the input - I do have some of those $3 wheel + encoder things on the way from china, with 100 LPR, should be at least a start. That said, part of my goal in writing new motion control software is to at least somewhat smooth out the rapid reversals.

Edited 1 time(s). Last edit at 01/13/2017 12:42PM by AleksClark.
Re: 3-axis closed loop motion control
January 13, 2017 12:47PM
There are a lot of theoretical concerns, I think it would be interesting to review what has been achieved already : [www.youtube.com] I think that is by misan? That demonstration seems to get quite far - it actually prints.

I would try to reproduce what he did, but I can't find a source for the motors he used. I think he has an additional Arduino mini driving each axis, so I would try to incorporate that function into a printer firmware. He has added the DC motors with minimal modification of the Prusa, adding an encoder strip would need more work.

I think firmware designed for shaft encoder would be easily transferable to an encoder strip, I think a single firmware should be able to support both with suitable parameters. I guess that handling 4 axis closed loop could be done with AVR arduino but would reduce top speed achievable, ARM would give more headroom.


What is Open Source?
What is Open Source Hardware?
Open Source in a nutshell: the Four Freedoms
CC BY-NC is not an Open Source license
Re: 3-axis closed loop motion control
January 14, 2017 03:28AM
I was wondering, if we could use optical mouse sensors as encoders?

They work on almost any surface and have a pretty good resolution. I could imagine, they are cheap too.
Just put such a sensor on your linear rail and let the 2020 profile be your encoder strip. smoking smiley

Regarding suitable dc motors, we could look into car industry. There are tons of 12V motors in a luxury car. (eg. electric driver seat adjustment )
Might be, we find a suitable, mass produced geared and encoder-fitted motor for cheap.

Edited 1 time(s). Last edit at 01/14/2017 03:32AM by o_lampe.
Re: 3-axis closed loop motion control
January 14, 2017 03:42AM
Quote
o_lampe
I was wondering, if we could use optical mouse sensors as encoders?

They work on almost any surface and have a pretty good resolution. I could imagine, they are cheap too.
Just put such a sensor on your linear rail and let the 2020 profile be your encoder strip. smoking smiley

That sounds like an excellent idea to me.

Quote
o_lampe
Regarding suitable dc motors, we could look into car industry. There are tons of 12V motors in a luxury car. (eg. electric driver seat adjustment )
Might be, we find a suitable, mass produced geared and encoder-fitted motor for cheap.

My concern would be that most of those motors don't get a lot of use, so brush wear wouldn't be an issue in a car but would be in in a 3D printer.

Edited 2 time(s). Last edit at 01/14/2017 04:12AM by dc42.



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: 3-axis closed loop motion control
January 14, 2017 03:58AM
I agree with David, brushes can wear out, but a DC motor is so much easier to control.
E. g. the L6234D chip is a 3phase H-bridge, able to control one BLDC motor or three DC motors. It would be a good starting point for a new generation of controllers.

Edited 1 time(s). Last edit at 01/14/2017 03:59AM by o_lampe.
Attachments:
open | download - L6234d.pdf (489.8 KB)
Re: 3-axis closed loop motion control
January 14, 2017 06:10AM
Quote
o_lampe
I agree with David, brushes can wear out, but a DC motor is so much easier to control.
E. g. the L6234D chip is a 3phase H-bridge, able to control one BLDC motor or three DC motors. It would be a good starting point for a new generation of controllers.

That's a triple half bridge, I think for bi-directional control you need a full bridge. There seem to be a lot of driver chips for small motors though, as noted cars are now full of them!


What is Open Source?
What is Open Source Hardware?
Open Source in a nutshell: the Four Freedoms
CC BY-NC is not an Open Source license
Re: 3-axis closed loop motion control
January 14, 2017 06:52AM
Quote
bobc
Quote
o_lampe
I agree with David, brushes can wear out, but a DC motor is so much easier to control.
E. g. the L6234D chip is a 3phase H-bridge, able to control one BLDC motor or three DC motors. It would be a good starting point for a new generation of controllers.

That's a triple half bridge, I think for bi-directional control you need a full bridge. There seem to be a lot of driver chips for small motors though, as noted cars are now full of them!

A triple half bridge is sufficient. See [www.digikey.co.uk].



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: 3-axis closed loop motion control
January 14, 2017 07:16AM
Quote
dc42
Quote
bobc
Quote
o_lampe
I agree with David, brushes can wear out, but a DC motor is so much easier to control.
E. g. the L6234D chip is a 3phase H-bridge, able to control one BLDC motor or three DC motors. It would be a good starting point for a new generation of controllers.

That's a triple half bridge, I think for bi-directional control you need a full bridge. There seem to be a lot of driver chips for small motors though, as noted cars are now full of them!

A triple half bridge is sufficient. See [www.digikey.co.uk].

Derp. For brushless DC yes, not three DC motors. See [en.wikipedia.org]

Edited 1 time(s). Last edit at 01/14/2017 07:18AM by bobc.


What is Open Source?
What is Open Source Hardware?
Open Source in a nutshell: the Four Freedoms
CC BY-NC is not an Open Source license
Re: 3-axis closed loop motion control
January 14, 2017 08:08AM
Sorry bob, yes I meant sufficient for one BLDC, not three DC motors.

Edited 1 time(s). Last edit at 01/14/2017 08:08AM by dc42.



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: 3-axis closed loop motion control
January 14, 2017 09:09AM
No need to reinvent the wheel, modern brushless controllers are amazingly small and powerful.

I have about a dozen of these on various craft:
[www.banggood.com]

The firmware is open source as well:
[github.com]

Cheaper options exist if you want to buy multiple ESCs on the one board:
[www.readytoflyquads.com]


The main issue with these controllers is that they don't handle low speeds all that well. Reversing is getting better with the newer software, some people (including me) have dabbled in quadcopters that can hover upside down, which requires the motors to reverse direction quickly. This is directly applicable to our situation.

I get the feeling that the brushless solution would take a lot of effort to get to be as precise as a simple stepper motor, however.
Re: 3-axis closed loop motion control
January 14, 2017 12:42PM
The RC-brushless ESCs are usually programmed in assembler and IMHO it'll be hard to hack them to communicate to the main-cpu or do the closed loop PID control by themselves.

I've used hall-sensors to "upgrade" sensorless BLDC motors. Maybe with the right hall sensors it is possible to implement some kind of encoder.
If not, it is a way to reverse direction in a safe and reliable way.

Three sensors with bipolar output x 14 magnets.
It's beyond my knowledge, how many differential signals per rev this would actually make. But what's good enough for camera gimbals should also work for closed loop printers. Especially when we combine it with the external optical mouse sensor/encoder.

Edited 1 time(s). Last edit at 01/14/2017 12:49PM by o_lampe.
Sorry, only registered users may post in this forum.

Click here to login