cubeberg

Build thread - 3 Axis pen plotter

35 posts in this topic

I ran across this Instructable the other day on how to make a tiny laser engraver from a couple of CD-Roms.  I figured my wife wouldn't be too keen on lasers, and the glasses I would need are expensive - so I decided to start with a Pen Plotter.  Maybe I'll work my way up to a laser :smile:

 

I'm using TI's DRV8834 low-voltage stepper driver - the same one used by a TI employee in their internal boosterpack challenge.  For now, I'm using a small breakout board, based on the boosterpack design.  Using the chip honestly couldn't be easier thankfully.

post-1690-0-73353900-1371661470_thumb.jpg

 

Right now - I've got two stages built and I'm working on the third.  

post-1690-0-81384700-1371661476_thumb.jpg

 

Running some test patterns - using some "Poster Putty" in place of the unfinished Z-axis.

post-1690-0-80865900-1371661481_thumb.jpg

 

I'm using an old PC power supply for the 5v needed for the steppers - works great, although it's almost as large as the project itself :smile:

 

For now - the code is pretty rudimentary - but it's a good start.  Current X/Y/Z coordinates are recorded, and it supports moving to any X/Y coordinate - although it doesn't calculate a perfect line between the points.  

The Z axis is handled first since it's simply used for starting/stopping a line - no purpose in moving the Z axis at the same time as X/Y.  From there - X/Y are incremented/decremented by 1 until it hits the desired value.  So moving from 0,0 to 15,30 would result in a 45 degree line from 0,0 to 15,15, and a straight line from 15,15 to 15,30.  

 

I'm fighting with some issues with the platform being level - the pen isn't exactly forgiving - a variation of a single MM is enough to stop a line.  I might work in some Z-axis compensation, but hopefully I won't have to.  I've also run into some situations where the steppers skip - I think that might be a lubrication issue.  Hopefully it isn't an issue with the pen dragging on the paper.

 

Since I've got a decent base with the X/Y coordinates - I'm hoping to apply some of the calculations found in LCD libraries for drawing lines and curves - should be pretty simple to apply the same logic.

Share this post


Link to post
Share on other sites

 

 

Since I've got a decent base with the X/Y coordinates - I'm hoping to apply some of the calculations found in LCD libraries for drawing lines and curves - should be pretty simple to apply the same logic.

 

The basic algorithm is called Bresenham's algorithm. 

 

To draw a circle, it uses only one octant and the rest is draw thanks to symmetries.

 

So you may need to make some changes to the algorithm.

Share this post


Link to post
Share on other sites

Nice start, I'm working on something similar using repurposed scanners.

 

Since your Z axis is more like an on/off thing, maybe you could add a small spring to allow the pen to go up/down on bumps whithout having to compensate on Z.

 

Are you using floppy drives? If so the steppers should take 12V and have more torque (double check first :-)

Share this post


Link to post
Share on other sites

The basic algorithm is called Bresenham's algorithm. 

 

To draw a circle, it uses only one octant and the rest is draw thanks to symmetries.

 

So you may need to make some changes to the algorithm.

Thanks - I know I'd run across that on my earlier research - I booked the midpoint circle algorithm.  I'll definitely have to modify the approach since I will want to create a smooth circle, not hop around.

 

 

Nice start, I'm working on something similar using repurposed scanners.

 

Since your Z axis is more like an on/off thing, maybe you could add a small spring to allow the pen to go up/down on bumps whithout having to compensate on Z.

Yeah - that's something I was considering - it has to be something that won't allow the pen to give at all in the x or y directions.  I'll have to do some searching to see if someone has come up with a solution.  Found a good forum thread here: http://www.shapeoko.com/forum/viewtopic.php?f=24&t=330

semicolo likes this

Share this post


Link to post
Share on other sites

That guy has a nice design, but your cdrom steppers may be too weak that pen holder seems heavy.

Share this post


Link to post
Share on other sites

That guy has a nice design, but your cdrom steppers may be too weak that pen holder seems heavy.

Yeah - I was wondering about that - I'm actually planning on using a floppy stepper for the Z-axis which is even smaller.  I'll have to come up with something very light weight.

Share this post


Link to post
Share on other sites

Ran some circle algorithms last night.  Ran into some problems with the midpoint circle algorithm - it isn't really designed for consecutive points and there's not enough memory on the device to store 4,000 points.  Once I have a working Z-axis - it won't really be an issue though.

 

I was able to get the gcodetools plugin for inkscape working.  I started with a few complex shapes, added points and had it convert everything to straight lines.  That means that the device won't have to do anything except draw lines (although I need to add linear interpolation).  Next task is to write something that will transmit it to the device.

post-1690-0-74995900-1371825605_thumb.jpg

spirilis likes this

Share this post


Link to post
Share on other sites

Ok - got the Z-axis working :smile:  I'll try to take a video if it working tonight.  Here are some test prints:

post-1690-0-48275800-1372165656_thumb.jpg

 

Right now, I've got a G-code interpreter capable of reading X,Y and Z coordinates for lines (G01) and fast move (G00).  Objects are placed on an 8000mm canvas in inkscape (I've got 250 full steps of range = 8000 1/32 steps).  On the TODO list is interpolation.  I'm using the Add Nodes and Flatten Bezier functions in Inkscape to avoid needing to calculate curves.  Works beautifully so far.  I'm using GCodeTools to generate the GCode from inkscape.

 

Here is the G-code that I used to generate the 43oh logo

43oh_0002.txt

And the corresponding inkscape file:43oh_circuit.svg.txt

 

 

I've also got a C# program that's sending a line of code and waiting for a response.  It currently supports sending one section at a time, or the entire file.  I'm working on cleaning that up, but I'll be posting that shortly.

 

@@bluehash - can you add the ability to attach SVG?

bluehash, roadrunner84 and spirilis like this

Share this post


Link to post
Share on other sites

Here's a screenshot of the interface for transmitting the gcode.  I've got some threading stuff to work on - everything currently outputs to the debug window during transmission and not the UI.

 

File is loaded into memory and can be analyzed for the # of commands as well as the # of sections (each time the pen is lifted off of the paper is considered the end of a section).

 

 

post-1690-0-39758800-1372168496_thumb.png

Share this post


Link to post
Share on other sites

I have to warn you that this CNC stuff gets very addictive. I started with a small mill (Proxxon MF70) that I converted to CNC - initially for milling PCBs. You quickly find other uses for it and want to do more...

Share this post


Link to post
Share on other sites

I have to warn you that this CNC stuff gets very addictive. I started with a small mill (Proxxon MF70) that I converted to CNC - initially for milling PCBs. You quickly find other uses for it and want to do more...

lol - I know - this was a "gateway" project.  It was pretty cool to finally get the Z-axis working and just watch it churn something out.  My wife wanted to know what exactly I was going to do with the project - I don't think she quite understood what I meant when I said it was learning for future projects :)

 

I've already considered adding on the laser like the original project and using it to create plastic stencils for SMD reflow.  Needing $50 eye protection is putting me off a bit for now, although I considered just putting it in a box when it's running :)

Share this post


Link to post
Share on other sites

Don't skimp on the eye protection. I'm fairly sure that some cheap acrylic or polycarbonate safety goggles would be fine for my CO2 laser. I still bought some proper ones. They didn't stop me burning a hole in the back of my hand though.

Share this post


Link to post
Share on other sites

Don't skimp on the eye protection. I'm fairly sure that some cheap acrylic or polycarbonate safety goggles would be fine for my CO2 laser. I still bought some proper ones. They didn't stop me burning a hole in the back of my hand though.

Better your hand than your eye!  Yeah - I'll have some convincing to do with my wife before trying out the laser.  That'll give me plenty of time to save up for glasses.

 

The other possible avenue is a DYI 3D printer - a RepRap would be fun to build, although a small Printrbot would be cheaper and still tweakable.

Share this post


Link to post
Share on other sites

Nice, the drawing is quite slow compared to the speed when the pen is up, is it because of all the small lines, or does it miss steps if going faster when the pen is dragging?

cubeberg likes this

Share this post


Link to post
Share on other sites

Nice, the drawing is quite slow compared to the speed when the pen is up, is it because of all the small lines, or does it miss steps if going faster when the pen is dragging?

Yeah - it's due to the small lines.  Everything is interpolated, so there are thousands of commands coming from the computer.  I'm going to try FTDI or another USB->Serial adapter and a higher baud rate - but I'm also going to probably add rounding in code as well to reduce the # of characters being transmitted.  Removing the extra decimal places will cut transmission data almost in 1/2.  I could probably try batching coordinates as well.

 

I'll probably still have to play with stepping speed when the pen is down - I had some longer lines that I was drawing without multiple points and there were some skips in the ink.

Share this post


Link to post
Share on other sites

I was about to put your gcode through my CNC mill and mill the track-like logo onto a piece of copper clad board (after scaling it down by a factor of 100!). I got sidetracked. Anyway, it would have been a little unfair tempting your CNC addiction - like waving crack under a junkie's nose. ;-)

Share this post


Link to post
Share on other sites

I was about to put your gcode through my CNC mill and mill the track-like logo onto a piece of copper clad board (after scaling it down by a factor of 100!). I got sidetracked. Anyway, it would have been a little unfair tempting your CNC addiction - like waving crack under a junkie's nose. ;-)

LOL - I've got my wife talked into a Printrbot when we get the money.  I've been drooling over one of those for a while.  Makerbots are impressive - but way too much $.  I'd imagine a CNC wouldn't be cheap either :)

Share this post


Link to post
Share on other sites

@@cubeberg

 

Fantastic project, and impressive results. I wonder if you would be better off transmitting the co-ordinates in binary rather then text too? That might improve your bandwidth.

 

I have a few questions if you'll permit me:

 

1) How much current do the motors draw?

2) How have you implemented the z-axis?

3) What kind of pen have you used? Have you experimented with others? Biro vs. a felt-tip for instance?

Share this post


Link to post
Share on other sites

@@cubeberg

 

Fantastic project, and impressive results. I wonder if you would be better off transmitting the co-ordinates in binary rather then text too? That might improve your bandwidth.

 

I have a few questions if you'll permit me:

 

1) How much current do the motors draw?

2) How have you implemented the z-axis?

3) What kind of pen have you used? Have you experimented with others? Biro vs. a felt-tip for instance?

Dave,

I'll check out the current draw tonight - I updated the C# code today to only provide whole numbers (so 4 characters per axis instead of 9 - XXXX.XXXX).  I'm hoping to stick with g-code compatibility - increasing baud rate to 115200 will probably help.  I'm thinking of using an bluetooth booster configured for that baud rate - I can set it up to be a build flag, or something that could be set at runtime - but I did consider it.  Using hex values instead would be quicker - plus I'd save the time of converting from string -> integer.

Yes - Z-axis is working.  It's held together using poster-putty right now - so it's not the final solution - although it does provide a little give which keeps the pen in clean contact with the paper.

I'm using a set of 0.3mm "porous point pens" - I'm hoping to look for some 0.1mm pens the next time I got to the store, and I'm planning on testing some others as well - pencil, ball point, etc.  The felt tip bleeds a bit, but hopefully a speed increase will help.  Minimizing contact time with the paper should decrease the size of the line.

 

My wife is working on her book for the next week, so I will hopefully be posting some updates tonight!

Share this post


Link to post
Share on other sites

Looks like they  take about 2A - I saw some peaks around 2.1, but my multimeter - that's with all 3 steppers enabled, although I never run Z at the same time as X and Y.

I was able to get bluetooth working @ 115200 - didn't seem to hugely improve step speed.  It's capable of being fully wireless though, when I'm not updating code.

I'll have to take a look at the MCU code to see if there's something slowing me down there.  I could probably make my stepping speed quicker when the pen is down as there's a lot more going on there and calculations eat up some of the time between steps.

 

I'm going to try to get some of this put into a more permanent setup - I've got a bunch of it on a breadboard in a box and I hook up the steppers when I'm read to test.  I've got space under the setup though to house the electronics.  Ready to do that now since the hardware is pretty much set.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now