This is the second part of my pen plotter build - part 1, covering the physical structure of the build, is here.
Printing Hello World!
Electronics and Software
The stepper motors are driven by EasyDriver controllers which were recycled from an old, abandoned project.
Everything else is pulled together and controlled using an Arduino Duemilamove which provide the G-Code interpretation using the GRBL library.
Because GRBL is designed with 3-axis CNC machines in mind, it requires some alterations to work with the servo pen-plotter mechanism.
Thankfully I'm not the first person in the world to have attempted this, and this instructable provided a good head start on how to do this.
The main takeaways are to download the regular GRBL library, but swap out the spindle_control.c file with the one from the instructable. In that file there are two lines:
Change the servo values if necessary - after experimenting with changing them, I found that I got the best results setting the down value to 255 and the up value to zero.
Inkscape GCode Conversion
The GCode plugins for Inkscape seem to be included with a standard installation - I didn't have to do anything special for them to appear.
Whatever your source image is (in the video below it was a text object), it needs to be converted to paths.
If you're using objects within Inkscape, such as text, use Path, Object to Path.
If you're starting with a bitmap image then use Path, Trace Bitmap, and use the Edge Detection method.
The next step is to run the generated GCode through a post-processor to add the instructions to raise/lower the servo. The post-processor linked in the Instructable didn't work for me, so I ended up making my own - the code is on GitHub.
To run the machine, I use the Universal G-Code Sender.
There were a few issues homing the plotter as near the extremities of the carriages travel it would struggle to move smoothly, and would not reach close enough for the limit switches to be triggered, resulting in it stalling. To overcome this I added screws to the structure in such a way that the limit switches would be triggered when stalling began to occur.
The pen holder that I designed in the previous post did work, but there were a few issues with the overly simplistic design:
- The fact it rotated the marker off the page created 'flick' marks where the pen was raised/lowered.
- As it was secured entirely on the servo, it had too much flexibility which resulted in it being dragged incorrectly on the page.
To fix this I redesigned the pen mount, factoring in what had already been created so as to make use of what was already created as much as possible.
The new design relies on supporting rails mounted to the existing carriage, which would allow the servo to push the pen mount directly down onto the paper. When lifting the servo returns to its initial position, letting springs added to the rails lift the pen back up.
This new nozzle is on github here.