This is an old revision of the document!
Published 16 Jul 2021
2D Plotter
As my first foray into the world of computer numerical control (CNC) machines, I thought I would build a 2D plotter from recycled CD/DVD drives. There are seemingly endless examples of these machines on the internet, some with quite detailed construction instructions (for a few examples see cdrom recycling). We might also call this style of device a “2D printer”, or “CNC plotter”, but I'll stick to “2D plotter”.
And in case it is not obvious what this device is, a plotter of this sort uses a pen to draw on a piece of paper. The machine either moves the pen or moves the paper or both. It needs an external source (eg a computer) to send it commands of what lines to draw - the computer converts images, diagrams, or even text, into a series of line drawing pen movement commands.
As a practical device, a plotter of this size and accuracy has limited real application, but building one certainly entails getting to grips with the fundamental concepts involved in CNC machines. And the same techniques can be used to construct a number of different CNC devices from laser engravers to 3D printers.
My objective is to construct this without using bought parts but instead maximising the usage of recycled hardware components. I expect the only new materials used would be glue, though I prefer to use screws rather than glue anyway. I could potentially use recycled h-bridge driver chips from the CD/DVD drives, but initially I intend to use an Arduino and new h-bridge drivers as the electronics.
Software needed consists of three parts.
The CD/DVD drive laser LED carriage assembly (sled) provides a ready-made motor-driven axis. So two CD/DVD drives can provide two independent axes. Somehow these need to be arranged to move a drawing platform in two directions, or a pen in one direction and the platform in the other, or leave the platform stationary and move the pen in two directions. The pen also needs to be raised and lowered, and this is perhaps the aspect that needs the most work creating a custom mechanism. The pen mechanism could be another CD/DVD sled, a linear motor, or a servo.
There seems to be three alternative motor types used in CD/DVD sleds; stepper motor, brushless motor with rotary encoder, and linear motor. Most commonly mini CNC projects use the stepper motor version of these sleds, probably because all can be driven with the same readily available hardware (H-bridge drivers). The other alternative motor types require further work determining the exact driver requirements.
The sleds are not designed to carry much weight, so configurations such as mounting one sled on the carriage of the other would be quite hard on the mechanism, though may work depending on the exact sled design. A common configuration is to have the sleds mounted at right angles in an “L” shape, the horizontal sled moving the drawing platform along an X-axis, and the vertical sled moving the pen along a Y-axis (and also holding the pen up/down mechanism). Again the weight of the pen raising mechanism needs to be minimal as it extends away from the sled and puts strain on the carriage.
To draw things accurately the mechanism needs to be reasonably rigid so that you can get repeatable positioning of the plotter pen. CD/DVD drives are usually mounted on rubber buffers, but replacing them with washers seems appropriate to get rigidity. There is some play in lead screw positioners, so exact positioning may depend upon the direction of carriage travel, if this proves to be a problem I suppose that I could program it to always approach from the same direction when positioning (eg overshoot the position then move back from the other direction).
The platform needs to be level and at right angles to the Y-axis so that the pen makes consistent contact with the drawing surface. Likewise, the pen needs to contact the surface at right angles so that we are not digging in when moving in one direction, then dragging the pen tip when moving back.
It is useful to have limit switches at the end of each axis so that the mechanism isn't damaged by over-runs, although CD/DVD mechanisms seem to be designed not to self destruct and are quite tolerant of this. Having limit switches on at least one end of the X and Y axes is useful for homing the mechanism on startup as the pen may be left in an unknown position from a previous job.
I have a number of old CD/DVD drives and chose to use Hitachi GD-8000 drives as I had two of them, which allows me to have identical mechanisms for the X and Y axes.
These drives have a mini stepper motor that drives the sled through a lead screw. The sled has a travel of about 37mm and a limit switch at one end.
I did not want to use additional materials to construct a frame to hold the sleds, so re-used the plastic chassis parts from the GD-8000 drives.
The sled assemblies were disassembled and reassembled with inflexible mounts. Wires were attached to the limit switches.
The horizontal sled forms the X-axis, and needs to be fixed in a level position and moves from front to back. The vertical sled is fixed at 90° to the base to form the Y-axis, and moves from side to side.
The X and Y stepper motors each have four wires, their limit switches have two wires each. The limit switches are normally open (“NO” contacts) and need to provide a low signal (0 V) when reached. So one side of each switch can be connected to a ground line (GND), and the other brought out to a connector to attach the Arduino. Continuing with the recycling theme, I used a 34 pin “IDE” to edge connector adapter from an old 5¼“ floppy disk drive. This has two rows of 17 pins, the bottom row are usually all connected together and grounded, but in this application they can be ignored. The top 17 are sufficient for connecting our two axes and a pen raising mechanism (yet to be designed!). The PCB edge connector is easy to solder wires to.
The wiring to the PCB to IDE adapter (used as a connector) is fairly arbitrary, simply determined here by the length of the pre-wired stepper motor cables:
| IDE pin | Connection |
|---|---|
| 2 | spare |
| 4 | Z limit switch |
| 6 | Y limit switch |
| 8 | X limit switch |
| 10 | Limit switch common (GND) |
| 12 | Z axis phase-b |
| 14 | Z axis phase-b |
| 16 | Z axis phase-a |
| 18 | Z axis phase-a |
| 20 | Y axis phase-b |
| 22 | Y axis phase-b |
| 24 | Y axis phase-a |
| 26 | Y axis phase-a |
| 28 | X axis phase-b |
| 30 | X axis phase-b |
| 32 | X axis phase-a |
| 34 | X axis phase-a |
Although I experimented with a number of Arduino G-code interpreters, I standardised on using the default Grbl Arduino pin assignments so that I didn't have to rewire things between experiments.
| Pin | Connection | Description |
|---|---|---|
| 2 | x_step | Step Y axis |
| 3 | y_step | Step Y axis |
| 4 | z_step | Step Z axis |
| 5 | x_dir | X step direction |
| 6 | y_dir | Y step direction |
| 7 | z_dir | Z step direction |
| 8 | step_disable | Disable steppers (power down steppers) |
| 9 | x_limit | X limit switch reached |
| 10 | y_limit | Y limit switch reached |
| 12 | z_limit | Z limit switch reached |
Grbl assumes the axis steppers are driven by an H-bridge stepper driver chip, if we want to drive them more directly (pulsing the two-phase windings in software) we will have to modify the code or user an alternative G-code interpreter (we might do this if we want to use some recycled electronics rather than new H-bridge drivers).
The drawing platform is fixed to the laser mount on the horizontal sled, and the plotting pen will be attached to the laser mount on the vertical sled.
A simple platform was made from scraps of wood then screwed to the former laser LED holder on the X-axis sled.
For testing purposes, a temporary fixed (no raising mechanism) pen holder was constructed from Meccano pieces:
As expected, construction of a pen raising/lowering mechanism requires a bit of work. I need something fairly light as it must be carried by the lower power Y-axis CD sled and it extends out across the plotter bed so exerts leverage on the sled too. The Arduino controller firmware expects to have stepper motors on all three axes, so that seemed to be the first choice for the pen lower/raise mechanism (effectively the Z axis of this plotter). I looked at using a lightweight CD sled from a laptop DVD drive - it has a very small (ie lightweight) stepper motor and a lightweight frame to hold it. But in trying to connect leads to the motor I broke one of the phase winding connections, so decided it was too fiddly to persevere with.
A look through my recycled collection of motors and solenoids found a couple of possibilities. One is a stepper from a 3.5” floppy disk drive, and the other is a 'sent' page marker from an old fax machine (used to stamp an 'X' on documents that pass through it to signify that they have been transmitted). The latter mechanism seems to be the simplest to physically mount, and already has a sort of pen holder attached.
The solenoid needs to have a buffer/driver as the Arduino cannot supply enough current to drive it and it also protects the Arduino output. There are many possible ways to drive this, but a simple recycled transistor does the job, The component values are not critical, and a wide range of NPN transistors will work in this circuit (the transistor used here7) is just what was too hand, not chosen for any particular characteristic. For more info on this sort of circuit see How to drive a solenoid, and transistor buffer circuit). :
The plotter hardware needs some way to receive instructions of what to draw, and turn those into plotter movements. G-code is often used as the instruction set, and Grbl software running on an Arduino is often used to interpret those instructions and convert them to movement of the plotter.
Grbl has many clever features and takes up most of the resources of an Arduino Uno, there are other G-code interpreters like Mini_CNC_Arduino_Plotter (simpler) and Not_grbl (simpler and faster).
As this is a learning exercise, I thought I'd try out Grbl, even though it is a bit of overkill for such minimal hardware. This software runs on Arduino UNO compatible boards with a ATmega328P processor (and has no doubt been ported to others). It can be downloaded as an Arduino IDE sketch and installed by compiling the grblUpload sketch from the examples folder.
You can communicate with the Grbl software on the plotter's Arduino controller through the Arduino IDE serial console, but for non-trivial drawing you need something that can send complete lists of instructions - a 'sender' program such as bCNC or UGS.
In the simpler G-code interpreters the configuration settings/parameters, for the particular hardware in use, are hard coded into the program - so it needs to be recompiled and downloaded to change anything. Grbl's settings and parameters can be set by sending commands, either via a serial console, or sender program. The command $$ lists the available settings. This is what I ended up with:
$0=100 (Step Pulse Length, μsec) $1=25 (Step Idle Delay, msec) $2=0 (Step Pulse Configuration) $3=1 (Axis Direction) $4=0 $5=0 $6=0 $10=31 $11=0.010 $12=0.002 $13=0 $20=0 (Soft Limits, Enable/Disable) $21=0 (Hard Limits, Enable/Disable) $22=0 (Homing Cycle, Enable/Disable) $23=3 $24=50.000 $25=50.000 $26=250 $27=1.000 $30=1000 $31=0 $32=0 $100=6.000 (X steps/mm) $101=6.000 (Y steps/mm) $102=6.000 (Z steps/mm) $110=500.000 (X - Max Rate, mm/min) $111=500.000 (Y - Max Rate, mm/min) $112=500.000 (Z - Max Rate, mm/min) $120=10.000 (X - Max Acceleration, mm/sec²) $121=10.000 (Y - Max Acceleration, mm/sec²) $122=10.000 (Z - Max Acceleration, mm/sec²) $130=37.000 (X - Max Travel, mm) $131=37.000 (Y - Max Travel, mm) $132=37.000 (Z - Max Travel, mm)
If any referenced page no longer exists, try looking for its URL on http://archive.org.