Unicorn Servo Reversed?

23 views
Skip to first unread message

Derek Tsan

unread,
Oct 14, 2010, 2:31:24 AM10/14/10
to MakerBot Unicorn
Originally posted this in the MakerBot Operators group, but I just
realized this group exists! Seems much more appropriate here.

I just got my all-printed Unicorn plotter put together, but it seems
that the up and down commands are reversed. I'm using a TowerPro
SG5010 standard servo instead of the Hitec HS-311 so I'm thinking
maybe the directions are reversed? I can't find the datasheet to
confirm this.

If anyone has a Unicorn working properly could you please help me
confirm the following behaviour?

-When turning on the motherboard, the servo turns clockwise
approximately 60 degrees (lifting the pen upwards)
-When starting a build, the servo also turns clockwise, lifting the
pen to the highest position. This sort of makes sense to me, that at
the start you would want the pen to be in the highest position as a
reference point, so that there is room for the pen to travel
downwards.
-When plotting, the pen moves downwards when going to a new line,
drawing a line across the paper where there shouldn't be one,
indicating that the up and down directions are reversed.

So can anyone tell me if all of my directions are reversed or just
during plotting? If everything is reversed I'll probably just print a
mirrored version of the Unicorn and use the same servo. If it is just
during plotting, is there any way to invert the signal from the
extruder controller?

Thanks!
Derek

Matt G

unread,
Oct 14, 2010, 8:08:17 AM10/14/10
to MakerBot Unicorn
Hmmmm, this doesn't sound right. Turning on the motherboard should not
effect the Unicorn servo unless a M300 command is issued as gcode.
Also, the adjustment between the two placements is only about 10º of
difference. Take a look at the gcode you are attempting to print --
share the first chunk with a few M300 commands with us to here just in
case the up and down are reversed or the gcode is missing steps.

First things first, try unplugging the Unicorn servo from the D9
patching point on the extruder board and make sure you have the cable
aligned like the picture below:
http://www.flickr.com/photos/makerbot/4885966089/
Will's note about this: "Now connect that servo to D9 on the extruder
controller. Make sure the yellow wire is on the side labeled D9."

Check also to make sure that the arm attached to the front of the
servo looks like this:
http://www.flickr.com/photos/makerbot/4885956023/
If you have the servo assembly reversed (I'm not sure if that is
possible) then the Unicorn could be behaving "properly" to reverse up
and down.

Then, for good measure, firmware flash the extruder board again to
make sure it has MakerBot Unicorn firmware.

Once you have done this, try this tiny piece of drop in gcode. First
raise your z-platform perhaps 10mm so the pen isn't in contact with
the drawing surface. Turn the assembly attached right to the front of
the servo to all the way counter-clockwise so that the carriage has
been lowered as far as is possible. Zero all of your axes in the jog
controls section just for good measure.

Here is a gcode snippet to try:

M300 S40 (pen down)
G4 P300 (wait 300ms)
M18 (disengage drives)
M01 (Please manually lower the z-stage until the tip of the Unicorn
pen just touches the writing surface. Is this process complete?)
M17 (engage drives)
G4 P300 (wait 300ms)
M300 S50 (pen up)
M01 (Is the pen about 1mm above the writing surface?)
G4 P300 (wait 300ms)
M300 S40 (pen down)
M01 (Is the pen now touching the writing surface?)
G4 P300 (wait 300ms)
M300 S50 (pen up)
M18 (disengage stepper motor drives)


So each of those M01 commands should provide a machine halt for you to
check status for pen height before clicking "yes" to continue. Note
that the M18 before the z-stage adjustment is key so that you can
manually make changes to turn the z-motor pulley or tip of z-rod to
lower the stage. If the behavior is still reversed after this test,
perhaps the polarity of the servo is reversed. If this does work to
get the pen in the right alignment, you might want to consider taking
a look at the print-to-pad Unicorn logo (http://www.thingiverse.com/
thing:4262). The revised context.py script can help you add the gcode
commands to check pen placement and registration before starting a
print.

Thanks,
Matt

Derek Tsan

unread,
Oct 14, 2010, 5:13:30 PM10/14/10
to MakerBot Unicorn
Thanks for the suggestions, Matt!

I'm not at the bot right now, but I can tell you that I am 100%
positive it is installed and hooked up correctly. I have flashed the
Unicorn firmware to the extruder controller several times (all of
which were successful) with the same results. Just curious, does it
matter which driver is selected in ReplicatorG 19? It does look like
the pen is moving up and down the correct amount (only backwards)
during plotting, but it is strange that it moves clockwise so far when
turning on the motherboard, and at the start of a build--as you say
this is not normal.

I still wonder if maybe my servo is incompatible? The specs are below
(from the TowerPro website), but they also seem to vary slightly all
over the internet! It is a cheap servo from China anyway...one site
indicated that it is a digital servo whereas the Hitec HS-311 is
analog, but I'm not sure this should make a difference.

SG5010 weight- 38g
Dimension 40.2*20.2*43.2mm
Stall torque 5.5kg/cm(4.8V); 6.5kg/cm(6V);
Operating speed 0.2sec/60degree(4.8v); 0.16sec/60degree(6v)
Operating voltage 4.8-6V
Temperature range 0℃_ 55℃
Dead band width 10us

I'll post my results when I get a chance to try the rest of your
suggestions. I did try plotting the QR code file that was included in
the gitHub repository. So far I have only tried using plotterize.py
and not scribbles.

Thanks for your help!
Derek

Marty McGuire

unread,
Oct 14, 2010, 5:40:51 PM10/14/10
to makerbot...@googlegroups.com
I'm trying out the printable Unicorn, as well, using a random servo that I had lying around, a Hextronik HX5010.

I had this same issue using the default M300 code values of S30/S40.  When the servo first tried to move "down", it actually rotated clockwise, far enough to torque the printable slide and pop off one of the rails. :)

I'm still waiting for the epoxy to harden on the repaired rail, but I believe that these work for me:

M300 S110 (pen up)
M300 S140 (pen down)

I found these numbers by copying them out of the Unicorn logo gcode file and coming up with this really simple G-Code:

M300 S140 (pen down)
G4 P1000 (wait 1s)
M300 S110 (pen up)
M18 (drives off)

Starting with the servo linkage *unhooked*, I played with the Sxxx numbers (range of 0-180) until they looked right, then hooked up the linkage and tweaked them a bit more until I was happy with how things were working.

Once you find a set of numbers that work well for you, you can update the G-Code files by hand, via your own scripts, or by re-generating them after editing the Unicorn scripts (e.g. scribbles/context.py for scribbles, plotterize.py for plotterize).

These scripts could stand to be cleaned up so those numbers are more easily configurable for folks using non-standard servos. I might give it a shot once I get my punicorn (printed unicorn) working and convince myself that I'm not going to muck anything up. :)

Thanks,
Marty

Matt Griffin

unread,
Oct 14, 2010, 7:09:16 PM10/14/10
to makerbot...@googlegroups.com
You should be using the Unicorn driver in RepG 19. I believe that is the only driver that handles the D9 and d10 accessory tool control ports on the extruder board properly (but I could be wrong). Let's at least choose that for testing to eliminate one element.
 
Whoa! I'm just recognizing that there seem to be loads of values assigned for the angle of the servo here. This is a disaster if we are going to share gcode on Thingiverse of plots/drawings! The values called by the gcode are not relative, as far as I know. 
 
The M300 device call rotates the tool (in this case, the servo) to position S[angle].
 
There is one crucial stage that might not have seemed crucial. When you are assembling the tool, the most important direction on that sheet is: "Go ahead and attach the servo horn assembly to the servo's horn. Rotate the servo all the way counter-clockwise." The reason being that the gcode designs will call a specific angle -- so if your Unicorn is not calibrated like the others, you actually can't match your pen controls to other people's documents.
 
The good news is that even if you start your servo in a random place, you can take everything off, calibrate your settings, and reattach everything. I'd suggest leaving just the servo assembly with some pencil marks so you can track placement.
 
Use the M01 (machine halt) commands to interrupt the movement at each use position so you can see what happens. Take a look at gcode for any of the designs and check to see what S values are ascribed to double check.
 
Could you folks getting reverse pen action check to see the resulting position for the servo calls you are using? Values like S140 are in an entirely different quadrant of rotation!
 
In the future, I suspect people will come up with ways to use certain implements with a range of "touches" using specific angles to get a "light touch" etc, but for now it is best that we all at least calibrate the rotation to match Will's model so that we can share drawings!
 
--Matt
--
=================
Matt Griffin
MakerBot Industries
gri...@makerbot.com
cell, 917-975-1213
=================

Marty McGuire

unread,
Oct 14, 2010, 7:41:47 PM10/14/10
to makerbot...@googlegroups.com
Hey Matt,

I made sure to crank the servo all the way counter-clockwise.  It makes sense to do so, otherwise the pen might not be able to lift at all! :)

The difference for my punicorn seems to be that this servo operates backwards relative to the expected angles in RepG.  In other words, 180º is all-the-way-counter-clockwise and 0º is all-the-way-clockwise.  I've double-checked that I'm running the unicorn firmware to be sure I'm not crazy, and this behavior is unchanged.

donutman and I have gone a bit rogue by building our own, printed, unicorns out of printed parts and "whatever servos we have laying around."  It's not surprising we'd end up with servos that are "wrong-handed" relative to those sold in the kit.

Unfortunately, this is not something that can be calibrated away.  The community-friendly thing for us to do is replace our servos with "correct-handed" ones.  For now, I am happy to modify scripts/gcode by hand. :)

--Marty

Matt Griffin

unread,
Oct 14, 2010, 9:12:14 PM10/14/10
to makerbot...@googlegroups.com
Hmmm, well creating a python script that translates between "standard" S settings and ones that you find work well for your bot would be a temporary solve, right? Please make some prints and share them so we can see your unicorn working!

I wonder how the 3-pin d9 port works -- whether you could flip the connects (or re-order them through patching) so that can approximate the Unicorn servos. 

Matt

Derek Tsan

unread,
Oct 14, 2010, 9:16:11 PM10/14/10
to MakerBot Unicorn
Hmm...I'm using RepG 19 but I don't have a Unicorn driver, only
simulator and the various cupcake combos. Is this something I am
supposed to add in machines.xml or something?

Thanks,
Derek
> Matt ...
>
> read more »

Derek Tsan

unread,
Oct 14, 2010, 9:35:53 PM10/14/10
to MakerBot Unicorn
I don't think you can flip the d9 pins around. The servo pins are
signal (yellow), power (red), and ground (black/brown). The signal
input goes through some circuitry that interprets the signal and
passes commands to the motor. The only way to reverse the signal would
be to open up the servo and swap the motor connectors around. Seems to
me like the simplest solution would be to print a left-handed unicorn
with the servo mount on the other side, and mount the holder with the
servo rotated all the way clockwise. Then the angles should all be the
same right?

Derek

On Oct 14, 6:12 pm, Matt Griffin <grif...@makerbot.com> wrote:
> Hmmm, well creating a python script that translates between "standard" S
> settings and ones that you find work well for your bot would be a temporary
> solve, right? Please make some prints and share them so we can see your
> unicorn working!
>
> I wonder how the 3-pin d9 port works -- whether you could flip the connects
> (or re-order them through patching) so that can approximate the Unicorn
> servos.
>
> Matt
>
> On Thu, Oct 14, 2010 at 7:41 PM, Marty McGuire <schmartiss...@gmail.com>wrote:
>
>
>
> > Hey Matt,
>
> > I made sure to crank the servo all the way counter-clockwise.  It makes
> > sense to do so, otherwise the pen might not be able to lift at all! :)
>
> > The difference for my punicorn seems to be that this servo operates
> > backwards relative to the expected angles in RepG.  In other words, 180º is
> > all-the-way-counter-clockwise and 0º is all-the-way-clockwise.  I've
> > double-checked that I'm running the unicorn firmware to be sure I'm not
> > crazy, and this behavior is unchanged.
>
> > donutman and I have gone a bit rogue by building our own, printed, unicorns
> > out of printed parts and "whatever servos we have laying around."  It's not
> > surprising we'd end up with servos that are "wrong-handed" relative to those
> > sold in the kit.
>
> > Unfortunately, this is not something that can be calibrated away.  The
> > community-friendly thing for us to do is replace our servos with
> > "correct-handed" ones.  For now, I am happy to modify scripts/gcode by hand.
> > :)
>
> > --Marty
>
> ...
>
> read more »

TeamTeamUSA

unread,
Oct 15, 2010, 1:20:50 AM10/15/10
to MakerBot Unicorn
An enhancement to the Unicorn-compatible firmware would be to allow
flipping of the servo "handedness," similar to the way the XYZ axes
can be flipped for 3D printing.
This would accommodate all servos, given that this is the only way
Unicorn-compatible servos differ. Is it‽

Go!

=ml=
> > >>>> > M18 (disengage drives)...
>
> read more »
Reply all
Reply to author
Forward
0 new messages