Step 4: Programming the laser cutter

Picture of Programming the laser cutter
First you need to create a postscript file. I suggest you do your drawing in Inkscape. It's an open sourced program for vector drawing. But not just that, it is the only app I have that lets me save drawings as //CLEAN// postscript files that we can work with later. So even if you do your original drawing in Illustrator, save it as a .SVG and reopen it in Inkscape, and from that application save your drawing as a .ps file. Postscript.

Don Lancaster wrote some postscript code that can take a post script file and then turn it into a simple text file that contains the numbers 0-7. The meaning:
0 - E
1 - NE
2 - N
3 - NW
4 - W
5 - SW
6 - S
7 - SE
U means move the pen up
D means move the pen down
and that's all we're going to be using

For those who like to hear the instructions here's a video:


Update, easy way to make a Flutterfly

Some people were having trouble figuring out how to create a flut file, so Bryn helped everyone out by creating this program that does it for you, make sure to send it a file that is "fair", that is without any showpage's, or quit commands in the .ps. The program automatically spits them out, but check the ps if you hit the error page.
flutterflier, this is where you turn your postscript into a flutterfly

--The old way to create a Flutterfy--
Once you saved your drawing as a postscript file. Open it up in a text editor like notepad. Also open up the file yourpostscripthere.ps in notepad. Cope the entire body of your postscript drawing and paste it in flutterafy.ps right after the line that says:

% ============= YOUR POSTSCRIPT SOURCE FILE STARTS HERE ===============
% ============= MUST NOT INCLUDE SHOWPAGE, QUIT, ETC... ===============

then you paste your stuff in here

% ============== YOUR POSTSCRIPT SOURCE FILE ENDS HERE ================

then change the paths in these two lines:
/destfilename (c://pope.txt) def
(./pope.txt) readflutfile % read selected flutfile
change these to the values you want to find your finished flut file at.
Resave yourpostscripthere.ps
and install http://pages.cs.wisc.edu/~ghost/doc/GPL/index.htm Ghostscript]: Once you have ghostscript installed you can either drag yourpostscripthere.ps to the icon, or open it up inside ghostscript, it'll create a flutfile for you in the place you told it to c://whateveryousaid (remember to use doube /'s like c://sommat// ..)

So now you'll have a flut file. here's a demo for ya:
(this is the stencil that i cut out, it says "hello lasers!")

next you need to open a C compiler. the old version of bloodshed DEV CPP works great! Get v 4.0, not the new one.

This is the flutafy.cpp file that you can edit to run your own flut file. Right now if you compile it it will create an executable that will accept any filename as a parameter. So you just drag your .txt or .flut file over to the .exe and it'll start chomping. chompchompchomp. I'm providing this code so if you want to make any improvements you can. Please share with me though.


If you don't know much about programming. Here is the executable:
Executable for a .exe that lets you drag any flut file to it and will run the stepper motors properly

And if you have XP you'll need this one:
Updated exe for XP
XP users will need this DLL to run this code:

(For instructions on how to install a DLL, Lifehacker has a nice one.)

Now you can drag any file that has 0-9 for step directions (a flut file. I have some in: http://modati.com/lasercutter/) and it will start communicating with the laser cutter you just made.

If your parallel port is plugged in and everything is working okay you should be cutting in no time!

Bilal Ghalib
glynn19825 years ago
can you use software like mach3 to control this?

great idea by the way.
perfo5 years ago
An interesting project thanks.....If you can find an old printer, some used EPS or PS directely could it be easier to swap the diode for the print head and us it as is ? What sort of penetration do you get with these lasers ? Have you experimented with different materials ?
minimalkid7 years ago
Sweet project, and it has totally inspired me. but.... I am having the same problem as radiationarea14, the dropfluthereXP.exe crashes after "square dance". I have the same problem with the XP dll as Judobrian (dllregister server entry point ..etc) , however putting it in the same folder as the dropfluthere.exe does not fix the crashing problems. I am so close to getting this to work and would greatly appreciate any help that you could give me.
andysuth7 years ago
A Nice job, but always be aware of the aluminium tube binding on the bar, very easy with Ali, try brass rod and PTFE/Nylon if you can. -AS
I'm having some trouble getting the dropfluthereXP.exe running. Everytime I drag the fult file or just try running the file the program simply crashes and you can only see the words Square Dance! before it crashes. It seems the only way it will run is if I put it into compatibility mode for Windows 98 but the stepper motors won't do anything. Do you know what I may be doing wrong? -Thanks for your help and your Awesome instructable. _FB
judobrian7 years ago
Bilal - When I try to register the XP inpout32.dll it gives me an error saying: "DllRegisterServer entry point was not found" and it doesnt register... Any thoughts?
Nevermind, I figured it. Instead of placing it in my windows\system32 folder, I placed it in the same folder as the EXE, and by doing that I dont have to register it.
mattgilbert7 years ago
i'm trying this project out, but the two scanners (different models) that I found both have stepper motors with 4wires, so they are "most likely bipolar" (according to http://www.doc.ic.ac.uk/~ih/doc/stepper/others/ ). has anyone run into this before, and if so, are the modifications to the program difficult? I assume the modifications to the circuitry wouldn't be too intense once you sort out the wires.
Bilal, this is an awesome project! :) Kudos!!! ...I just so happen to have a few extra scanners laying around, so I thought I'd give it a shot. Plus, I've been wanting to do some work with stepper motors (especially programming them through the parallel port). A few days ago, I ordered some ULN2003 chips (which should arrive in the mail any day now) on eBay. Last night I did as you said and gutted the scanners. Then I cut up a 25 pin PP cable. I have no doubt that the electronic circuitry and mechanical parts will be a breeze, but I am having a little trouble with the whole postscripting thing... I downloaded all the software you suggested. I drew a picture in INKSCAPE and saved it as a postscript (.ps) file. Then I opened my postscript file in NOTEPAD. Then I waded through that HUGE mess of a file (yourpostscripthere.ps) and found where to insert my own postscript and did so. Then I opened GHOSTSCRIPT and drag 'n dropped the new yourpostscripthere.ps file into GhostScript. To my amazement it actually worked! (Almost.) It yielded my INKSCAPE picture (just my name: "Aaron"), but it was upside-down and part of the "n" was cut off; and there was a weird green grid. So did I do something wrong??? And what's with the green grid? Should my picture have appeared on top of the grid instead of off to the side? ALSO, in none of my files did I see the 0-7 cardinal direction numbers. When do I see that? I'm a little confused. If you, Bilal, or anyone else can offer me some advice on this; then please post here and/or e-mail me at samuelaaronward@gmail.com. I just stumbled onto this site (INSTRUCTABLES) a few days ago, and I LOVE IT!!! :) Also, here's a tip: instead of buying old scanners and such, just go to a pawn shop and ask if they'll GIVE you their old stuff that doesn't work (which they're going to dump in the garbage). I did that, and they gave me an entire car-load of stuff! (Playstations, VCRs, Computers, Stereo eqpmt, Video Cameras, Scanners, etc) Bilal, you ROCK!!! :)
tomic7 years ago
Cool! I too used Lancaster's FLUTTERWUMPER code to do Postscript on an analog plotter, an ancient Tek storage oscilloscope, etc.

I did the compilation on a unix machine, and generated text files with the motion commands. The resulting "turtle graphics" commands (NNNNEEEEWWWWNSSS...) are voluminous of course; so I hacked up a simple run-length-encoding scheme, eg. "NNNNNNNN" becomes "8N" that sort of thing. The RLE sped it up by ten or so.

The motion commands were acted upon by a tiny PIC (this was 1999), a Micromint Inc STAMP. Commands came serially, a 2400 bps bit-banger.

This is part of my old Story Teller system (http://wps.com/products/Story-Teller/index.html).

(I have a nice high-res high-torque XY stepper assembly I mean to one day cobble up into a metal disintegrator to write directly on metal, and will port all this code to the Arduino. Maybe now I'll do it sooner... :-)

Thanks for your excellent project. I'll forward to students here (www.ACE.uci.edu).

I spoze I should make my old code available too.