Welcome! Log In Create A New Profile

Advanced

Servolulu: Polulu-compatible servo motor driver

Posted by LoboCNC 
Servolulu: Polulu-compatible servo motor driver
April 19, 2016 01:33PM
I've made some progress on the Polulu-compatible servo motor driver that I proposed in an earlier post. I'm calling it the Servolulu. It consists of a PIC18F2331 microcontroller, which has a quadrature encoder interface, and an A4953 (2 amp) motor driver chip. The processor is loaded with PIC-SERVO controller code which provides PID servo control with Step & Direction command signals. It all fits in the same footprint as a standard Polulu driver, and the relevant signals (Vmot, +5v, Gnd, M+, M-, Step, Direction, Enable) all pass though to the Servolulu board from the printer controller board below. (The first photo shows a Servolulu plugged into a Teensylu board.) The unused pins (MS1, MS2, MS3, RST, SLP and 2 unused motor pins) are clipped from the bottom side that plugs into the printer board (see last photo) but are extended on the top to give you a place to plug in your encoder, a TTL-level serial port (for programming gain parameters into EEPROM) and also a couple of pins (PGD, PGC) for flashing the micro. Unfortunately, the PIC-SERVO assembly code I'm using to test this is proprietary so I can't publish it. However, I am planning on writing a stripped down version written in C that will be open-source. Also, once I get the design documented and posted somewhere, anyone else will also be able to write their own servo control code.

With servo control, you can generally run cooler, quieter, and at higher speeds without fear of losing steps. And with the serial port, it is also possible to monitor the servo performance in real-time while moving - a feature that can be used to detect end-stop collisions, jammed filament and even running out of filament. Please let me know what you think and if you'd like to see this go into some sort of production.

Edited 1 time(s). Last edit at 04/19/2016 01:36PM by LoboCNC.
Attachments:
open | download - servolulu1.jpg (224.1 KB)
open | download - servolulu2.jpg (193.3 KB)
open | download - servolulu3.jpg (129.1 KB)
open | download - servolulu4.jpg (140.2 KB)
Re: Servolulu: Polulu-compatible servo motor driver
April 19, 2016 01:57PM
What sort of motors/encoders are compatible?

Does it use standard step/direction input from the controller, or is custom firmware required?

Edited 1 time(s). Last edit at 04/19/2016 01:58PM by the_digital_dentist.


Ultra MegaMax Dominator 3D printer: [drmrehorst.blogspot.com]
Re: Servolulu: Polulu-compatible servo motor driver
April 19, 2016 02:32PM
Quote
the_digital_dentist
What sort of motors/encoders are compatible?

Does it use standard step/direction input from the controller, or is custom firmware required?

The encoder counter expects TTL level quadrature inputs (standard A/B signals) and can count encoder transitions up to 2MHz. The motor driver is for brush-type motors and is rated for 8-40v, 2A continuous current (6A peak). Mabuchi now makes some very low-cost (see aliexpress.com) DC motors with encoders that would be a good match for many 3D printers.

I've tested it with standard Step/Direction signals (I'm using Marlin) which works fine. If you exceed the programmable servo position error (ie, you hit a hard stop or maybe your filament is jammed), the servo will be disabled and the signal on the AOUT pin will go HIGH. This signal could be connected directly to an e-stop input, which wouldn't require any firmware mods.

Things could get more interesting, however, if you wanted to add some firmware mods to monitor the servo position error thru the serial port. In particular, you could monitor the state of the extruder servo and alter print speed if your extruder is starting to require too much torque.
VDX
Re: Servolulu: Polulu-compatible servo motor driver
April 19, 2016 03:02PM
... count me in for the first batch - I'm interested to test them and compare to the mini-UHU's I'm using vor mirror-scanning grinning smiley


Viktor
--------
Aufruf zum Projekt "Müll-freie Meere" - [reprap.org] -- Deutsche Facebook-Gruppe - [www.facebook.com]

Call for the project "garbage-free seas" - [reprap.org]
Re: Servolulu: Polulu-compatible servo motor driver
April 19, 2016 05:23PM
This looks awesome! I can't wait to test it!

Suggestion: Correct me if I'm wrong, but at the moment it has a brushed motor controller built in, right? An option to remove the DC motor controller, and just expose a single PWM wire for motor speed, might be nice. This would allow people to use e.g. hobby-style brushless ESCs and motors, or boards with multiple motor controllers in one.
Re: Servolulu: Polulu-compatible servo motor driver
April 19, 2016 05:42PM
Looks great! The packaging looks very clean. I can already think of a few projects where I could use this.

A question about the name: The stepper driver boards are named after Pololu, not Polulu. So wouldn't that make your board a Servololu instead of a Servolulu? winking smiley
Re: Servolulu: Polulu-compatible servo motor driver
April 19, 2016 06:28PM
Quote
MattMoses
A question about the name: The stepper driver boards are named after Pololu, not Polulu. So wouldn't that make your board a Servololu instead of a Servolulu? winking smiley

The answer is that I'm blind. I've seen "Pololu" written thousands of times, but never registered it as any thing but "Polulu" - I guess that's how it wanted to roll off my mind's tongue. For this rev. of the board at least, we'll just say I chose a different name to avoid any whiff of copyright infringement.smiling smiley
Re: Servolulu: Polulu-compatible servo motor driver
April 19, 2016 06:44PM
Looks fantastic!
Re: Servolulu: Polulu-compatible servo motor driver
April 19, 2016 08:13PM
Quote
epicepee
Suggestion: Correct me if I'm wrong, but at the moment it has a brushed motor controller built in, right? An option to remove the DC motor controller, and just expose a single PWM wire for motor speed, might be nice. This would allow people to use e.g. hobby-style brushless ESCs and motors, or boards with multiple motor controllers in one.

Can you explain a little bet more what you are thinking about? Do you want to go from Step & Direction to a speed command? Closed loop or open loop?
Re: Servolulu: Polulu-compatible servo motor driver
April 20, 2016 10:58AM
I think he is just asking that the PWM wire that is use to drive the brushed motor controller be "broken out" so that an external motor controller can be used.
Perhaps a jumper could be used to select onboard/external if required to properly drive the onboard (PWM) vs. external (servo signal) controllers.
Re: Servolulu: Polulu-compatible servo motor driver
April 20, 2016 11:17AM
Quote
jonnycowboy
I think he is just asking that the PWM wire that is use to drive the brushed motor controller be "broken out" so that an external motor controller can be used.
Perhaps a jumper could be used to select onboard/external if required to properly drive the onboard (PWM) vs. external (servo signal) controllers.
Oh, I see, when epicepee mentioned "PWM wire for motor speed", I thought he was wanting to do speed control rather than position control of the motor. It's actually a little more complicated that just breaking out the PWM signal because the PWM signals for a servo amplifier are different from the RC-type PWM signals used by ESC drivers. Also, it's not quite clear if or how you can do position control with an ESC controller for brushless motors. ESC controllers requires some minimum motor speed in order to perform the brushless motor commutation and when doing position control of motors, they are often operated at zero velocity.
Re: Servolulu: Polulu-compatible servo motor driver
April 21, 2016 01:05AM
Quote
LoboCNC
[the PWM signals for a servo amplifier are different from the RC-type PWM signals used by ESC drivers.

That makes sense. I suspect a simple adapter could be used, though. Or we could just use an open-source ESC like VESC or Open-BLDC and adapt it for use with the different signal.

Quote
LoboCNC
Also, it's not quite clear if or how you can do position control with an ESC controller for brushless motors. ESC controllers requires some minimum motor speed in order to perform the brushless motor commutation and when doing position control of motors, they are often operated at zero velocity.

True, most sensorless ESCs wouldn't work by themselves. So, we could use a sensored ESC (perhaps hooked to the same sensor as the Servolulu), or rig something up that would e.g. detect winding saturation or use high-speed, tiny vibrations to keep track of position. Or even drive it like a stepper motor at low speed.

Or, once again, we could use a separate brushed motor controller, which would act about the same as a Servolulu by itself but could handle e.g. higher currents or voltages.

Edited 1 time(s). Last edit at 04/21/2016 01:07AM by epicepee.
Re: Servolulu: Polulu-compatible servo motor driver
April 21, 2016 06:52AM
Any idea what the unit price is likely to be?
Re: Servolulu: Polulu-compatible servo motor driver
April 21, 2016 10:45AM
Quote
JamesK
Any idea what the unit price is likely to be?

Good question. The component pricing for the Servolulu is ~$2-$3 more than for a standard Pololu driver, so throwing in a profit margin, a high-volume production price might be $10 for the Servolulu vs. $6 for the standard Pololu. However, If I were to go to some PCB assembly shop in the US and get, say, 200 made, They'd probably cost me about $15 ea and I'd have to sell them for $20-$25 to make it worth doing.

In the broader scope of things, even $25 for a servo controller is really (really) cheap. However, if you are replacing a $6 Pololu driver (or $3 clone) with a servo driver that most people don't really understand the advantage of, $25 is a tough sell.

If I were ambitious (which I'm not), I could do a Kickstarter project, get pre-orders for a few thousand, and get the price down closer to $10. The better bet would be to approach Pololu (who could then rename the product the Servololu) and have them develop it as a product. In fact, I did contact them a couple of days ago - I'm waiting to hear back.

Edited 1 time(s). Last edit at 04/21/2016 10:46AM by LoboCNC.
Re: Servolulu: Polulu-compatible servo motor driver
April 21, 2016 11:19AM
PCB Assembly in the states is getting cheaper.. If the design is done could we try getting it done here: [pcb.ng]
Re: Servolulu: Polulu-compatible servo motor driver
April 21, 2016 11:22AM
Are the schematics available?
Re: Servolulu: Polulu-compatible servo motor driver
April 21, 2016 11:58AM
Here's the Eagle schematic and board layout. As you can see, not much there - just the PIC-SERVO chip (a PIC18F2331), A4953 driver chip, 2 capacitors, 1 resistor and 1 diode. (I still have to get the complete part list together.) The header pin strips are actually the most annoying thing - hard to find ones with long tails. I ended up getting some from adafruit - not the cheapest source... I may still have to add a 1Mohm resistor in parallel with the resonator - I'm having trouble getting the PIC's oscillator to start up reliably.

jonnycowboy - it'd be interesting to try PCB:NG - assembling these boards by hand is a little tricky and not much fun.
Attachments:
open | download - servolulu.sch (416.7 KB)
open | download - servolulu.brd (71 KB)
VDX
Re: Servolulu: Polulu-compatible servo motor driver
April 21, 2016 01:00PM
... will you share the PIC program too?


Viktor
--------
Aufruf zum Projekt "Müll-freie Meere" - [reprap.org] -- Deutsche Facebook-Gruppe - [www.facebook.com]

Call for the project "garbage-free seas" - [reprap.org]
Re: Servolulu: Polulu-compatible servo motor driver
April 21, 2016 02:44PM
Quote
VDX
... will you share the PIC program too?

The PIC code issue is a little complicated. I wrote the basic PIC-SERVO code more than 20 years ago, turned it into a product line, made enough money to be comfortable and have since sold the company (which is still selling PIC-SERVOs). I have rights to make derivatives for my own use, but I'm not at liberty to release the code. Also, the code is incredibly tightly written in assembly, so hacking on it is difficult to impossible. My plan is to write a stripped down version of the code in C and make that open-source. By stripped down, I mean PID servo with Step & Direction command interface, and basic serial port support for setting gains and monitoring performance. The standard PIC-SERVO code has a ton of extra stuff not needed for replacing a simple stepper driver.
VDX
Re: Servolulu: Polulu-compatible servo motor driver
April 21, 2016 02:58PM
... I have a simple but pretty time-critical aplication, where I'm using Encoders for controlling a servo an syncing a laser-driver with up to 100kHz pulsing rates, but with up to 2MHz "time-resolution" for defining the pulse-widths.

The prototype runs good with 50kHz and standard Arduino-code on a Due, but for the faster drivers I'll have to optimize the code and bit controlling by hand ... so a faster encoder/servo-driver would be handy winking smiley


Viktor
--------
Aufruf zum Projekt "Müll-freie Meere" - [reprap.org] -- Deutsche Facebook-Gruppe - [www.facebook.com]

Call for the project "garbage-free seas" - [reprap.org]
Re: Servolulu: Polulu-compatible servo motor driver
April 21, 2016 04:25PM
I'm going to try getting these done on PCB.NG ... let me know via PM or here what the part numbers are and I'd be happy to finance the first round smiling smiley
Re: Servolulu: Polulu-compatible servo motor driver
April 26, 2016 12:57PM
Here's a short youtube video of a MOD-t printer I retrofit with a Teensylu board and 4 Servolulu modules. The MOD-t uses servo motors and has a custom controller board and software - I wanted to open it up and use it with Marlin firmware. (I've also attached photos of a couple of test prints.) I'm using a 19v laptop supply and I did have to replace the 7805 voltage regulator with a 5v Murata swithing regulator because the Servolulu boards and motor encoders (all supplied with 5v) made the linear regulator overheat. I also had to cut the USB 5v trace so that it wasn't trying to suck too much power from the USB port. Lastly, the MOD-t has a great whopping blower inside and I discovered that the Teensylu board's fan driver didn't have an inductive kickback protection diode. I still have to replace the fan MOSFET that blew out and add a diode.
Attachments:
open | download - mod-t_mod.jpg (177.1 KB)
open | download - nm_logo.jpg (461.3 KB)
open | download - testprint.jpg (413.1 KB)
Re: Servolulu: Polulu-compatible servo motor driver
April 27, 2016 10:11AM
Awesome work!
those prints look nigh-on perfect (or perfect with respect to any normal stepper issues).

I'm still working on the BOM to get components that PCB NG can source and print, will keep you all posted.
Re: Servolulu: Polulu-compatible servo motor driver
April 30, 2016 05:21PM
If someone wants to make similar DC servo step/dir control using arduino (atmega and even attiny) or esp8266: [www.youmagine.com]
Source code is freely available: [github.com]
an3
Re: Servolulu: Polulu-compatible servo motor driver
May 01, 2016 07:24AM
i would love to also buy one of these, but until you sort out the firmware issues, perhaps some more printing videos would be very entertaining to watch while we wait....

hehe, i dont mean to impose more work on you, but i do love the idea, and being very curious myself, i would love to see more.

i also thought of doing the exact same thing, and if you dont get a product in the wild before i do, i might even manage to build one myself. though i am not a fan of smd prototypes, so i will probably just jump over with some rainbow cable to another arduino with a couple of h bridges.

its an awesome thought, though.
Re: Servolulu: Polulu-compatible servo motor driver
May 01, 2016 07:03PM
Some boards not only tie the reset and sleep pins together but also connect them directly to V+, so they may not be able to use the Servolulu. Can you rearrange the board to accommodate this type of board? Cramps is one such board. Since it is based on Ramps, there must be more like it.
Re: Servolulu: Polulu-compatible servo motor driver
May 01, 2016 07:26PM
Quote
etfrench
Some boards not only tie the reset and sleep pins together but also connect them directly to V+, so they may not be able to use the Servolulu. Can you rearrange the board to accommodate this type of board? Cramps is one such board. Since it is based on Ramps, there must be more like it.

This shouldn't be a problem. The unused pins on the standard Pololu (MS1, MS2, MS3, Reset, Sleep, 1A and 1cool smiley are clipped off on the side going to the printer controller board (bottom), so it doesn't really matter how they are connected on the printer controller board. Those pins are then actually re-used for other purposes on the top side of the Servolulu board.
Re: Servolulu: Polulu-compatible servo motor driver
May 02, 2016 04:40AM
I'm working on something similar.
Currently I have working code for ATtiny85 (see [github.com]).
I got Miguel's code for PID tuning, tuned 3 motors from old inkjets, used their encoders and encoder strips and I am re-purposing the ToyRep with closed loop now winking smiley
The encoding strip is mounted similarly to standard inkjet, the positioninig accuracy (reading) is 0.044mm, but the motor driver can overshoot by as much as 7 impulses on very fast movements for now (have to tweek it a bit better).
But when using slow movements (feedrate 9999 and below), I got very precise, quiet and nice positioning.
X axe done, Y to follow.
I also plan to re-purpose the paper feeder encoder and DC motor for an extruder - but that's gonna be a bit more work. However, Miguel Sanchez (check his youtube channel) already made DC servo out of cheap continous servo with replaced encoder (moved to magnetics) and it works. I have a torque problem for now, so I am progressing a bit slower than he is.
The best thing here is - the motor, encoder, strip and even the belt tensioning is re-purposed from old ink-jets I got for free. My whole investment is the 2 ATtinys (and arduino for initial PID investigation) and a TB6612FNG I got from China for ~$1.5.
Re: Servolulu: Polulu-compatible servo motor driver
May 02, 2016 11:41AM
Quote
rklauco
I'm working on something similar.
Currently I have working code for ATtiny85 (see [github.com]).
I got Miguel's code for PID tuning, tuned 3 motors from old inkjets, used their encoders and encoder strips and I am re-purposing the ToyRep with closed loop now winking smiley
The encoding strip is mounted similarly to standard inkjet, the positioninig accuracy (reading) is 0.044mm, but the motor driver can overshoot by as much as 7 impulses on very fast movements for now (have to tweek it a bit better).
But when using slow movements (feedrate 9999 and below), I got very precise, quiet and nice positioning.
X axe done, Y to follow.
I also plan to re-purpose the paper feeder encoder and DC motor for an extruder - but that's gonna be a bit more work. However, Miguel Sanchez (check his youtube channel) already made DC servo out of cheap continous servo with replaced encoder (moved to magnetics) and it works. I have a torque problem for now, so I am progressing a bit slower than he is.
The best thing here is - the motor, encoder, strip and even the belt tensioning is re-purposed from old ink-jets I got for free. My whole investment is the 2 ATtinys (and arduino for initial PID investigation) and a TB6612FNG I got from China for ~$1.5.

This looks very cool. More encoders are showing up with I2C which really opens up the options for micros. The Servolulu uses a PIC18F2331 because it has a high-speed quadrature encoder counter.
Re: Servolulu: Polulu-compatible servo motor driver
May 02, 2016 01:25PM
One more question, are you planning on using 2 oz boards? The traces seem kind of small for 2 amps with a 1 oz board.
Sorry, only registered users may post in this forum.

Click here to login