Introduction: CNC Machine Control Upgrade on a Budget
Do you have an old hobby milling machine sitting idle due to low performance or even a new machine that didn't come with a controller? Or do you just want your machine to run faster or to control it using a Macintosh desktop computer? With this instructable, you will have a high performance machine at a budget price with control software running on your Mac desktop machine.
My solution features the Texas Instruments EX-TM4C1294XL µP board and the TI BOOST-DRV8711 high power stepper motor driver board. I mounted my controller directly to the back of my MaxNC-10 pictured above. It is a small (portable) three axis machine with a 0.1 hp AC-DC spindle motor. You can also make the controller as a stand-alone box probably using additional connectors for the stepper and spindle motor outputs.
I have upgraded the stepper motors conservatively to 6.2 volt steppers. The original "Step-Syn" 24 volt 5 wire motors were slow and couldn't be used with bi-polar, i.e., full-bridge, drivers without modification to isolate the phase windings - not worth the effort given the current low cost of stepper motors.
Note: Maximum stepper motor speed is generally not limited by motor size or power. Due to the high number of armature poles, typically 50, stepper motors can generate a high backEMF at a relatively low speed and the power supply voltage must overcome the backEMF. So the maximum motor speed will be roughly proportional to the power supply voltage divided by the DC motor voltage rating.
The high-performance TI BOOST-DRV8711 drivers that I will be using have a 52 volt, 4.5 amp/phase rating and should be able to handle steppers down to 2 volts or 0.5 ohm. I achieve up to 300 RPM matching the 6.2 volt motors with a 150 watt 36 volt supply, but you should get faster speeds using a 48 volt supply and 2-3 volt motors. The drivers also feature a 1/256 micro-step resolution for very smooth motor control.
This system configuration is supported by RiceCNC - a free download from the iTunes store. The app includes embedded firmware to download to the µP board and It supports both USB serial and ethernet communication between the Mac desktop host and the µP board. I generally use the ethernet connection as it provides high voltage isolation between the computer and motor power supply. I then plug the USB cable into a 5 volt power cube to power the µP board. However, will need to connect via the USB to configure the ethernet and install program updates.
The BOOST-DRV8711 accepts motion control commands via either a serial SPI connection or step and direction input pins. RiceCNC uses only the SPI commands to control motion. You will be able to use RiceCNC to configure the drivers but then control the motion with either RiceCNC or another motion control system. This is explained in more detail further on.
The EX-TM4C1294XL µP board can carry a BOOST-DRV8711 piggy-back on each of the two BoosterPack connectors. This may be sufficient for some machines. but most machines will need three or four motor driver and you will probably want to keep the piggy-back BoosterPack positions available for other expansion boards. The newly available Grove Base BoosterPack is especially useful for this application. Several inexpensive Grove sensor and output modules could be useful to add to your machine.
Additional drivers can be connected to the µP board using a backplane interconnect board as is covered in a following step.
Step 1: LaunchPad and BOOST-DRV8711 Configurations
In the next step, I will make a wire-wrap backplane interconnect board to carry and connect up to five additional BOOST-DRV8711 boards. The fifth position becomes available when the µP board is offset to use the BoosterPack 1 position as in the second picture. Although this configuration provides more connection options, it would also require a larger container than the one I used in the following steps. Most users will prefer the first, more nested, configuration and can omit the pins for the fifth driver board.
The interconnect board should be relatively easy for those with prototyping experience. Others may want to read a bit on prototyping techniques. Some developers may prefer to use 0.5mm magnet wire with a low temperature insulation that will melt back from the soldering iron and this technique would enable the use of pins with shorter tails.
Materials needed for the wire-wrap backplane interconnect board:
- Wire-wrap/unwrap tool
- 30 gauge wire-wrap wire
- edge type wire cutter
- drill for mounting holes
- 5x7 Prototyping PCB 0.1” hole centers (available through eBay in a 3 pack for $5.99)
- 100 single-row 0.25”sq. 0.1” center ww pins for BOOST-DRV8711. Sullins PBC36SACN or equivalent (quantity 4)
- 40 dual-row 0.25”sq. 0.1” center ww pins for BoosterPack. Sullins PBC36DACN or equivalent (quantity 4)
Step 2: The Backplane Carrier Board
The above pictures show my wire-wrap interconnect board to connect and mechanically support up to five additional BOOST-DRV8711 boards.
Keep the full 5” width of the prototype board. In my board above, I trimmed the board square, but you may want to keep some additional length to provide area for expansion with additional connectors and components. No components other than the pins are required but there may be many useful features and connector pinouts that you could add to your board. I went back to add a set of pins to my board for the Arduino compatible 2 Relay Module.
I added pins for both BoosterPack connectors for mechanical support, but I found that to be unnecessary. The LaunchPad is well supported by only one 40 pin connector and you can add 4-40 screw support with 7/16” spacers as the 1.8” dia. holes indicate. I only wired to BoosterPack 2 but you could pick up signals from either BoosterPack. Using BoosterPack 2 in the nested position enables the LaunchPad to be offset to the BoosterPack 1 connector. You also could omit the fifth BOOST-DRV8711 position at the top-center of the board if you will not be using it.
Populate the µP BoosterPack 2 connector with 2 pieces of the breakaway Sullins PBC36DACN and populate your BOOST-DRV8711 boards each with 2 pieces of the breakaway Sullins PBC36SACN. Place the components as desired on your prototype board and solder the pins in place. The boards will hold the pins straight while you solder. Now remove the boards and put in a save place while wire-wrapping.
Most machines will need at least power relays - one for the stepper motor power supply and one for the spindle motor. You could use Grove relay modules having the convenience of a prewired cable, but I prefer the Arduino compatible 2 Relay Module boards. They are a bit more heavy duty with 5 volt relays rather than 3 volt and have larger power screw terminals. Note: the Grove relays each use a typical bi-polar active high output, but for the 2 Relay Module boards you will need to configure the outputs active low open collector.
To use the 2 Relay Module boards, add a row of 5 pins to an exposed edge of your board and wire to B1 (+5 volts) and B2 (Ground) of the nearest BoosterPack connector. Also wire two GPIO outputs to the two relay inputs. I used B9 and B10. Why five pins when you only need to use four? To prevent reversed power if the non-polarized connector is connected backwards.
Now wire the required common pins for all BOOST-DRV8711 positions starting with the piggy-back position. Although not required, looping the last position back to piggy-back position will effectively shorten the signal path length and increase the maximum shift clock frequency. The pins that must be wired in common are:
Required Common Pins:
- A1 - 3.3 volt supply
- A7 - shift clock
- A8 - reset
- D1 - ground
- D6 - Serial Data In (SDI) or Master Out Slave In (MOSI)
- D7 - Serial Data Out (SDO) or Master In Slave Out (MISO)
Chip Select Pins:
Now discretely wire the chip select pin D10 for each of the additional BOOST-DRV8711 positions to an unused pin on the BoosterPack connector. I have assigned default pins in RiceCNC, but you can change the assignment. Most unused pins can be used, including analog capable pins, but you may want to use a pin assignment that will not conflict with a Grove Base BoosterPack on the same connector. I used the following pin assignments:
- Position 1 - C7
- Position 2 - C8
- Position 3 - D9
- Position 4 - C10
- Position 5 - D4
Potentiometer Analog Output Pin - A2
This BOOST-DRV8711 potentiometer analog output pin is unrelated to motor functions and has little usefulness for this application since the pots will normally be inaccessible. Also, if wired, the analog pin inputs would conflict with the analog inputs of a Grove Base on the same BoosterPack connector. I suggest that skip this step but if you want to use the pots then discretely wire the A2 pin of each additional BOOST-DRV8711 position to a BoosterPack analog capable pin B3 through B8.
nSleep - A6
The BOOST-DRV8711 nSleep input pin must be high for the 8711 driver chips to be enabled. The µP firmware will hold this pin high for the piggy-back position. For each additional position, you can either wire the A6 pin in common with the others or wire it directly to 3.3V - A1.
However you may want to bring this pin out to a connector and use a 1 KΩ pull-up resistor to 3.3V. A switch to ground will provide a manual override to remove holding current from the motor. This would be useful for users who prefer to make fine adjustments by turning the motor shaft directly by hand.
- Step - A9
- Direction - A10
The BOOST-DRV8711 accepts step and direction motion control both from input pins and from SPI command. The RiceCNC µP firmware controls motion for all positions using only the serial connection and holds these pins low for the piggy-back position. As with nSleep, you can wire this pin in common or wire it directly to ground D1.
However you may want to bring these pins out to a connector and use a 1 KΩ pull-down resistor to ground to prevent floating inputs. This connector would then enable control from motion control software other than RiceCNC. RiceCNC could still be used to configure the 8711 parameter registers and monitor the driver status but RiceCNC will not be able to keep track of the motor position or change the torque for accelerating, decelerating or constant speed. Only the holding current would be applied. Note: variable torque is an added feature of RiceCNC and not directly supported by the 8711.
Note: RiceCNC is working on adding support for a “slave” operation mode. In this mode step and direction signals from another motion control system could be input to the µP board rather than directly to the drivers. RiceCNC will then be able track the position for the remote input and adjust torque current for acceleration, deceleration, constant speed and holding.
- Bin1 D8
- Bin2 D9
These pins are used only for dual DC motor control mode currently unsupported by RiceCNC. They are reserved for future use and it is generally preferable to connect unused input pins to ground rather than let the inputs float. As with the Step and Direction pins, these pins can either be wired in common or wired to ground D1.
Step 3: Mounting and Enclosure
For the enclosure I used a Sterilite 1963 8.5" x 11" x 3" clear plastic storage box obtained from my local Home Depot. The box lid is rigidly mounted to my machine and the bottom becomes the removable dust cover. Components are supported by a fiber pressboard obtained from my local Dollar Tree. I drilled out the rivets to remove the clip from a clipboard. I then trimmed the webbing of Sterilite 1963 lid so that the pressboard would nest inside the lid.
The power supply is a PS1-150W-36 obtained from MPJA online. As noted earlier, the voltage is conservative for the BOOST-DRV8711 drivers. A 48 volt supply would yield higher motor speeds. I mounted the power supply to the right side of the pressboard. You will probable need to obtain short metric screws.
If you will be mounting the system to a machine then go ahead to layout the mounting. I removed the original die cast aluminum control box from the back of my MaxNC10 and used the same three tapped holes, longer screws with 1” nylon spacers and 1/8” nylon spacers between the pressboard and the lid. For a free-standing system add rubber feet but keep the 1” spacing for wire clearance.
Next mount your power relays adjacent to the power supply. I used the Arduino 2 Relay Module. You may need to temporarily unmount the power supply to drill holes. You can use either #4-40 machine screws or small wood screws with the pressboard.
Now add mounting studs for your backplane interconnect board. I used 3/4" long #4-40 screws, nuts and 1/4" spacers for my mounting studs.
Drill holes in the lid for power cable, spindle motor cable, stepper motor wires, and USB and ethernet cables. A step drill bit will make clean holes in the plastic. Drill between the edge of the lid and the edge of the pressboard being careful not to interfere with cover edge seal. Larger holes will remove some material from the pressboard edge.
Step 4: Connect Everything Up
Add your power wiring. Using a standard grounded line cord (you probably have one laying around), bring through a hole in the lid and connect the green Ground wire and the white neutral wires to the power supply. If using an Arduino 2 Relay Module, connect the line cord "hot" black wire to the common (middle) terminal of the first relay. Then connect the normally open (leftmost) terminal to the power supply "hot" input (probably the leftmost terminal). If using a Grove relay module, you only have normally open terminals, but they may be a bit small for your wire.
If you have an AC spindle motor, connect the motor neutral to the power supply neutral. Connect the motor "hot" to the second relay common terminal. The connect the normally open terminal to the power supply "hot" input. I also added manual switch to the hot side of my spindle motor connection for emergency stop and dry runs.
Go ahead to mount your backplane board and then mount an EK-TM4C1294XL µP board on backplane board. If using one or more 2 Relay Modules, make up four wire connecting cables and connect the relays. If using Grove relay modules, add a Grove Base to the LaunchPad and connect the relays.
You don't need AC power yet! Connect a USB cable to the LaunchPad and your computer. You will probably want a longer USB cable than the short one included with the LaunchPad. Configure the relay outputs in RiceCNC and test your relay operation. The modules will have an audible click in addition to red LEDs to confirm proper operation.
Now add your BOOST-DRV8711 driver boards to your backplane board, Use 18" wire lengths to connect each BOOST-DRV8711 power input to the power supply output, but don't connect your stepper motors just yet. Observe the polarity from the silkscreen - the BOOST-DRV8711 documentation pinout illustration shows it reversed.
Now you will need to plug in the AC line cord to test the driver boards. Unfortunately the 8711s will not respond without both 3 volt and motor power. Configure and verify the operation of the 8711s using RiceCNC. If they verify, you are in business! It is unlikely the boards will have a driver problem. If a board does not verify initialization but another does, remove power and swap board positions. This will determine is it is an 8711 problem (unlikely) or a configuration problem.
Once 8711 operation is verified, connect your stepper motors. I check the resistance and isolation of new motor phase windings, but it is unlikely to find a problem with motor wiring unless the motor has been overheated.
Optionally connect the LaunchPad ethernet through a router to your computer. You can use the ethernet cable and retractor that comes with LaunchPad.
Your project should now look something like the picture above.
I added a Grove Base to the BoosterPack 1 position to facilitate easy addition of limit switches and Grove modules. Several Grove modules could be useful for your system including high temperature probes to monitor motor temperature.
Keep me informed of your progress and suggestions,