Eggbot redrawn

by jsc, published

Eggbot redrawn by jsc May 23, 2015
22 Share
Download All Files

Thing Apps Enabled

Order This Printed View All Apps




Use This Project

Give a Shout Out

If you print this Thing and display it in public proudly give attribution by printing and displaying this tag.

Print Thing Tag

Thing Statistics

27680Views 4546Downloads Found in Robotics


I wanted to make a few modifications to nglasson's eggbot for my own build. As a first step, I've redrawn it in Fusion 360 because I don't like working in Sketchup (sorry Sketchup fans), and Fusion's STL output is of higher fidelity. This model is mostly faithful to the original, except I've modified a few screw sizes to fix interference. I've also added the steppers, servo, and all hardware to the model assembly to help in ordering parts.

Update: v2 has a few updates and fixes:

  • The pen arm shaft coupler axle hole has been resized to fit the axle on my stepper motor (5mm around, flat face inset .5mm, .1mm outside clearance).
  • The outer bearing holder has been integrated into the right end plate. The idler must now be on the right, unless you mirror this, but now you can replace four long screws with one medium one. This should be printed flat side down with support for the bearing hole.
  • The inner bearing hole in the end plate has been shrunk from 24mm to 22mm to fit properly.
  • The slot for the brace attachment has been changed to a hole, and the right brace modified to match up.

Update: v3 now contains a pen linkage spring. I attached one end to the servo horn with a twist of wire. Also added an Arduino holder with standoffs for screws (M3x8 or #4 1/4").

BOM now under Instructions.

Video: https://www.youtube.com/watch?v=WwdGjqfIo0U


Hardware required:

7 M3x10 screws for all but one screw of the motor mounts.
2 M3x14 screws for top screw hole on brace arms.
1 M3x20 screw for pen arm linkage spring
2 M3x8 screws as set screws for stepper motors shafts
3 more M3x8 if you want to mount an Arduino UNO to the rods (there are four standoffs, but one is unusable because of clearance issues)
3 M3 nuts
10 M3 washers
2 M4x10 screws to attach pen arm pivot to pen arm shaft coupler
1 M4x35 screw as pen arm hinge
1 M4x16 as pen set screw
2 M4 washers
4 M4 nuts
22 M8 nuts to position everything on the rods; two go on both ends of the idler rod
3 M8x300 threaded rods
1 M8x100 threaded rod for the idler
1 spring for the idler, ID slightly larger than 8mm
2 608ZZ bearings
2 NEMA 17 stepper motors
1 9g micro servo
2 silicone o-rings, 1/2" ID 3/4" OD 1/8" width

All screws, nuts, and washers can be bought in odd lots at boltdepot.com. I recommend adafruit.com for the motors and servo, and Amazon for the bearings. Threaded rod can be bought from mcmaster.com.

For the electronics, I used an Arduino Uno with the Adafruit Motor Shield. I had to make some major edits to the SphereBot firmware to get everything to work correctly. Modified firmware here, you will also need the Adafruit motor shield library.

I had occasion recently to write up some explicit instructions on how to get going with my exact setup, here it is:

Installing firmware:

Get the Arduino IDE from https://www.arduino.cc/en/Main/Software.
Get the firmware from https://github.com/jinschoi/SphereBot (download ZIP button)
Open up SphereBot.ino with the IDE.
a. Under Tools, ensure Board is set to “Arduino/Genuino Uno” and Port is set to the proper serial port.
b. Under Sketch, Include Library, Manage Libraries…, search for adafruit motor shield v2, and make sure it is installed.
Plug the USB cable to your hardware and upload the firmware using the right arrow button.
Verify that it is working:

Click the serial monitor button in the upper right of the IDE.
Make sure you have “Newline” and "115200 baud” selected in the lower right drop downs.

Type “G0 X1600” into the top field. The egg motor should spin 180 degrees with the side facing you traveling down (counter clockwise looking at the face of the motor).
Type “G0 X0”, it should rotate back to the starting position.

Manually center the pen arm.
Type “G1 Y480”. The pen arm should travel counter clockwise (to your left) to its limit. Make sure it’s not hitting anything.
Type “G1 Y-480”, the pen arm should now swing all the way to the right. Again, make sure it isn’t hitting anything.
If your motors are not moving in these directions, it is okay as long as they are BOTH moving in the “wrong” direction. Otherwise, everything will come out backwards. If they are moving as described above, UP is to the left, towards the motor. If only one axis is not moving as above, then you need to flip the wires for that axis.

Recenter the arm with “G1 Y0”, then enter “M300 S100”. That will lift the pen to the top of its default travel.
Enter “M300 S115”, that should gently lower the pen a little bit.
“M300 S100” should pop the pen back up quickly.
Mount an egg and pen, and lower it slowly using M300 commands until the pen is close to but not touching the egg. When the egg rotates, it can vary a little bit, so you don’t want to be too close, but you want to minimize the gap. This should be your default pen up position. Then slowly lower the arm until it contacts the egg, and add a little extra to apply some pressure. That will be your pen down position.
Set your pen up position using M303 Pxxx, M500.
The pen is clamped to values from 100 to 130 by default. If you need to extend these, you can use “M301 Pxx” to decrease the pen up value and “M302 Pxxx” to increase the pen down value. M500 to save the results for the future.

Download Inkscape: https://inkscape.org/en/download/
Get my version of the inkscape-unicorn plugin: https://github.com/jinschoi/inkscape-unicorn
Install it by copying the CONTENTS of src/ to the inkscape extensions folder (so the extensions directory should contain unicorn.inx, unicorn.py, and the unicorn directory).
Run Inkscape, start a new document. Under File, Document Properties, Page, set a custom size of 3200 width, 800 height in units px (or load up a downloaded SVG for the eggbot that has that size).
Under File, Save As, select MakerBot Unicorn G-Code, click Save.
In the following dialog, double check all the settings:
Setup: Pen up and pen down angles should be correct for you. Delay after pen up and pen down I have set to 100. XY feedrate 300, Z-axis is irrelevant.
Pen Registration Check: turn off
Homing: 0, 0
Copies: 1
Pen Changes: turn on pause on layer changes
Send the gcode file using Utils/gcode-sender.rb from my firmware project.
Gcode Sender
If you are on Linux or Mac OS X:

sudo gem install serialport (you may need to install some developer tools to get this to work)
chmod 755 /path-to-gcode-sender/gcode-sender.rb
/path-to-gcode-sender/gcode-sender.rb my-file.gcode
If you are on Windows:

Install the latest ruby using Rubyinstaller: http://rubyinstaller.org/downloads/ (make sure you use the right one: x64 for 64-bit, not-x64 for 32-bit).
Down below on that page, also get the correct DevKit-mingw for the Ruby you installed and 32 or 64-bit. Unpack it into its own directory somewhere.
Open a command window, go to the directory you unpacked devkit, run devkitvars.bat.
In that same window, run “gem install serialport”
Edit the gcode-sender.rb file with a text editor to change the port variable at the top to COM3 (or whatever).
Go to the directory with your gcode file. Run “ruby \path\to\gcode-sender.rb myfile.gcode”
You only have to do steps 2-4 once.

It will pause when it hits M0, which the Inkscape gcode plugin should insert before every layer to let you switch pens. Hit return to continue.

More from Robotics

view more

All Apps

3D Print your file with 3D Hubs, the world’s largest online marketplace for 3D printing services.

App Info Launch App

Auto-magically prepare your 3D models for 3D printing. A cloud based 3D models Preparing and Healing solution for 3D Printing, MakePrintable provides features for model repairing, wall thickness...

App Info Launch App

Kiri:Moto is an integrated cloud-based slicer and tool-path generator for 3D Printing, CAM / CNC and Laser cutting. *** 3D printing mode provides model slicing and GCode output using built-in...

App Info Launch App
KiriMoto Thing App

With 3D Slash, you can edit 3d models like a stonecutter. A unique interface: as fun as a building game! The perfect tool for non-designers and children to create in 3D.

App Info Launch App

Print through a distributed network of 3D printing enthusiasts from across the US, at a fraction of the cost of the competitors. We want to change the world for the better through technology, an...

App Info Launch App

Quickly Scale, Mirror or Cut your 3D Models

App Info Launch App

3D Print a wide range of designs with Treatstock. Easy to use tools to get the perfect result. The global 3D printing network that connects you with high-quality and fast working print services nea...

App Info Launch App
Apr 12, 2017 - Modified Apr 12, 2017

I've made this project and it work very fine.. until i need to change my computer.
Now it works but every print is resized (about 50%) and it is not centered (it is printed in the upper left part of the egg)
In arduino ide - is ok (pen centered, half rotation, etc) but generated gcode is somehow wrong.
Do you have any ideas?

Update: Problem solved. It was an Inkscape problem. The 0.92 version is not supported by unicorn extension. Going back to 0.91 solved the problem

Hey there, I'm a bit baffled. I'm trying to send some gcode to the bot.
I changed the port in .rb file to the correct port. ( I had errors kicked back before changing it, but now I do't get errors)

I run the following in cmd:

ruby C:\Users\TT\Desktop\SphereBot\Utils\gcode-sender.rb test.gcode

After running that nothing happens, just a new line with a blinking "_" inside of cmd. Any ideas? I have also tried adding the full path to the gcode as well.


It should, at the very least, report "Ready" and pause before the first layer. Have you run through the tests in the instructions where you try to command it through the Arduino IDE console? What did you set the port to? Make sure you disconnect from the console before trying to run the g-code sender, only one process can have the port open at a time.

I followed the set up again on a new machine, and have the exact same results. I can verify that I have the correct COM port list, the Arduino console works fine. I've edited the .rb file to the correct COM and it just returns a blinking cursor. I tried doing it wile connected to the Arduino console and I get an COM errors message, which makes sense since it's already open.

I've tried using "COM20" as well as just the number 19 without "". Looking at the .rb it appears it should display "Read" once COM has been established.

I was able to get this working, I was using a newer Arduino Leonardo as my board, after some research I saw they have a slight difference in serial com protocols. I swapped to an Arduino Uno and all works well.


Great! What, exactly, was the issue with the Leonardo, do you know?

I have no idea, i was reading there was a difference in their serial connection hardware.

Yea, I'm baffled. I can send gcode commands via arduino IDE just fine. I changed the default COM value to what my device manager says which is also what the IDE used. I'm pretty sure i closed out the serial console from the ide. I changed the com to a port i know was incorrect and I get an error just to validate ruby was working. Ill try playinh with it some more today. Thanks

And again, good afternoon. I've been digging for 4 hours and I can not find this file "gcode-sender.rb"
In what folder is it located?

It is in the Utils directory in the firmware project.

You certainly excuse me, but what firmware? and how to send the gcode file using Utils/gcode-sender.rb ?

Please go through the steps in the Thing Details page. There are detailed instructions, including links, for all the software.

The firmware is the thing you were having trouble compiling earlier.

This was all in the eggbot-master folder. I find this folder utils. Where I just did not look for it))))))
Thank you for your patience.

Solved. Update the Arduino and all ok.
Thank you for your excellent work.

SphereBot.ino: In function 'void save_pen_configuration()':
SphereBot:108: error: 'class EEPROMClass' has no member named 'update'
SphereBot:109: error: 'class EEPROMClass' has no member named 'update'
SphereBot:110: error: 'class EEPROMClass' has no member named 'update'
SphereBot.ino: In function 'void clear_pen_configuration()':
SphereBot:117: error: 'class EEPROMClass' has no member named 'update'

Which version of the Arduino IDE are you using? Make sure it's the latest.

Hey. Can tell what to do about it ('class EEPROMclass' has no member named 'update')?

Comments deleted.

hey - nice project!
I read here something about the eggbot with the adafruit Motorshield.
I made the same eggbot with Motorshield V2 (own the V1,too), but I got some problems with the firmware.
Does your firmware works fine? I cant see the instructions in the Thing Details.
My actual firmware is these:
but he swapped the axis - thats bad for the eggbot templates, i think.
Can you please help me?

Thingiverse seems to have destroyed all the existing Instructions tabs! Has anyone else noticed this? I had to recreate it from an archive.org snapshot. Great work, there, thingiverse.

If your axes are swapped, just change the wiring to your motors. X axis should be rotational, Y axis should control the pen arm. The instructions (which I just put back) give you a step by step procedure to verify that everything is working correctly.

Thank you, now all works fine!
Great instructions.

It's ok ! great project and fast support ! but I have problem at pen change... example : layer 1 ok but when I change pen,surely the penarm moves and the printing is wrong...
I'm wrong?
it is possible (firmware or unicorn plugin) reset each layer at a "home" position?

What do you mean by "the pen arm moves and the printing is wrong"? The egg shouldn't be moving anywhere as it is locked by the steppers. If you mean that the second layer is not registered perfectly over the first, make sure the pens you are using are all the same brand/size. Different size pens will contact the egg in different places.

Comments deleted.
Aug 19, 2016 - Modified Aug 19, 2016

i have everything running, but every command i try like the G0 X1600, the motor turns then the power led on the shield dies and i gear that the computer drops the usb connection.

Edit, i can now run all the commands in arduino, but when i try to, ruby gcode-sender.rb i get

Pausing: (Plotting layer 'Layer 1') Press Enter to continue.

gcode-sender.rb:53:in gets': Bad file descriptor @ io_fillbuf - fd:3 (Errno::EBADF) from gcode-sender.rb:53:inblock (2 levels) in '
from gcode-sender.rb:35:in foreach' from gcode-sender.rb:35:inblock in '
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/serialport-1.3.1/lib/serialport.rb:52:in open' from gcode-sender.rb:29:in'

what to do? i use an external power suply

Power dying, you're probably trying to power the motors from the Arduino. You need to set the jumpers and supply sufficient power directly to the shield through the DC jack.

Did you edit the gcode sender to use the correct serial port up towards the top?

yes, it starts up and everything, but. i can run the G0 x1600 code now in the arduino editor, and set the M500, but when i try to run the ruby, i frezzes and the power led pulses,and you can hear the servo and motors glitching. i run an external 12v 1a powersuply

Before, you were saying something about a ruby error, bad file descriptor. Did setting the serial port correct that?

The power requirements depend on which stepper motors and servos you are using. Look up their data sheet and see what amperage they expect to draw. The ones I have linked to in the BOM are 350 mA max so 1A power supply would work, but if you used a different one and they draw more power, then it would account for your power glitches.

Remember to remove the power jumper if you are using a separate DC power supply for the motor shield. https://learn.adafruit.com/adafruit-motor-shield-v2-for-arduino/powering-motors

Hi, i have a problem with Inkscape, Eggbot extension...
this is a error message : Failed to connect to EggBot. :(

i use Arduino Uno

What firmware are you using? If you are using the EggBot extension, you must use the EggBot electronics. Several vendors sell the EBB driver boards. If you want to run my derivative firmware on an Arduino and an Adafruit motor shield, there are complete instructions under Instructions in Thing Details; you cannot use the EggBot extension in that case, and must use the Unicorn plugin (my modified version, linked in the instructions). If you are running an Arduino with a different motor shield, I cannot help you there and you will have to figure out what firmware are available for your setup.

That exact one? That is the Adafruit motor shield v1. Someone from the comments below helpfully added support for that shield to my firmware, so the instructions will work for that after editing the configuration file to tell it you're using v1. As for the rest of it, please try following the electronics and software instructions in my write up under Thing Details. In particular, the EggBot extension only works for the EggBot electronics.

Aug 17, 2016 - Modified Aug 17, 2016
kyoday - in reply to jsc

Ok motors are ok but servo don't work

Try hooking up just the servo and running some servo test sketches, such as Knob and Sweep found here: https://www.arduino.cc/en/Reference/Servo. Which servo are you using?

SG90...it's work in other project and test

And when you say it doesn't work, what symptoms do you see? How are you powering your motor shield? It is recommended to power the motors separately, from the DC jack, rather than drawing power from the Arduino or you may see brown outs and restarts.

Aug 18, 2016 - Modified Aug 18, 2016
kyoday - in reply to jsc

Ok I solved ! my fault !!
The servo strives because it could not climb over... thank you and sorry :)

"Climb over", what does that mean? Was it obstructed? Any issues you had, someone else may have someday, too.

Aug 19, 2016 - Modified Aug 19, 2016
kyoday - in reply to jsc

Now...stepper motor are ok but whrn draw egg the pen arm is inverted.. look the video

This is servo in normal position, it's correct hardware?

Different servos have different conventions for which direction they turn. I would have thought all the TowerPro SG9x servos would work in the same manner, but apparently not? For me, higher values turn the servo counterclockwise when you're looking at it from the front (lower the arm), and lower values turn clockwise (raise the arm). When you test it using the M300 commands, is that what you see, or the opposite?

If it is reversed, you can either print a mirrored version of the part that includes the servo mount, to mount the servo to the right, or go into the firmware and find every occurrence of servo.write() and edit it to be servo.write(180 - (whatever the old argument was))

Aug 25, 2016 - Modified Aug 25, 2016
kyoday - in reply to jsc

when write M300 S100 arm pen go up quickly .. when write M300 S115 go down slow .. it's all correct... i have problem when print a gcode... could be a setup of unicorn plugin?

Yes! Double check the Unicorn plugin settings to make sure the pen up and pen down coordinates are correct. Down should be higher than up.

what is your configuration? Can you take a screenshot please?

Under the Setup tab, after you have selected Save As... MakerBot Unicorn G-Code, the first two fields are Pen Up Angle and Pen Down Angle. I currently have them set to 107 for pen up and 115 for pen down. Pen down should be > pen up because of the rotation direction. The correct numbers for you will depend on the size of the object you are printing on and the size of your pens, so do some tests with M300 to see what some good numbers are. Pen up should be high enough (low enough numerically) that the pen never touches the object through a full revolution. Pen down should be low enough that the pen remains firmly in contact through a whole revolution.

My other settings are: both delays 100, XY feedrate 300, Z axis stuff all irrelevant.

we are almost there...

now, the problem is that it starts and ends with the pen arm down..

look at video


Did you set the default pen up position using M303, as detailed in the instructions?

Thank you JSC ! I have solved..now, I should improve egg block, occasionally does not run well, I will use the ninjaflex filament

how did you solved your problem with the servo when it didn't move?

yes, the problem was only position of bracket, it was just at limit

Did you install the o-rings?

Hi where does thje idler bearing plate go?

The idler bearing plate is from version 1 of the design, taken verbatim from nglasson's design. At that stage, both end plates were identical, you would mount a servo on one and the idler bearing plate on the outside of the other to hold the second idler bearing. In later revisions, I made the end plates asymmetric so you have to mount the servo on the left and use idler_end_plate_v2 on the right, which incorporates the ring for the second bearing.

Any ideas on what's causing this problem when trying to save Unicorn gcode file using Inksacape?
Thanks for any help.

Traceback (most recent call last):
File "unicorn.py", line 108, in
File "C:\Program Files\Inkscape\share\extensions\inkex.py", line 268, in affect
File "unicorn.py", line 102, in effect
File "C:\Program Files\Inkscape\share\extensions\unicorn\svg_parser.py", line 231, in parse
self.recursivelyTraverseSvg(self.svg, [[1.0, 0.0, -(self.svgWidth/2.0)], [0.0, -1, (self.svgHeight/2.0)]])
TypeError: unsupported operand type(s) for /: 'NoneType' and 'float'

Ah, I see the problem. You specified your document dimensions in mm. It MUST be in px, as my writeup indicates. The unicorn gcode parser only understands px or %. That will fix you.

Some SVG object doesn't have a width or height. Please message me with a link to the file you're trying to convert and I can try to take a look at it. If you're using text objects, remember to convert them to a path before exporting using Path->Object to Path.

Have just made one of those miracles! Great design, software and instructions!
Everything looks fine but about at 90 degrees one of my motors starts loosing steps and all the picture shifts.
Will be extremely grateful if anyone can share their experience or comment on the issue.
Thank you in advance.

Send me a message with your email.

Comments deleted.

Hy , is there a chance to run this setup with L293D shield (adafruit v1) ?

Thanks to GrAndAG, my firmware now should work for both, with a simple change in the configuration file. Search for "GrAndAG" in the comments below.

Thanks for this nice project.

I have gone through all steps and everything works as expected except of the sending part. I always receive an error message like:
...in 'create': No such file or directory - .\/dev/cu.usbmodem145311 (Errno::ENOENT)...

So I am pretty lost and any help is highly appreciated

You need to edit the file to set the port, see step 5 in the instructions. It looks like you are running under Windows, so it will be something like "COM3" for you, but you can use the Arduino IDE to double check; the very bottom of the window, it should say something like "Arduino/Genuino Uno on xxx" where xxx is the port you're using.

"COM3" (or, you know, whatever) should have double quotes around it. On Windows, you can also use a number with no quotes. 0 is COM1, 1 is COM2, etc.

thanks for your reply, but I did this already. In my case it is COM17 and I edited already.

It seems that there is a problem with the file system or something like that. I spent already a bunch of hours on trying without success.

Any other idea?

If you've already edited it, how come your error message references /dev/cu.usbmodem145311, which is the original value?

ok, first of all a big thank you for your help :)

The Devkit was unpacked in: C:\devkit
The Ruby installation is in: C:\Ruby22-x64

I put the gcode-sender.rb and the test.gcode in the \devkit directory

Then in the command line:
cd devkit
ruby gcode-sender.rb test.gcode (I tried this also with the full path with the same result)

after hitting the enter key I receive the following error:

C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/serialport-1.3.1/lib/serialport.rb:43:in create': No such file or directory - \.\/dev/cu.usbmodem145311 (Errno::ENOENT) from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/serialport-1.3.1/lib/serialport.rb:43:inopen'
from gcode-sender.rb:29:in `'

You need to open gcode-sender.rb with a text editor and change the port variable to 16, or "COM17". You say you've done that, but your error message indicates that you haven't.

you were (almost) right: I double cheked it and there was a # in the line:

port = "COM17"

I forgot to remove the #

Now I did and it works :)

You made my day. Thank you very much.

Sweet. Show us some eggs.

Apr 2, 2016 - Modified Apr 2, 2016

I am having problems with the program disconnecting on the pen down command as/after it is executing the command. If I remove the pen down command from the gcode it prints fine but for some reason the servo wants to crash the program and I get errors similar to mewhalen below. I have tried changing the pen values but to no apparent avail. Does anyone have an idea what the problem could be? I noticed the same thing happening at times in the arduino monitor when I was trying to do the original setup. It seems like the pen rotator stepper has almost a violent hit now, very jerky.

your issue sounds a little different than mine. Turns out I had a bad usb cable. I found it by looking at device manager (windows), and noticed the comm port continually dropping then reconnecting. I changed the usb cable and all was well.

If you go to the serial monitor immediately after connecting and try to move the servo without testing the steppers first, does that work?

The servo runs off the USB 5V power. If you are attempting to power the steppers off the same line, you may be browning out the Arduino because the power draw is too much (steppers are always on even when not moving). Try plugging a DC power source of suitable voltage for your stepper motors into the barrel jack and removing the power jumper to give the steppers their own power source. That fixed mewhalen's issue.

Hmmm. I THINK that might have been on the correct track, however about 4 seconds after it was running (with a 12V DC source on the barrel jack) it seems as if I may have let the magic smoke out of the arduino.... I quickly shut it down and connected the 12v power source to the motor controller board via the terminals and pulled the jumper. Now it seems that when the stepper and the servo try to run at the same time the steppers lock up and are banging hard. I dont know if I have a bad servo, a bad stepper card or a bad arduino (or something else...) Not even sure how to trouble shoot it to be honest. It seemed like I was on the correct track prior to the steam locomotive chuffing under the board....

Sorry, not on the barrel jack, the terminal block. Please read https://learn.adafruit.com/adafruit-motor-shield-v2-for-arduino/powering-motors

Comments deleted.

Everything is reversed for me...not a problem for the steppers from what I've read (and could swap 2 wires on each motor to fix).
But how do I reverse the servo direction?

jsc - in reply to frige

If the steppers are both reversed, you're fine. Just treat "up" as towards the right instead of towards the left.

There is no set standard for servo rotation direction. The TowerPro micro servo I am using rotates counterclockwise (facing the servo) for higher values, and clockwise for lower. Mounted on the left, that translates to pen up for lower values, pen down for higher. If the one you are using works in the opposite fashion, you can fix it through one of two ways:

Hardware: mirror the pen arm pivot part left to right, and mount the servo on the right.
Software: find every occurrence of servo.write() and edit it to be servo.write(180 - (whatever the old argument was)).

Do you have the fusion file for the Arduino holder? I want to make the threaded rod part square so that it will print easier.

Thanks! This is a great project. Wont be ready for Easter...but I should have plenty of time to add an engraver and make some christmas ornaments.

What's wrong here??

In file included from /DualStepper.h:21,
from DualStepper.cpp:18:
SingleStepper.h:25: error: expected `)' before 'sm'
SingleStepper.h:26: error: 'uint8_t' has not been declared
SingleStepper.h:33: error: ISO C++ forbids declaration of 'Adafruit_StepperMotor' with no type
SingleStepper.h:33: error: expected ';' before '' token
/SingleStepper.h: In member function 'void SingleStepper::release()':
SingleStepper.h:27: error: 'stepper' was not declared in this scope
In file included from DualStepper.cpp:18:
/DualStepper.h: At global scope:
DualStepper.h:43: error: 'uint8_t' has not been declared
DualStepper.h:43: error: 'uint8_t' has not been declared
DualStepper.cpp: In member function 'void DualStepper::travelTo(int, int, float)':
DualStepper.cpp:63: error: 'abs' was not declared in this scope
DualStepper.cpp: In member function 'void DualStepper::moveTo(int, int, float)':
DualStepper.cpp:84: error: 'min' was not declared in this scope
DualStepper.cpp:84: error: 'abs' was not declared in this scope
DualStepper.cpp:84: error: 'max' was not declared in this scope
DualStepper.cpp:84: error: 'sqrt' was not declared in this scope
DualStepper.cpp:88: error: 'FORWARD' was not declared in this scope
DualStepper.cpp:94: error: 'BACKWARD' was not declared in this scope
DualStepper.cpp: At global scope:
DualStepper.cpp:115: error: 'uint8_t' has not been declared
DualStepper.cpp:115: error: 'uint8_t' has not been declared
DualStepper.cpp: In member function 'void DualStepper::plotLine(SingleStepper
, SingleStepper*, int, int, unsigned int, unsigned int)':
DualStepper.cpp:142: error: 'delayMicroseconds' was not declared in this scope

Are you using the Arduino IDE?

Hm... I thougt I did.
Perhaps I have a wrong Version of arduino installed...
Just installed the IDE from your link and added the Adafruit-motor-V2 to the libary.
I have to ad the u8lib to! Why?
And when I will upload the Firmware to the uno, it's only possible with the motor-shield mounted!
Otherwise I got an error: out of sync...
But I'm Not able to send commands over the serial monitor.
No stepper will move... :'(

You need to get your electronics and motors working properly, which I can't really help with because I'm not there. An out of sync error usually indicates that there is a problem with your Arduino. Try following the steps in the first answer to this question: http://arduino.stackexchange.com/questions/17/some-dude-named-avr-wont-let-me-upload-my-program-aka-avrdude-stk500-getsync

The Adafruit Motor Shield V2 library does not require u8lib in any way. What do you mean when you say you had to install it? You should just be able to use the library manager under Sketch->Include Library.

When you connect to it using the serial monitor, do you see the text "Ready" as the first line?

I've made some changes.
I've deleted and uninstalled everything from the arduinosoftware and installed the Software new from your link.
Added the adafruit-motorshield v1 (because I have it mounted).
Compiling and uploading was now succesfull!
But now I have an other Problem.
The y-stepper and the pen-servo are shaking very nervous and noisy while printing and the result looks very ugly.
And the motor-shield gets very hot.
Any ideas?

Mar 28, 2016 - Modified Mar 30, 2016
GrAndAG - in reply to HiJech

I also have noticed that microstepping on v1 is jerky and noisy (especial at low speeds). Maybe it's motor I.m using (in my case it's 12V 0.4A 42SHD0001) Or maybe it's due to driver, which is used in v1 motor shield. It uses voltage(not current)-based control. Although Adafruit library contains correct microsteps-PWM mapping array (it uses sin/cos algorithm), it looks like the actual microsteps positions are not uniform. From my testing, microsteps are closer to each other when they positions are near full step (i.e. if full step is 0-180 degrees range, microsteps are at 0, 4, 9, 15, 22, 30, 40, 52, 70, 90, 110, 128, 140, 150, 158, 165, 171, 176, 180, or if represent the same graphically: |-|--|---|-----|----------|----------------|----------...----------|----------------|----------|-----|---|--|-| ). Unfortunately, I do not have v2 around for comparison.

I think, It can be fixed by measurement of motor positions on large set of microsteps (say, 64 or more) and select from them the positions which are spread uniformly between full steps.
But for now, quickly using the "educated guess" method, I modified PWM-map in Adafruit motor shield v1 library with the following numbers, that work for me still not perfect, but a way less jerky
(AFMotor.cpp): uint8_t microstepcurve[] = {0, 50, 98, 142, 180, 212, 236, 250, 255, 255, 255, 255, 255, 255, 255, 255, 255};

As for temperature of drivers and motors - they are hot, but still touchable by fingers. And such kind of temperature is still far from they limitations.

Well, the fact that you are using a v1 shield accounts for the fact that it wasn't working for you earlier, since support for v1 was just added a few days ago.

As for running hot and jittering, check the data sheets for your stepper motors and make sure they are appropriate for the motor shield, including what voltage and power requirements they are expecting.

Sorry if someone has already asked this:

Does this work with the older Adafruit Motor Shield v1.2 ? The instructions says to use the v2 shield but I have a v1.2 that I have laying around so I want to use it instead.


Not as is, but the changes necessary are not difficult. See the comments below from scv36 (search for AF_Stepper). A few lines changed in SphereBot.ino and SingleStepper.h/cpp should be enough. I don't have one, so I can't do it, but let me know if you get it running (I would test the firmware with your electronics before starting the build).

Thanks jsc! I will do that and check those out.
I also happened to be looking at one of the remixes for your design. It is just a different enclosure for the electronics by GrAndAG:


But he also included modified firmware files that are compatible with the Arduino Uno + Adafruit Motor Shield v1
So it seems there are a couple of alternatives to try. I will try and see which one works better.


Egg-Bot - Enclosure for electronics
by GrAndAG

His included firmware is just mine with more or less the changes I outlined to make it work with the v1 shield. So I guess it does work.

Mar 21, 2016 - Modified Mar 22, 2016
GrAndAG - in reply to jsc

Yes, that firmware is just jsc's one, but slightly modified to use Motor Shield v1 library instead of v2. Also I've added support "N##" g-code directives (line numbering), so It's possible to "print" on EggBot using some standard 3D-Printer software (I successfully tried Pronterface for now).
(Also I've noticed that in my case steppers work faster. For me the single (micro)step takes 0.17ms (instead of 1.29ms in jsc;s firmware). I suppose that v1 shield operates faster than v2.)

Actually, they both could be merged in single firmware under some DEFINE directive (I can do it if jsc's interested) to support both versions of Adafruit Motor Shields and could be included into jsc's git repo.

Yes, I'm pretty sure the v1 can step faster because the v2 talks over i2C and I believe that is the limiting step.

Are you fluent with github? You can fork the project and submit patches. If not, make your changes and send them to me and I'll incorporate them and credit you.

Actually, I never worked with git nor with github in particular. But created an account there, made fork, branch, did commits and filled pull request (as far as I understood github flow).

I've merged GrAndAG's update, so it should be possible to use the firmware with both shield versions. Thanks for the edits.

any thoughts on what might be causing this error?

"gcode-sender.rb:53:in `gets': Bad file descriptor @ io_fillbuf - fd:3 (Errno::EBADF)"

Thank you

It's not reading from the USB serial port properly. Are you sure you're connecting to the proper COM port?

I am using the same com port that I use to upload the firmware to the Arduino. the pen arm drops, and moves to the left, stops and the error appears. I thought maybe it was an issue with my Arduino so I just switched it out with another and am getting this...

C:\egg\Eggbot_Nutrition_Label>ruby c:\egg\spherebot-master\utils\gcode-sender.rb nutrition2.gcode
Pausing: (Plotting layer '2 - drawing') Press Enter to continue.

c:/egg/spherebot-master/utils/gcode-sender.rb:53:in gets': Permission denied @ io_fillbuf - fd:3 (Errno::EACCES) from c:/egg/spherebot-master/utils/gcode-sender.rb:53:inblock (2 levels) in '
from c:/egg/spherebot-master/utils/gcode-sender.rb:35:in foreach' from c:/egg/spherebot-master/utils/gcode-sender.rb:35:inblock in '
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/serialport-1.3.1/lib/serialport.rb:52:in open' from c:/egg/spherebot-master/utils/gcode-sender.rb:29:in'

I am opening the command prompt as an administrator to run it.

I am so close I can taste it... Unfortunately my kids are hovering, waiting to see it in action...

Apr 2, 2016 - Modified Apr 2, 2016
Mwinschel - in reply to mewhalen

I am getting this error too, have you figured this out? It seems to cutout on pendrop for me. I tried an experiment and deleted the pen up/pen down commands and it prints successfully. It appears that the unit is disconnecting after the pen down command. For some reason if my pen down command gets to its endpoint, it disconnects the arduino, but not if it has a constant pull on the servo (may be an intermittent problem and that is my read on it). Does this mean anything to anyone? The pen up and down angle on the gcode compiler are not the same as the points on the eggbot, wondering if that is the issue or if they do not translate.

For me it turned out to be a bad usb cable. I swapped it out and it now works fine.

I am also having trouble with the Ruby piece. I am on Windows 10 x64, ran rubyinstaller-2.2.4-x64.exe, then extracted DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe to c:\users\eric\documents\devkit. I ran "devkitvars.bat", which returned "Adding the DevKit to PATH..." I then ran "gem install serialport" which returned "'gem' is not recognized as an internal or external command, operable program or batch file." Any guidance would be greatly appreciated, as the build came out great and I am anxious to put it to work...

Ok, so I solved that problem with the help of this article on the ruby download site https://github.com/oneclick/rubyinstaller/wiki/Troubleshooting.
For gem to work, you need to check the box "Add Ruby executables to your PATH" during the install. Now, where do I find "gcode-sender.rb"?

I'm glad you figured it out! I'm rarely on Windows and just ran through my process once to see that it worked. I must have had that box checked. gcode-sender.rb is in the Utils directory in the firmware directory. You will have to edit it to use the correct COM port.

have same problem on win 7 to

Thank you for sharing your work and taking the time to write detailed instructions!

jsc - in reply to crox

Saw your make and the modifications, pretty neat. Did it all end up working for you?

Comments deleted.

"explicit instructions" ok!
Thank you!!!

can some one made a video have to set it up form the start have program with Arduino come up bug so think make set up right and send gcode ant got a clue cos i cant find gem install serialport or Edit the gcode-sender.rb file

Mar 12, 2016 - Modified Mar 12, 2016

Ok , The alternavie Software Printrun and Inkscape MakerBot Unicorn G-Code Output ,run Linux Mint.

Mar 10, 2016 - Modified Mar 10, 2016

The next problem is to :

On my test laptop is a fresh Installed WinXp .

Run "gem install SerialPort" - run command does not exist.

I have the program installed Spherebot Control 2.0 that goes Com compound Commandos as G1 Y480 etc. will not run .
Under Arduino IDE works .
Can the software be adapted ?

Did you follow all the instructions for Windows? Including the part where you install ruby? Also, it is not clear from your comment what exactly is going wrong. Is it not finding "gem", or not finding "run"? You don't type "run", you type the part between the quotation marks. And it is important that you type it exactly as written (that is, "gem install serialport", not "gem install Serial Port").

I have tested the instructions on a Windows machine and can verify that it works.

Comments deleted.

Did you follow all the instructions, including installing ruby from the rubyinstaller package, which should provide you with the "gem" command, and running devkitvars.bat once? Also, don't capitalize Serialport once you get it installed.

Mar 10, 2016 - Modified Mar 10, 2016
scv36 - in reply to jsc

running everything devkitvars.bat supplied know etc. etc.

You've run the Rubyinstaller? And DevKit-mingw? There are two separate packages. One must be installed. The other just unpacked.

Mar 10, 2016 - Modified Mar 10, 2016
scv36 - in reply to jsc


ok - found gem error, the folder must be devkit !!

But crazy now the next error:


the procedure entry "_gmtime64_s" was not found in the dll "msvcrt.dll"

I think there may be issues running Ruby on XP without compiling it yourself: https://github.com/oneclick/rubyinstaller/issues/271
Windows XP has been end-of-lifed for some time now, so I don't know if anybody will be working on fixing it.

Mar 9, 2016 - Modified Mar 10, 2016


I try all adapt here , unfortunately, I have problems with it .

Thanks for the help, now it is running.

best regards

jsc - in reply to scv36

That is because the AFMotor library does not name its classes "Adafruit_StepperMotor" but AF_Stepper. It also initializes them differently. Please read the AFMotor documentation: https://learn.adafruit.com/afmotor-library-reference/af-stepper-class

You need to change, in SphereBot.ino, where the steppers are initialized:
SingleStepper *xStepper = new SingleStepper(new AF_Stepper(200, ROTATION_AXIS_PORT));
and similarly for yStepper.

Then in SingleStepper.h and SingleStepper.cpp, change every mention of Adafruit_StepperMotor to be AF_Stepper.


I have the following motor nameplate here:


Is this Compatible Adafruit Motor Shield

No, that is not an Adafruit Motor Shield v2. You can probably get my firmware to work fairly easily if you are familiar with the Arduino Stepper library. All the stepper handling takes place in SingleStepper.cpp and only requires the ability to make a single step. However, you will lose microstepping and 16x resolution.

ar as I know there is a Adafruit Motor Shield V1.0 Clone .

I get this Lib to run?

Adafruit Motor Shield -library -master

It certainly looks similar. I would try to get it running the steppers and servo first with that library. You won't be able to run my firmware without modification, but because of the V1 and V2 libraries are similar, it shouldn't be too difficult to figure out where to make the changes. Just a few lines.

Which PSU for shield and steppers ?

I really have very little ability to help you with your hardware that I do not have. Since it does appear to be an adafruit shield clone, perhaps you could try their documentation for their shield? They usually have pretty good tutorials for their hardware. Stepper motors all have different voltage and power requirements. You will want one to power the motors separately from the Arduino.

Jan 12, 2016 - Modified Jan 12, 2016

Hello, after installing the unicorn plugin I have this problem, when I try to plot to an egg from inkscape I have this error message:

Traceback (most recent call last):

File "eggbot.py", line 1406, in


File "C:\Program Files\Inkscape\share\extensions\inkex.py", line 268, in affect


File "eggbot.py", line 281, in effect


File "eggbot.py", line 1299, in EggbotOpenSerial

self.serialPort = self.getSerialPort()

File "eggbot.py", line 1356, in getSerialPort

for strComPort in eggbot_scan.findEiBotBoards():

File "C:\Program Files\Inkscape\share\extensions\eggbot_scanwin32.py", line 6, in findEiBotBoards

hKey = _winreg.OpenKey( hReg, r"SYSTEM\CurrentControlSet\Enum\USB\VID_04D8&PID_FD92" )

WindowsError: [Error 2] The system cannot find the file specified

Can you help me?

You are using the eggbot software, and presumably their electronics as well. I have no experience with that hardware, sorry.

Nice nice, is it possible for you to upload a close up of the pen arm with the spring on?
I would use it as a reference to see if I have assembled it correctly

Aug 6, 2015 - Modified Aug 6, 2015
jsc - in reply to Vondust

Close up of pen arm spring added. Let me know if you get it working!

nice i got make for my self ty

and i ask some thing can make pic like over egg bots with yours

Hi. Don't understand your question, sorry. Are you asking me for more pictures, or what?

i make picture like this http://www.thingiverse.com/thing:5864/#files on the egg or just text

Monochrome geometric Eggbot plot
by dnewman

Yes! Any graphics you want. You will need to get some electronics hardware, though, and load it up with firmware. The easiest is probably just to get an EBB Driver Board from evilmadscientist.com. The links in the Instructions are if you want to use an Arduino and a motor shield.

What are the modifications necessary to use the EBB Driver Board since the instructions were written for an Arduino and motor shield?

If you're using the EBB, the proper steps are: ignore all my instructions completely and follow the instructions for the EBB electronics. You won't be needing the Arduino mount, so you can skip printing that one.

ok have a Arduino and a motor shield all ready for me have order the rest of part

the SphereBot.ino got to Arduino but wher i put the gcode-sender.rb and what software to print out the egg

i know i am noob with this good makeing this bad with softwere thing i gone is GPS Time Cock and Digital Temperature with sample codeing here i what look http://stepbystepprojects.co.uk/gps_time_clock.htm

thanks for the help

gcode-sender is a ruby script, and is suitable for Linux and OS X. You may have some more difficulty getting it to run under Windows, I am not sure.

I would begin by making sure everything is running properly! In the Arduino serial window, try sending it commands like "G0 X160 Y160" and "M300 S0" and "M300 "S180" (the actual values sent will be clamped to the min and max values defined in the code). You should make sure those limits are appropriate for your setup. Then you can worry about sending a gcode file. You could try this one: http://www.shapeoko.com/wiki/index.php/Universal-G-Code-Sender

ok im on window 7 so i get part and see ty

Yes! I'm so glad someone rebuilt the firmware for the Adafruit shield. I went with the shield thinking it would simplify my project, but I was not up to it. My poor bot could only scribble and draw beautiful waves. Can't wait to check out the new software and these modifications. I heard about this from the 3D Hangouts video.

I just realized I hadn't pushed my latest changes, so if you looked at the firmware before now, have another look. I've simplified it somewhat (all units are now in terms of 16x microsteps on a 200 step/rev motor, and it's handling the line drawing on its own instead of trying to coordinate two steppers based on timing).

Cool, I was about to ask, but it might be a couple of weeks before I get to try it out anyway. I'll make sure to report back in if I get it all working. I had tried using code from https://github.com/MarginallyClever/GcodeCNCDemo, but it was not specifically for Spherebot, and I couldn't make it work other than for some really simple gCode. I was surprised that Adafruit didn't have any CNC type projects for this shield since that seems like an obvious application. The AccelStepper library just doesn't seem to be made for CNC.

That MarginallyClever code is pretty good, and I wish I'd known about it before I started in on my own firmware modifications. I ended up at more or less the same place, but only after much fussing around with dead ends.

Jul 3, 2015 - Modified Jul 3, 2015
justbennett - in reply to jsc

I've been there. After hours of frustrating work you finally get it working only to realize that someone else already had come up with the same solution. Still, the MarginallyClever stuff wasn't complete and I couldn't finish it. So I've loaded up your code and it seems to work, but I'm having trouble sending gcode files over serial. I've never used a ruby script and I can't seem to make it work. I have tried other gcode sender apps, but nothing seems to be working. Could you expand on the process for sending a gcode file?

EDIT: I did get the Sender for Mac by zaggo working. Now to test it on a real egg!

Did you ever get it all working? I've just updated my firmware to make pen servo setting more configurable. Now you can use M301, M302 and M303 to set min and max limits and default pen up position using a P parameter. M301 P90 sets the minimum servo angle to 90, for example. M500 saves to EEPROM, M501 loads EEPROM values (in case you have been mucking about and want to flush your changes) and M502 resets everything back to compiled firmware defaults. Also, I've put in a heuristic optimization: if the pen is set to the pen up value and a move would travel over half a full rotation, it takes the short way around.

Yes I did! I've been having fun figuring out the "tool chain." GIMP to InkScape to Unicorn to SenderForMac to Arduino with your firmware. There's a lot to mess with. My images were coming out reversed. Rather than track down the actual problem, I've just been reversing my image in InkScape as a final step.

Those seem like good features. Thanks again for putting this out there. I don't know how much work you put into it, but it would have taken me a LOT of time to do something like this. Hopefully, it is gratifying for you to know someone else is benefitting from it. When my first image came out properly I had that feeling like a mad scientist that just brought his creation to life. I ran around the house announcing it to my wife and kids.

Adafruit should post this as a project on their site. It increases the value of their motorshield greatly in my opinion. If they didn't want to compete directly with the Eggbots that they sell they could adapt it to other CNC-type projects.

Just updated the firmware with a small change that allows the motor shield to step ~3x faster.

Just swap the two pairs of wires on the motor for the reversed axis, OR swap two wires of a single pair. That will reverse that axis and you can skip the mirroring step in your workflow.

I'm gratified that my firmware is being used by at least one other person.

The first thing is to check that the servo limits are correct for your setup. You can try sending G1 and M300 commands manually using the Arduino terminal window. Make sure line ending is set to line feed.

Whatever gcode sender you use, it should strip out blank lines and comments if it is going to wait for "ok" responses before continuing. The other thing I implemented in my version is to trap M01 and pause to allow for pen changes. That seems to be what the Unicorn Inkscape gcode generator puts out for pauses.

It should be easy to get my script working on OS X as that is what I'm using. Edit the script to specify the correct serial device. Run "sudo gem install serialport" to install a required library. Run "chmod a+x gcode-sender.rb" to make it executable, then run "./gcode-sender.rb file.gcode" to send the file.

I just watched the hangouts video segment. I realize it's a 3D printing video, so they mainly concentrated on the modeling aspects, but I'm glad they mentioned the motor shield work; that's the largest part of my contribution, I think. I've ditched AccelStepper in the latest version in order to coordinate the two steppers more precisely using Bresenham's line algorithm. I've also done some testing and determined that the fastest it can go is 265 microsteps/s, or about 16 full steps/s, which seems fast enough. Anyway, now it will never skip steps or give janky movement at higher speeds. The 3D stuff is mainly minor tweaks of the work of others, although I hope having a full BOM will make it easier for people to build their own.

Feb 24, 2016 - Modified Feb 24, 2016
justbennett - in reply to jsc

Regarding the Arduino firmware...Something changed with the last Arduino update (or further back maybe). I had to replace
#include "utility/Adafruit_PWMServoDriver.h"
#include <Adafruit_PWMServoDriver.h>