Thursday, August 30, 2012

Roland MDX-20 with Linux

I've been setting up a Makers' lab at work recently, and one of the bits of kit we have there is a Roland MDX-20, it's a great little CNC mill for the price (it comes with a piezo scanner attachment too, for all of your object duplication needs), however, as is often the case, the software provided by the manufacturer only runs on Windows.

One of the provided programs is something called the Modela Player 4, and this is what loads in your 3D model, generates the corresponding tool paths for the loaded model, and spits those out to the MDX-20 ready to carve out your Star-Trek communicator badge (or whatever it is you want to make).

Rather than having to deal with the extra baggage that having a Windows machine often entails, I thought that there must be some alternative path we could follow, and started looking around.

It turns out that the MDX-20 uses a language called RML-1 rather than the more commonly seen g-code, and because RML-1 is a little obscure and is not really used much elsewhere, a lot of the alternative software options don't support it.

(For the curious, there's a document describing the RML-1 language available here.)

Tempting as it was to immediately disappear down the rabbit-hole of RML-1, what we really wanted was to get the mill up and running so that people could use it ASAP, so an obvious thing to try was to get the Roland provided software running under WINE.

I installed the various bits of software that came on the CDs in the box, and then downloaded and installed the updates from the Roland website, here: http://download.rolanddg.jp/en/3d.html#mdx1520.

It turned out that the software runs reasonably well under the version of WINE I tested (1-4-0ubuntu4.1 running atop Ubuntu 12.04 LTS); the 3D model display worked, and the various dialogs seemed fine, and, apart from a couple of lockups that I couldn't really nail down to any particular cause, it seemed like we were on to a winner.

A little more about the set-up, software and hardware:  the MDX-20 itself only has an old-school 25-pin serial port for communications with a computer, so I used the supplied 25-pin to USB cable which appeared as /dev/ttyUSB0 as you would probably expect;   the Modela Player 4 software treats whatever mill it's talking to as though it were a printer (RML-1 is not a million miles away from HPGL so you can see why that happened).  WINE uses the host's CUPS printing system so after a short bit of fiddling to add the mill's USB serial port as a local printer under CUPS the mill appeared in the mill config screen of the Modela Player 4 software.

So I tried a test mill... oh boy, what a disaster.

The tool head was moving about all over the place, so fearing damage to to the milling bit I killed the job and reset the mill.  Double checking that I'd configured CUPS in what seemed to be the correct fashion I tried again, got the same result, and sat back with no small measure of sadness, more or less resigned to the fact that I'd have to relent and accept that my immediate future now included looking after a Windows machine in a shared lab.

That evening, while doing something entirely unrelated I had a thought:  the random tool head movements I'd witnessed earlier seemed to be getting slowly deeper with time (before I stopped it), what if what I'd been watching was the mill skipping through to later parts of the tool path ?  Like, say, if there was a buffering/flow-control problem between the host computer and the mill - that might explain it right ?

So I double-checked the serial port settings with stty but hardware flow control was allegedly set, thinking that perhaps the mill's internal buffer was overflowing (reasoning that the perhaps the Roland Windows driver had some other magical way of handling flow-control) I tried using pv (PipeViewer - awesome little util by the way) to rate limit the RML-1 program as it was sent to the mill.  Neither of these things made any difference whatsoever.

The last thing I tried was to ditch the USB cable entirely and just use a Real serial port instead...
...bingo: Now the mill is behaving sensibly* doing what it's told !  (* more on that in another post.)

Making it work for you too

So, the steps are:

  1. Throw the USB serial cable in the recycling-bin and use a real serial cable (you may have to buy a PCI/PCI-E serial card for this if you don't have one on your computer).
  2. Add a local serial printer to your CUPS setup, pointing to the serial port to which your mill is connected.  Set the serial port options to baud=9600 databits=8 parity=none flow=ctsrts.
    I did this step via the gnome printer entry in the control panel.
    When you add the printer entry, make sure to configure it as as a Raw Queue device - we don't want CUPS trying to make our RML-1 files look pretty before sending them to the mill !
  3. Edit /etc/cups/cupsd.conf and add the following line to it:
      Timeout 0
    This should help CUPS cope when you pause the mill for an extended period of time (otherwise CUPS will think the job has stalled and abort it.
  4. Edit /etc/cups/printers.conf and add/modify the ErrorPolicy line to say:
      ErrorPolicy abort-job
    otherwise CUPS may 'helpfully' decide to retry the whole job if you pause the mill.  The previous line should really obviate the need for this change, but we don't really want CUPS doing the retry under any circumstances.
  5. Install WINE if it's not already installed.Instructions for this vary by distribution, but for apt-based distros it's
        sudo apt-get install wine
  6. Install the Roland Modela Player 4 software from the provided CDs using WINE
  7. Download and install the update patches from the Roland website
  8. Run the installed Modela Player 4 software, configure the mill to use by selecting the new 'printer' you just added to cups


With a bit of luck you should now be up and running and ready to mill as many Star-Trek communicator badges as you could possibly want.





5 comments:

  1. That method looks cool, I should try this today!

    ReplyDelete
  2. This comment has been removed by a blog administrator.

    ReplyDelete
  3. Hard Rock Casino Hotel & Spa
    Hard Rock Hotel & Casino Lake 영천 출장안마 Tahoe. MapYRO's database 안산 출장마사지 of Hard Rock Hotel & Casino 아산 출장마사지 Lake Tahoe 서울특별 출장마사지 information, including 하남 출장안마 address, telephone number, map,

    ReplyDelete
  4. It is all high polish with a brushed finished center. If you need a titanium marriage ceremony ring with pizazz, that’s additionally busy in a great way|a good way|an efficient way}, this black titanium marriage ceremony band most likely going} an excellent fit. It has intricate yellow gold detailing around the ring, with a singular design of scrolls and waves. First factor's first, what's the common value of titanium melting point a man's titanium marriage ceremony band? You can discover gorgeous choices in our assortment that begin underneath $100, which is about where most high-quality titanium ring prices begin.

    ReplyDelete
  5. The applications to which this type of aluminum is utilized range from small and delicate to giant scale. high precision machining Aluminum metal sheet is good to be used in meals and chemical packaging. It does not react with many different supplies too easily and therefore is not a|there isn't any} concern for the aluminum sheet to negatively affect on} the meals.

    ReplyDelete