Motion control hardware
The motor controller is a custom built box that is a combination of custom printed circuit boards, the Pico Systems Universal Stepper Controller card, gecko G320 motor drives and internal power supply. The motor controller also links to the servos which require DC power and motor encoders, as well as limit switches which detect when the table its nearing the either maximum length of each ballscrew. The Universal Stepper Controller connects to the computer's parallel port via a DB-25 cable and the EMC2 software comes with a driver (documentation) that handles the driving this controller. There is also sets of EMC configuration files that are really useful for working with the USC card and EMC. The documentation for the connections on stepper controller is here and signals connectors control step and direction for each motor, as well as monitoring the status of the limit switches.
The best way to understand the motor controller is to take a look at this drawing is a circuit diagram of custom circuit board called the USC_bridge that serves as a link between most of the components of the motor controller. This shows how the USC_bridge connects to three connectors (P2, P4 and P5) of the Universal Stepper Controller. Part of the motivation for making the USC_bridge was that it broke the connects to the rest of the system into more logical components so for example the bridge has individual RJ-45 connectors to use "cat-5" ethernet cables to connect to each E3 servo motor encoders made by US Digital, as well as separate cat-5 connects to limit switches and emergency-stop switches. The limit switches are not mechanical switches but are actually composed of optocouplers - these also require a little extra on board circuitry to drive the emitter and detector on the optocoupler. The motor controller also has a 12vdc and 5 vdc power supply which is used to power the Universal Stepper Controller and the UCS_bridge.
Connections to the Gecko drives is straightforward and follows the documentation supplied by Gecko and the Universal Stepper Controller. Voltage comes in via 12 AWG wires from the motor power supply and connects to Gecko terminals (1 and 2, see pic). A 1000 uF capacitor is connected across these terminals and bundled in heat shrink tubing. The motor is connected to terminals 3, and a 15 amp fast blow fuse is placed in series with terminal 4 and then also run to the motor. (A pic of a gecko drive). The motor controller was desinged to run a total of four servos but only two motors are being used at this point.
Physical construction of the motor controller includes laser cut brackets that hold all boards, connectors, switches and 110v plug which leads to the 12/5vdc power supply. Many parts for the controller were cut by the laser, a svg file of all the parts are here. When building a box such as this it is always a good idea to mount everything on a board which serves as a platform for all the parts, and the platform can be dropped into a larger enclosure once you have debugged all the circutry. Be sure to follow the Gecko instructions to tune the Gecko servo motor controller.
The gang of Gecko motor drives receive power from the motor power supply and are driven with signals coming from the Pico Systems Universal Stepper control card. The control card is quite nice, except its not simple to connect using the wire adaptors that come with card. I pulled all of them out and put in plug/pin connectors that lead to all the other components. The control card is shown at the top of this pic, with wiring connectors.
The backend of the motion controller has various connects going to my monster sized servos. Management of connections are much more intelligently handled than my first generation system. There was a significantly larger amount of spagetti between all the OEM boards.
CNC motor power supply
The laser has a cnc table that moves parts around a stationary beam source.
A table of this size required building fairly large power supply to drive the table's servos.
This documentation describing power supply formulary says that two servos requiring 10A should never exceed 2 * 10 * 67%, or 13.4A.
The manufacture Plitron sells toroidal transformers. They have some useful technical notes. To calulate the desired transformer voltage I used the formula: (68VDC/ 1.4) = 48.6 VAC. However, when I constructed my power supply I used a formula supplied by Plitron which uses a slightly different method of:
(68VDC + 2) * 0.8 = 56 VAC.
Using this required that I make the modification described below. But since I went with a 55VAC toroid I went with a 13.4A * 55VAC = 743 VA rated toroid transformer. I purchased plitron transformer 117042201, with two 55v secondaries @ 9A each, $139.73.
At this amperage and using the formula ((80000 * I) / V) I estimate I would need around ((80000 * 18) / 68) = 21167 uF filter capacitor. I purchased five Model#: 3VTLM153M80V, 15000uF, 80V electrolytic caps on ebay and I'll wire two in parallel. I also purchased 4, 25 Amp 200 Volt bridge rectifiers,$4 each.
I made a spread sheet that helps perform these calculations.
The suply employs a full wave bridge circuit and put into a canibalized Sun harddrive enclosure. Its a nice box that comes with fans and a 5VDC power supply. Most wiring was done with 14 guage wire, terminals, and screw-down terminal blocks. After completion I looked at the voltage on my osciloscope and there was absolutely no ripple.
CAUTION: the capacitors in the supply store a lethal charge after powering up. The resulting discharge has the potential to be very unsafe. This is typically experienced when you're just hooking the thing up to the rest of circuit and comes in the form of a firecracker-sized explosion. The explosion is one thing, but worse was a recent experience when the caps were charged and then a lot of circuitry was fried when I hooked up the power supply. I lost two gecko drives and traces on my custom circuit board were vaporized.
To address this issue I employed a circuit with a bleeder resistor to discharge the main capacitors. Calculation of the bleeder resistor values was done using this spreadsheet. The values for the total capacitance, voltage stored in the caps, and ohms of the bleeder resistor is plugged into the sheet. The time for discharge, the power requirements of the resistor are then calculated. The correctly sized resistor was selected after plugging in different values. Many circuit designers hang the bleeder resistor across the caps, but in my case I added a relay which is disconnects the bleeder resistor when the 110 lines into the transformer are off. The result of this is the resistor discharges the caps when the relay is in the inactivated state. See this circuit diagram of full wave bridge power supply with bleeder resistor.
The plitron transformer produced too much voltage. I used the formula from their site. I recommend the formula for the transformer rating of:VDC = 1.4 * VAC
The voltage is 79vdc. Lowering the voltage of the transformer required that I remove some wraps from the Plitron torroid. I drilled out the epoxy core on the drill press in about ten minutes. The heat shrinkable wrapping around the windings completely prevented the epoxy from entering any windings. After chipping out the remaining epoxy block I removed the heat shrink wrap. The secondaries wires were very accessable and I didnt have any problem unwinding them.
I went with about 5 windings first prior to testing. I carefully checked for shorts between any of the exposed wires. (Its a bit of an act of faith that the enamel around the wires will prevent any shorting but it does the job.) After checking as much as I could, I hooked up the transformer and measured the voltage. The first time the voltage the wasnt even close. I unwrapped some more, eventually got to the right voltage, trimmed the secondary wires, soldered new connectors and put heat shrink tubing around solder joints.
Heatshrinkable sheet was wrapped around the donut. I didnt like that result but left the sheet on, and followed up with lots of wraps of electrical tape. I popped the transformer back in the power supply enclosure and I'm operating at the right voltage.
Many Computer Numerical Control (CNC) machines are driven using the Numerical control programming language. The Numerical Control is sometimes informally refered to as "G-code." G-codes is actually just the portion of them programming language that position the tool of the CNC machine. Other codes, such as M-codes serve to manage the machine. This is documentation for the G-codes that are supported in EMC.
Design of objects often requires that a bitmap image is converted to vector art - I have been using vectormagic recently and this software works extremely well. All design is done in a commercial software package called Rhino. Rhino has many features for 3D CAD. Typically I do design in 2D, and just describe objects as polylines. An example of parts being designed in Rhino is shown in the screenshot. (If you are interested in the coordinates for these parts you can parse them out of this svg file.) Rhino has layers, similar to AutoCAD, and I use two custom layers called to describe parts (shown with blue lines) and cuts (red lines). Both parts and cuts end up being cut, but the software that converts the Rhino files finds all the cuts inside of each part, cuts those first, and then does the cuts the outside perimeter of the part. Small parts fall through the supports of the laser table, so its useful to make the inner cuts before releasing the part from the steel plate.
Rhino also allows you to write plug-in scripts - and the export of the data in Rhino is done using a vb-script that is launched to a menu button on the Rhino interface.
Motion control software
The control software for my system uses EMC2 an open source package that runs on linux, comes with .iso files that you can load onto a CD and can be booted directly from disk under Ubuntu. It also has tons of reasonable quality documentation. The use of EMC2 to drive the laser is described here. EMC2 has an incredible degree of flexibility to configure it to communicate with physical devices using the Hardware Abstraction Layer. All of the code that enables EMC to interface with the laser and the CNC table is available here.
EMC is shipped with several interfaces. I use Axis. Axis has a lot of great features including the ability to customize panels. I have embedded a menu item in axis that launches a tcl window that makes a call to a perl program that converts the output of Rhino over to G-codes. This is accomplished using an open source library called openNURBS which handles parsing of the Rhino files. My toolpath progrm opens the Rhino file, makes a call to the openNURBS executable that parses the Rhino file, and it then finds all the parts and cuts. A traveling salesman program is used to create the tool path for all the cuts, and then the goes on to write G-code [example].
A summary of the process flow:
- On Windows laptop:
- vectormagic for bitmap to vector art.
- Rhino - CAD program.
- A vb-script exports data from Rhino.
- Laptop is on the LAN.
- On Linux machine:
- EMC motion control system.
- EMC is configured to interface with the laser, the appliance control system, and CNC motors.
- EMC launches Axis, the interface for motion control.
- A call in Axis launches a tcl window, and:
- Grabs exported data from Rhino CAD program resident on laptop.
- Launches perl tool path program.
- The perl program:
- Opens Rhino file output.
- Parses parts using openNURBS.
- Creates toolpath with call to traveling salesman program.
- Dumps g-code.
- Axis opens g-code, executes motion control.
- The g-code interpretter in EMC handles real-time control of the CNC table, laser, chiller and ventilation.