Introduction: Cheap, Nice and Weird A4 Graph Plotter ($25 + Some Scrap)
Updated on Jun 2, 2014
My contest entry was accepted - now you can vote for this project if you like it! Thanks!
At the begining I have to warn you... The solution presented below is quite inefficient and weird. There're some foolish techniques used in this project, e.g. power output stage for the motors or my own PC software. All of these were created mainly for fun and getting skills. It might be quite hard to clone it, but I decided to publish it anyway - just want to share what I made ;). Check the video above to see how my plotter works!
It's hard to imagine, but in some high schools you still have to draw graphs by hand (computer is a devil's work, of course...). The situation was so annoying, that I decided to build a machine drawing graphs for me :D. It also applies when plotting any Inkscape drawings (exported to HPGL format).
The truth is, I needed a special kind of software - not only for controlling the machine, but also for designing graphs and saving them for future use. That's why I decided to write my own application instead of using an existing CNC software.
I used ATmega16 to control the machine - it receives data via an USB-RS232 converter (FT232) connected to the PC's USB port. The data is sent in frames using my own communication protocol, which will be explained later. For X and Y axis, I found two stepper motors in old scanners. They have an integrated gear, so the torque and resolution are increased without complicating the control. Z axis is a simple electromagnet (removed from an old printer, I suppose). All this stuff is powered by a dual-voltage power supply from a HP printer (+16V for logic and X axis, +32V for Y and Z).
My main goal was to learn as much as I can while building the machine - that's why I was reinventing the wheel a little bit ;).
Parts and tools needed
As I mentioned in the title, the project costs about $25 (I did all the shopping in Poland, prices might be different in other countries). Here's a short list (for info only - I'll describe all needed parts in next steps):
- controller parts: $7
- 3 sliders for X and Y axis: $4
- laser-cut plexiglass parts: $6
- furniture board (plotter's base): $5
- magnetic foil: $3
- some tiny parts (neodymium magnets, M3 screws and nuts): $1
Apart from that, you'll also need some parts removed from other devices. I had some old stuff and here's what I disassembled:
- bipolar stepper motor (M42SP-7) - an old Plustek scanner
- unipolar stepper motor (M35SP-7T) - as before
- electromagnet (TDS-F06A-03) - a laser printer
- dual-voltage power supply +16V/+32V (HP 0957-2094) - an old printer
The plotter was designed to be easy-to-build without any specialized tools. You'll need:
- soldering iron
- sandpaper (120-150 will be ok)
- hot glue gun
- some glue (superglue, wood glue, hot glue)
And one more thing before you go to next steps - I'm sorry for terrible photos ^^. My camera sucks and the only solution was to enable flash. Anyway, some of the photos were made with another camera, so they look nicer (I hope).
Step 1: Designing and Assembly Preparation
The project was made in Blender. Yep, that 3D modelling program. And yep, that is weird :D. Actually the only reason is that I know its interface well, what is important since I had a lot of modelling, changing, modelling again... and then changing and starting again. Oh wait... did I mention changing? ^^
The attached file (.blend) was created in Blender 2.49 because I don't like the newer one's interface. I suggest you to download this version, open the file and look around the machine - the basic move can be achieved by using the mouse wheel, SHIFT and CTRL.
The green box is the power supply, the yellow one is the controller, and the blue one is an LCD display.
Amber parts are made of FR4 1mm laminate, and light-blue ones are laser-cut 3mm plexiglass.
Stepper motors, electromagnet and limit switches are dark-grey colored.
There're also some M3 screws, nuts and spacers. And, of course, a fineliner.
All this stuff is mounted on 18mm furniture board (can't name that color, sorry...).
Buying the parts
First of all, you'll need some 18mm furniture board. Buy any color you like - but personally, there's some beauty in black. Here's the dimensions in cm: 35x49, 21x7, 7x7. The last two pieces will be used as a platform for electronics (controller, LCD and power supply).
You'll also need to laser-cut the attached PDF file. Don't worry, it's very cheap at present (even in Poland :D). Just make sure you order 3mm plexiglass.
A word about sliders for X and Y axis - they're just regular ball bearing drawer runners. They're cheap and very precise. Just make sure they are the same dimensions as mine (about 9mm height, 16mm width and 310mm length). You also may have to change grease if motors would be too weak to move the sliders.
Step 2: Making the Controller
Usually, regular CNC controller is just a power amplifier. It is actually controlled by PC (through LPT port). As you can see, this controller is much more complex. It's because PC just sends commands, which are executed by AVR.
Peripherals are controlled by ATmega16. It controls stepper motors (with ULN2803 and L293D) and electromagnet (with IRLML2502). It also monitors limiting switches (JP4) and sends data to LCD.
To communicate with PC, I used FT232RL chip (USB-UART converter). I use my own communication "protocol" to easily send both commands and raw data. Those two TCMT1109 optocouplers are used to electrically isolate PC from the controller (because I accidentally burned ATmega once ^^). USB-UART converter needs to be reprogrammed with FT Prog using XML file attached below. Without doing it LEDs won't indicate what they're supposed to. You can do it when all FT232 parts are soldered.
There are also 4 switches on the PCB. One is for reseting the processor (it was useful while testing), but the rest was mounted for future use to communicate with user. For now the middle switch ("OK") is used to accept the starting command (I'll write more about it later).
Making the PCB
After you etch the PCB, you can tin it (for example with regular solder). I did it with Lichtenberg's alloy - awesomeness level >9000 :D. I suggest you to solder in order shown in the pictures. Here's the part list:
- TCMT1109 x2
- 100 x3
- 1k x2
- 2k4 x2
- 4k7 x3
- 22p x2
- 100n x4
- BC857 x2
- LED RED
- LED GREEN x2
- Pin headers:
- 1x2 x4
- 1x6 x2
- jumper x2
- 5k potentiometer
- 16MHz crystal
- momentary switch x4
- USB mini B connector
- AK500/3 connector
- 2-channel switch
- 16x2 LCD display
The last photo presents my mistake while designing the controller. I forgot the pullup resistors for optocouplers' outputs. That was extremely decreasing transmission speed, so I had to solder 2 additional resistors. But don't worry, that was fixed and the PCB in rar is complete.
Programming the AVR
The file attached below contains PCB project in Eagle, software written in C, compiled hex file and XML file for FT232RL.
As you can see, there're 6 extra pads in the PCB. You are able to program the AVR with them - just solder some wires (they're described in Eagle file, so make sure you connect propper lines. Before you program the chip, set its fusebits to:
- low: 0xEE
- high: 0x99
They're just default values with changed CKSEL bits to 16MHz external crystal.
Some info about source code
It's not so easy to control all this stuff by just one AVR. The most difficult part was generating XY movement signals when both X and Y axis were in move. 16MHz crystal was almost too slow, but eventually it's working quite good.
The second hard part was communication with PC. I had to write my own communication protocol via UART. It's similar to AT commands, but requires much less memory and it's faster, since its command codes and arguments are single bytes (instead of strings, like in AT).
The source code was compiled with avr-gcc. It's commented well, I suppose, but I know it's still easy to get lost. There are some additional functions which practically aren't used - for example drawing rectangle, arc or some text. I wrote it just to get some skills ;). Anyway, you still will be able to execute these commands by "command-line window" in PC software to see the effects.
Step 3: Electromagnet Holder
It's time to build mechanical part of the machine... we'll start from Z axis.
First of all, find plexiglass parts presented on the first picture. Besides that, you'll need 4 M3 screws and nuts and 3 pieces of laminate. Just cut them with scissors. Their dimensions should be similar, but not have to be equal.
On the second picture you can see how bad the parts were cut. Apparently someone didn't take into account the width of the laser beam. Actually, all parts are a bit smaller than I ordered... Anyway, I had to wipe off the sides of this part with sandpaper.
Let's start gluing! I used superglue for all plexiglass parts. Next, you need to glue the smaller laminate rectangle. It's just a spacing between plexiglass and electromagnet. You can see that I modified the holes for screws. As I said, parts were a little out of scale and electromagnet didn't fit. For now, leave the rest of laminate parts. We will use them in the next step.
On the last photo, there's an additional part mounted with 2 screws. It will be used to hold the paper, but we'll do it later.
Step 4: Y Axis
Use the technique presented before to glue all the parts. Blender file will be helpful if you feel lost.
When gluing plexiglass to the slider, make the surfaces more rugged with sandpaper. Just make sure that no metal filings fell inside the slider. After that, you should clean the surfaces with isopropanol (for the metal one you can also use acetone).
Mounting the toothed belt
The simplest way to do it is to use a small zip tie. Zip the first end to the electromagnet holder (pass the belt through those two rectangular holes). Then, place the belt on the gears, stretch it and zip the end just like the first one. Make sure it isn't stretched too loose neither too tight.
Mounting the limit switches
Glue the limit switches just like presented on the pictures (about 3mm beyond the plexiglass). This red-brown cable is dragged inside the slider. Now we will need the laminate parts from the previous step. Glue it to the electromagnet box so they can click the switches.
Soldering the diode and some cables
As you can see in the photo, I soldered a diode nearby the coil. When a coil is changing its state, it may generate high voltage. The diode just shorts this voltage spike. It's very important to solder the wires corectly - diode's cathode must be connected to positive potential - for me it's a yellow cable.
On the next photo there's a description and colors of all cables. There are stepper motor cables (Y+, Y1, Y2, Y3, Y4), electromagnet cables (Z+, Z-) and limit switches cables (2x Ymin, 2x Ymax). Ymin is a switch nearby the motor.
The last photo presents a 12-wire cable with description of its connections. The red cable indicates the Z+ line, what makes it harder to mistake the direction. You can glue the header with glue gun to make it more safe.
Step 5: X Axis
And here comes the most difficult step...
You need to mount two sliders as parallel as possible. First of all, sand the sliders' surfaces. You can also sand the base a bit. After cleaning, use wood glue (or similar) to stick the first slider directly at the edge of the base. The picture above shows the dimensions.
To stick the second slider, you'll need something with 242 mm width. It must have parallel edges. As you could see, I'm not always can explain what you need to do. Just follow the images :).
Mounting the Y axis
Wait some time to make sure parallel sliders are glued well. After that - as always - sand and clean the surfaces. Use super glue for this (because of plexiglass). To measure the right angle, use the furniture board base - it should match. Try to glue it as perpendicular as you can, because this affects the look of all the drawings. It's important not to move the sliders until it's completely glued (give it a couple of hours).
Mounting the X stepper motor and limit switches
Meanwhile, you can mount the X motor. Just follow the pictures. Gray 12-wire cable can be glued to the base with wood glue.
Step 6: Fineliner Ending and Paper Holder
Honestly, this step was improvised by me. This white "arm" is made of 5mm foamed PVC. It can be made of anything, I just had nothing else to do this.
The laminate parts have an 8mm hole, which is perfect for my fineliner. Use hot glue gun to mount it. The fineliner should be gently pressed against the sheet by the arm (due to the spring placed at the back of the electromagnet). You may have to repeat the gluing several times.
When you finish the first laminate part, place the PVC arm and the second part and glue it. After the glue cools, you should be able to pull the arm with a little resistance. Then glue it to the electromagnet's ending.
Mounting the paper holder
This part is designed to prevent paper wrinkling. As I said - I improvised a lot in this step :). Follow me!
I decided to mount a magnetic foil as a working area. It has a smoother surface than furniture board and now I can fasten the sheet using small neodymium magnets. If you also want to do it, then you should mount the foil before you start this step. Unfortunately I forgot to take a picture of it...
Step 7: Mounting All Together
On the second photo you can see a "bridge" made of laminate - it's made because the slider may catch on cables. There're also two 5W 15Ohm resistors soldered in series with the X stepper motor's coils. I had to lower the motor's current, but I moved these resistors later (shown in the last two photos). Just connect every goldpin socket as presented above.
Mounting the sheet holders
The sheet needs to be holded in constant position. Use scissors to cut these "corners" in laminate and sand them to about 0.2mm height. I mounted them with double-sided adhesive tape, set the exact positions and then glued with super glue. To determine positions, you need to draw lines from begining to end of each axis (simply remove the toothed belts, insert the pen and move it by hand along each axis).
Step 8: PC Software
As I mention in the intro, I had to write my own software. It's my first app in Visual C#, so I think it's full of mistakes ^^. I've never write multi-thread applications and I'm almost sure that many of my solutions are "more single-thread".
The application was written to simply design multiple charts and communicate with the controller via virtual COM port. In the attached file, there is full project ready to open in Visual C#. It is quite well commented - but, unfortunately, in polish only. The whole app is in polish, too. There is too much to translate and I'm pretty sure that noone will use this solution anyway :D.
Here is the list of available commands in command line window:
- returnxy - returns to the home position setz z - lowers (z=0) or raises (z=1) the pen
- setxy x y - moves the pen at specified position (in mm)
- _setxy x y - moves the pen at specified position (in steps, check application settings)
- getz - returns 1 if pen is raised, 0 otherwise
- getxy - returns pen's position (in mm)
- selectpen - waits until user clicks OK button
- rect x1 y1 x2 y2 - draws a rectangle based on 2 opposite vertices (in mm)
- arc x y r a1 a2 t - draws an arc with center at (x,y), radius r, begining angle a1 and ending angle a2 (from horizontal); draws a regular arc (t=0) or a pie (t=1) - values in mm and degrees
- text x y size spacing text - draws some text at (x,y), of given size and character spacing
Almost forgot. To run the application, you need .NET Framework 4 installed.
Updated on July 21, 2014
At your request, I decided to translate the application. Well, maybe it's not perfect, but most features are now in english.
Step 9: Final Thoughts
This instructable shows an alternative way to CNC control. I don't urge anyone to use solutions presented in previous steps. I just made something and I find it interesting enough to show here. But it doesn't change the fact that this machine isn't effective. I've learned a lot while doing this project. It was amazing (and sometimes annoying). I'm glad I did a drawing machine completely by my own (weird) idea.
By the way - I proved that ATmega16 and the simplest power output stages are enough to plot A4 drawings! You don't even need a computer for it (if you get second AVR to read and parse data from SD card).
Anyway, controlling stepper motor should be improved. It generates huge amount of heat. Someone suggested that I should send a PWM signal while motors aren't moving (e.g. when waiting for a command). It's quite good, but this project is not worth next days of coding. ;)
Ok, it's time to end. I'll be glad to answer your questions. And if you interested in this project, maybe you'll like some of my others. Check this out: https://www.youtube.com/user/mopsiok .
Thanks for your time! Bye!
Third Prize in the
Gadget Hacking and Accessories Contest
1 Person Made This Project!
- Andrei_96i made it!