Adding USB connection, drivers and a new postprocessor to a low cost CNC mill (Roland MDX-15 / MDX-20).
- Adding USB interface to main PCB
- Custom FTDI driver
- HTML post processor
- Batch files to control mill
During my parental leave it is a somewhat bigger project for me to use the professional CNC mill at work. Since I have a miniature CNC router at home I don’t use anymore, I figured now would be a good time to improve it. The reason that I don’t use it is mainly due to the ultra crappy software that Roland provides. Each time I have to mill something, I have to spend a lot of time tricking the software to do things that it originally doesn’t support, which is time consuming, frustrating and usually results in several trials until it works. The fact that the mill doesn’t have support for G-code means that you most likely can’t use the CAM programs that you prefer (some third party options exist, but I haven’t found any worth the money). On top of that the mill needs a RS-232 serial connection and doesn’t work directly with an usb2serial cable (with default drivers)… These are the reasons that the mill has been collecting dust on my attic for the last six years. This is a pity, because the mechanical hardware is actually quite good.
Adding USB interface
I hate cables and connectors that fall apart almost as much as I hate running back and forth between the mill and the PC. Therefore I wasn’t so fond of adding an usb2serial adapter at the end of the long serial cable. Instead I added an FTDI usb2serial (TTL) chip inside the machine. Now I can just plug it in and it will work. Any FTDI chip that has Rx, Tx, RTS, CTS, DTR and DSR will work. I used a Sony Ericsson dss-20 syncstation which has all the necessary components, but a standard FTDI breakout board will work just as well. The mill has a very limited memory for storing commands and therefore uses hardware flow control for the serial communication. To support this I soldered a wire between RTS and dsr and one wire between CTS and DTR on the FT232BL chip. Then four cables were attached to Tx, Rx, GND and to the CTS/DTR wire.
I hoped that I could attach the cables to the secondary side of the DS14C238 chip on the main PCB in the mill, but it didn’t work. Instead I attached them directly to the primary side of the MAX238 clone.
- Rx to pin5 (Din1)
- Tx to pad under pin6 (Rout1) **
- DTR/ CTS to pin 19 (Din3)
- GND to pin 8 (GND)
** please observe that pin6 has to be lifted from the pad to release the signal to the main H8 CPU (solder the cable on the pad under the pin, make sure the pin isn’t attached). When all the cables were attached I used hot glue to mount the USB board above the main board inside the mill. I also secured all the cables between the boards (see photo). A small hole was cut in the cover of the mill to attach the bend protection on the USB cable.
Adding custom FTDI drivers
If you search for mdx-20 and USB adaptor you will find that a lot of people have failed using a USB to RS232 adapter with the mill. They explain that the mill needs an old pc with a real serial port, since the USB protocol (package length) doesn’t work with the hardware flow control. – This is a myth! They are right that a USB serial cable doesn’t work with the default drivers. But you can find custom drivers on the Roland web site that works with a FTDI adaptor.
Reverse engineering a new postprocessor
With my USB connection for the mill, the hardware was up to date. The next thing to fix was the software. I really don’t like the Roland software package (modela, dr engrave, 3d engrave) that was already out of date when it was released 12 years ago. I didn’t want anything to do with the programs or the drivers, so I figured it was best to communicate directly to the mill itself. (It will then also work on all platforms, Linux, WindowsXP/7/8 etc). I created a fork of html-cam, which allows you to convert mill paths from a very simple neutral file format to g-code (also works on all platforms). See more details here. Instead of generating g-code the new versions now generates a Roland CNC mill file that can be sent directly to the serial port. I ran into quite a few problems during the development. To reverse engineer the protocol, I generated some simple curves and printed them with existing software. Instead of sending the file to the mill, I printed it to a file. Then it was a matter of understanding the generated code. The syntax is quite weird, but after a printout and some study with a highlight pen I got it to work. The only problem was that all the mill movements were too big. I guessed it was related to a mm to inch conversion, so I divided all the lengths with 2.54. Better, but when I measured some samples more precise, they were now slightly too small instead. I realized that a division of 2.5 gave a perfect result. Since the mill doesn’t handle decimal places the right coordinates of a position in mm has to be multiplied with 40 (100/2.5). I guess this is just the ratio of the stepper motors and have nothing to do with imperial/metrics conversion… Finally I got the 2D conversion to work and I quickly converted the drill operation as well. I can now export my mill paths from Rhino3d (using this script) to the neutral file format and then paste them in html cam (MDX version), set cutting parameters and generate mill code that can be directly sent to the com port.
Setting up the com port
Sending data from html-cam to the printer is really simple. First you need to make sure that the port is configured correctly (with the right custom drivers if you use a USB adapter, see above). Then the com port needs to be set up using the following command in a dos/command prompt:
Then all you need to do is copy the generated file to the port:
“copy /b mill.txt com3”
To make it even easier I have made some batch files to automate it for you. (download further down)
Manually moving the mill
When I set up the mill it is very useful to be able to move the router to an exact position. To do this I created another batch file with the following syntax:
movemill p,x,y,z p: com port (default=3) x,y,z: Coordinates * 10 "Example 2.55mm -> 25"
It moves the mill to the exact position that you specify. Please make sure that no obstacles are in the way of the spindle movement.
Example – make a PCB
Here is a step by step guide for how a PCB can be milled with the Roland MDX-20:
- Design the PCB (can be done in Rhino – see this guide for more details)
- Fixate FR3/4 substrate on mill (using double sided adhesive)
- Power on mill and leave “view mode”
- Mount engraving tool in mill
- Prepare and export mill paths for the PCB (in neutral file format)
- Move engraving tool 4,4 mm (x,y) over PCB using the batch file “movemill 3,40,40,0”
- Set Z=0 using the down key on the mill (press down repeatedly until you have contact – listen to the a change of sound)
- Paste engraving mill paths in html-cam and set cutting parameters: 1mm clearance 0mm cutting depth (-0.1 if the cut is too shallow) 2mm/s engage speed 4mm/s cut speed
- Press generate key and copy generated data to a text file named mill.txt
- Run mill.bat (configures com port and copies mill.txt to com port)
- Lean back and enjoy a PCB being made
- Repeat steps 4-11 if you need to drill the PCB and finally for cutting out the release path.
Use the files with care. I have tried them with good result, but I don’t take any responsibility if they generate any error. I recommend that you set z=0 above the workpiece first and mill in air to make sure everything goes as expected. When it works, reset zero and redo the operation. Make sure that the indata is correct and doesn’t contain any strange characters.
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.