Introduction: Paxton Patterson CNC Lathe Controller Replacement
The lathe was originally purchased by Prairie Farm Schools in about 1990. It is a Paxton Patterson CNC training lathe. These were sold under various names and was manufactured by Sureline. Sears (Craftsman), National Camera (NatCam), Jensen Tools and Brookstone are some of the other brands. http://www.sherline.com/usedmach.htm.
The lathe came with an Apple IIe computer with a controller card and external 12 VDC 2 Amp power supply. Connections to the computer board from the lathe and power supply were through a 25 pin parallel port. The school also had the original manual with 11 of the 12 lessons.
Goal in retrofitting
The lathe still worked as a manual lathe but the Apple IIe, controller card and software was long gone. The school has a CNC plasma cutter, an X-carve engraver and a 3D printer. I wanted to get this lathe working for them too. Paxton Patterson no longer sells the lathe or supports it. I was referred to a company that would replace the stepper motors and add a new controller at a cost of $2500.00. An additional $800 was also required for computer software. That amount was not in the budget so I looked for other alternatives. Much of the software and hardware used in low end 3D printer is open source. The most appropriate looked like an Arduino Mega with a RAMPS 1.4 board and RipRap Discount LCD. Total cost $38. All the software needed was open source and free. The RAMPS board was designed for 12 VDC which matched the original and allowed the original power supply to be used. The SD card slot, LCD and click encoder allowed for use of the lathe without a computer being hooked up.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Parts Purchased
RAMPS 1.4 shield
RipRap Discount 4x20 LCD with click encoder and SD card slot
The above were sold as a package on eBay.com for about $32
If the above link doesn't work, a search on ebay.com for "RAMPS 1.4" will bring up many options. The link above was selling this package for $31.99 including shipping on March 13, 2016.
12 VDC 60mm x 60mm axial fan (on hand) and it is optional
http://www.ebay.com/itm/SANYO-DENKI-09R0612J401-AX... This one was $12.00 including shipping
25 pin female parallel port (ripped out of a dead computer mother board)
If purchasing a parallel port one like this might do. http://www.ebay.com/itm/2PCS-DR25-Female-25-pin-Pa...
10 wires (extras from other Arduino projects)
Here is an assortment of wires. http://www.ebay.com/itm/120pcs-Dupont-Wire-Female-...
A search for "Dupont jumper wires" will bring these up.
I also used some screws and pieces of wood all of which I had on hand.
Step 2: Existing Hardware
The original lathe still had the wiring intact. It terminated in a parallel port. This makes for an easy disconnect from the controller. The end was disassembled to expose which wire were attached to the various pins. 10 pins were used. 4 pins for each stepper motor and two for the 12 VDC power. The 5 pin DIN connectors going to the stepper motors were marked on both ends with tape to make connection in the future idiot resistant, yellow to yellow for the x axis and blue to blue for the Z axis.
Step 3: Checking the Stepper Motors
The windings on the steppers read 10.3 ohms. Measuring the ohms on these sets of pins on the parallel cable ends 1-2, 3-4, 5-6,7-8. There should be infinite ohms between any other combination of pins. If this is not the case check the wiring to the steppers.
Here is an image of the pinouts for a parallel port or 25 pin DIN with the pin number listed. http://www.technologyuk.net/telecommunications/co...
You can also check the steppers at the 5 Pin DIN connector. The two pins left of center (Pin 1 and 4) should read about 10 ohms and pins to the right of center should read 10 ohms (Pins 3 and 5). The center pin is not used.
Here is an image of the pinouts. It is sort of an odd numbering scheme.
Step 4: Parallel Port Connections
I ripped a parallel port out of a dead PC computer by snipping off the leads that were soldered to the board. The excess plastic supports were filed off and the mounting holes were enlarged. To the 10 pins in the picture solder wires. I used the 4 wire leads that came with my I2C LCD screens used in other projects. The colors are not important but it is best to match the first four colors with the four just after those. The first four plug into the X-axis the second set of four into the Y-axis. The Y axis is used because problems with gcode arcs not be implemented for the Z axis. The red power wire gets soldered to pin 14 and black to 16. Pin 15 is not used. These get connected to the first and second screw terminals on the RAMPS board. The 12 VDC fan is connected directly to the same two terminals. The Fritzing image should help with locating which wires connect to which pins on the parallel port. Fritzing didn't have a RAMPS board but this red shield has about the same footprint.
Step 5: Jumpers
Each of the steppers can be set to single step, half steps, 1/4 steps … This is done by adding jumpers under each of the plug in modules for X,Y,Z and E axis. Only the X and Y axis need to have jumpers added. Two of the three jumpers need to be added in the spaces closest to the power supply screw terminals. In the image, jumpers have been added to the Z axis location to illustrate the location.
Step 6: Stepper Control Modules
The unit I purchased came with 5 modules and 5 heatsinks. Remove the paper from the back of two of the heatsinks and stick them on the top of two of the modules. Place the modules in the sockets for axis X and Y.
Step 7: Creating an Enclosure for the LCD Screen
There are many LCD enclosures on thingiverse.com I used this design http://www.thingiverse.com/thing:320117 Prior to making this box we also cut out a panel on the schools x-carve CNC engraver. The dimensions were off for the button placement so we went with this 3D print that worked great. Note that the small black button below the knob is an emergency stop. The button was part of the 3D print.
Step 8: Mounting the Arduino Mega and Parallel Port
How and where the Arduino Mega and parallel port is mounted is up to you. In this case the Arduino was mounted vertically on the middle board near the bottom. It was mounted with four 1/2" #4 sheet metal screws and held off the wood board with four 1/4" long sections of aquarium bubbler tubing.
The parallel port was mounted above the Arduino Mega. It was mounted tight to the wood board with two 1/2" #4 sheet metal screws. The ports base was flush with the edge of the wood board so that the pins and metal shield extended out past the wood. If using a cooling fan make sure the wires going to the stepper modules do not get in the way of the fan blades.
Step 9: Controller Enclosure and Power Supply Holder
There is nothing special about the design of this enclosure. I was thrown together just to hold the power supply LCD and RAMPS board. It will become a student project to design a better box.
If you want to copy this box the dimensions are as follows;
Bottom board 6.5" by 10"
Rear board 6.5" by 5.5"
Middle board 6.5" by 4.5" My boards are a full 1" thick so if you use normal 3/4" boards adjust the 4.5" to 4.75"
Top panel is 6.5" by 4.75" Measure your enclosure before cutting. This one is a leftover piece of double wall greenhouse plastic. It could be anything but the hardware can be seen through it.
The rear board has a 2" diameter hole cut for the fan. The hole is positioned over the heatsinks of the RAMPS board and at least high enough so the bottom of the hole is above the bottom board.
The middle board has a 7/8" hole near the center and centered about 1.25" below the top. This hole can be larger but it would be hard to feed the LCD cables through if it is smaller. This board is mounted 6" back from the front. This leaves a bit more than an inch behind the power supply for the vent and to allow the power cord a place to exit.
The LCD enclosure is attached to the middle board with four 1.25" sheetrock screws. With the dimensions of the boards above the LCD enclosure pins the power supply in place. It was a bit too tight and the 3/4" holes were drilled in the bottom board for the feet of the power supply so it could all fit together. This could be avoided if the back and middle pieces were 3/8" or 1/2" taller.
The fan cover could be replaced with a real metal fan cover but I had a 3D printer screen from another project. It didn't work on that one but does work here. The .stl file and OpenScad files are attached. The uploaded files have a heavier and more widely spaced screen which should hold up better and allow air to flow better. The fanScreen.scad file can be open with OpenScad and adjustments made to the overall size or screen dimensions.
Step 10: Software for the Hardware
I choose Marlin as the software to run on the Arduino Mega. It is an offshoot or “fork” of the GBRL software that runs many of the 3D printers. It had the advantage of being set up for 12 VDC, had many different screen choices and could be set up to run gcode standalone off of a SD card. It turns out it is also one of the very few software packages that can’t be set to take inch measurements instead of millimeters. The software was designed to control a 3D printer. In configuring it for a lathe some things like the hardware and software stops needed to be turned off, stepper motor setting changed and the proper LCD screen type picked. 3D printers only understand gcode arcs in the the XY plane so some of the base code needed to be altered so arcs in the XZ plane used by the lathe would work. The LCD screen and click encoder did not work correctly with the latest version of Marlin so a slightly older version was used. The software needs to be compiled by the Arduino IDE and uploaded to the Arduino Mega. A copy of the functioning Arduino sketch or code is available for download. All the files are in the MarlinCNCLathe.zip file. It should unzip and make a Marlin folder which should be copied to your Arduino sketches folder. All changes in the files are commented with “GHA” next to them.
Arduino software can be downloaded here https://www.arduino.cc/en/Main/Software
This webpage and the ones linked from it will get you up and running with the Arduino IDE software https://www.arduino.cc/en/Guide/HomePage
There are many tutorials on uploading a sketch to an Arduino. Here is a simple one http://www.dummies.com/how-to/content/how-to-uplo...
Step 11: Computer Software
For testing no software is needed. 11 of the original 12 lesson’s gcode were typed up with conversions to mm. They can be downloaded and copied onto a SD card and run using the LCD screen and encoder knob.
The "CNC Lathe lessons gcode.zip" contains two folders. One has the 11 lesson with just the gcode file, the other has the same lessons but each line has the comments with the original gcode in inch measurements and comments explaining the line of code.
Very simple gcode creation can be done with a simple text editor. Notepad on Windows or TextWranger on the Macintosh work.
I created a FileMaker database that was used to create the millimeter versions of the lesson plans by inputting the inch measurements and converting them to mm. It also does several other changes. It can be downloaded and is the gcode2mm.fp12 file. It does require that you have a copy of FileMaker 12 or newer to open the file.
For controlling the lathe directly from a computer the PrintRun software can be downloaded here. https://github.com/kliment/Printrun click on the “Download ZIP” button. This software can be used to connect to the controller and jog the lathe in the X or Z direction. Gcode files can also be loaded into it and run on the lathe.
CAMotics is a gcode simulation program. It can load a gcode file and run it in simulation. Note that the automatic setting for the material obscures the cut path so the material dimensions need to be set manually. The material will display as a flat surface instead of the cylinder one would expect to see with a lathe. See the notes in the image of CAMotics.
When creating code for the lathe there are a few differences in the way that Marlin handles code from the way the Apple IIe software handled it. At the beginning of the code either Absolute and Incremental needs to be declared. Incremental was the default on the original software and declaring it was not needed. All measurements need to be converted to mm. Marlin handles G00 and G01 codes as the same code. G00 normally runs at the default speed for fast moves. This needs to be specifically set at the first move and after other slower moves. In the examples all G00 codes were changed to G01. F codes or feed rate codes were added to the first G00 code. Federate or F codes in the original were an arbitrary figure. Marlin uses mm/minute. My guess is that this is about 4 times the original F numbers.
For doing more complicated designs in gcode Inkscape can be used. It is a free program and with the built in plugin “gcode tools”. Gcode tools has support for lathes. At this point I have not created gcode in Inkscape and tried it on the lathe.
Here are some videos explaining gcodetools in Inkscape.
General display of gcodetools in Inkscape
Better video on Gcode tools and cnc lathes https://www.youtube.com/watch?v=FqU_h1NOWLk
Another way to create gcode and display better for lathe https://www.youtube.com/watch?v=gFO7BuBUwnk&ebc=A...