01.04
By: Chris Gilbank
Overview:
Have the cash to snag yourself a fancy new CNC milling machine? Neither do I. Upon this sad realization, I’ve devised the means to explore the functions of a real CNC machine in my own lab, and more importantly, on the cheap.
This little number sure is a treat. It would work considerably better on a new Etch-a-Sketch, but my son had one laying about, just itching to be “borrowed.” This one had already been subject to the abuse common to childrens toys, and as such, has some rough spots that result in uneven movement of the stylus. That being said, it can still match the skills of the Etch-a-Sketch Elite. Hooked yet? Here’s what you’ll need.
- Etch-a-Sketch – You can find these at just about any toy store, and quite possibly your nearest thrift store. You won’t need it in pristine condition, but make sure it’ll still draw to your liking.
- Motors – I’m using a pair of 6V, 5ohm, 1.8dps (degrees per step) unipolar stepper motors. I’m also only pumping 5V into them, mainly because that’s what I have handy. Now, if you had some big ceramic 5ohm resistors, attached them in series, and ran them at 12V DC, you’d be able to get a bit more performance, but that’s for another day. To mount the motors, I used some small pieces of rubber fuel line with hose clamps. This allows me to disconnect the motors and reset (shake) the “display.” A big enough vibrating motor may be able to alter the situation, but as I’ve stated earlier, I’m just working with parts at hand.
- Controller – My controller of choice is a 16f84a PIC microcontroller. There are some PIC’s out there that would do a much better job than this one, but it’s (once again) what I had on hand.
- Drivers – These are Motorolla MTP40N06EL power mosfets. They’re pretty obscure, and it took a lot of work to find their datasheets, but it was well worth it. A small local electronics shop recommended them to me. The input works off a standard TTL signal with a 47ohm resistor in series, and can switch 60V DC and 40 amps. Heck, you could stick as many as you wanted in parallel if you wanted to build a solid state welder (one more thing for the to-do list). I found them at the decent price of $1.25 each. Not bad for a “drive” by deal!
- PC Interfacing – This circuit interfaces via the PC’s Parallel port using pins 6-9 as control pins, and 18-25 as ground pins. Pins 2-5 can be used to connect a second identical circuit, and add two additional axis.
Schematic:
Note: I used an RC oscillator to drive the PIC because that’s what I had readily available. I didn’t want to bother with trying to get a crystal to oscillate, so I just went with what I knew worked. The RC oscillator is driving the PIC at about 4mhz. The 16f84a is capable of 20mhz with a crystal or resonator. If I manage to get my hands on one of these I’d give it a shot, but until then, 4mhz is all we get. I also had to tweak the computer’s timing to work with the slower PIC speed.
Code:
This code works fine, but it would need some work before it’s connected to an industrial machine. The most glaring problem is that the PIC will not take the same amount of time to execute the code every pass through the program, due to whether or not one or both of the motors have been instructed to move. This could also account for some of the hesitation I occasionally see. An easy solution to this would be to add delay loops into the code, when no real work needs to be done.
I wrote the code with versatility in mind. At the beginning of the code, I moved 0×04 into the variable “LASTSTEP”. If you desire half-stepping, change this to 0×08, then you’ll be able to modify the look up table at the end, with the proper step pattern for half-stepping.
Finished product:
So go build it already.

Cool project!
I think i may duplicate this to test my CNC motor controller setup and my cnc code =)
Great project!
What brand of break out board did you use?
I didn’t really use a break-out board. That small board you see in the top right corner is just a 25 pin D socket with terminal strips. Something I salvaged years ago and put into my box(s) of cool stuff. I could have just as easily (but not as neatly) cut the end off an old printer cord, beeped it out with a multi-meter, then plugged it into my board.
Once I etch/build my PCB of this circuit, I’ll probably use a spare printer cord.
[...] Step-a-Sketch project is sure to bring back some memories if you are around my age. I remember having one of these [...]
[...] Step-a-Sketch project is sure to bring back some memories if you are around my age. I remember having one of these [...]
[...] Step-a-Sketch project is sure to bring back some memories if you are around my age. I remember having one of these [...]
[...] Step-a-Sketch project is sure to bring back some memories if you are around my age. I remember having one of these [...]
This is cool! It just so happens im working on an XY table to go along with my CO2 laser I built so I can cut and engrave things. With this great idea I can hook some motors up to test my system without messing with the table. I sugest you check out an L298N h-bridge chip to drive the motors, and you should put protection diodes across the motor coils. I looked briefly at your code and you should also step your motors at the same time. This will fix the “will not take the same amount of time to execute the code every pass through the program, due to whether or not one or both of the motors have been instructed to move” problem and make the drawing smoother and more accurate. (IE Motor coils share the same port byte and OR the step pattern into the byte. Also, here is some drawing algorithms which I use.
http://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm
http://en.wikipedia.org/wiki/Midpoint_circle_algorithm
So im gunna go run out and buy an etch-a-sketch right now.. Great Idea!
Stan
[...] Chris took one slightly battered Etch-a-Sketch, two unipolar stepper motors, and a handful of electronics and turned them into a virtual CNC machine called step-a-sketch. [...]
[...] Step-a-Sketch project is sure to bring back some memories if you’re around my age. I remember having one of these [...]
[...] Step-a-Sketch project is sure to bring back some memories if you are [...]
[...] Step-a-Sketch project is sure to bring back some memories if you are around my age. I remember having one of [...]
[...] Step-a-Sketch project is sure to bring back some memories if you are around my age. I remember having one of these [...]