Inexpensive LinuxCNC interface for MPCNC

We’re good. I know I’m wordy and over-qualify my statements sometimes… but I have trouble recalling what might have been said previously, so to be “safe”, I tend to say it again. I’m an “old school” engineer and we used to do prototyping stuff all the time in the lab… and we generally were hanging scopes and logic analyzers on all the signals so we could see what was going on. That’s largely why breakout boards exist…

Last question. I understand that limit switches are meant to be endstops that prevent an axis from crashing at either limit of travel.

The way the dual endstops work for MPCNC as Ryan configures it is to put them on one end of each axis and use them as 0,0 points of origin to ensure that each stepper/side of the axis are parallel to each other.

That’s how I use them to square the whole machine. They don’t function in this configuration as crash prevention endstops during operation though.

So how have you configured endstops if you have? I know that they are not a strict requirement but just make some things easy. I can just as easily configure physical stops to move my axes to at initial startup to square things.

Just trying to cover my bases. I have ordered the cheap breakout board and the CNC shield V3.

All this is being interested in exploring LinuxCNC because I really like Linux. I know I am going to continue to learn about microcontrollers too since my 3D printers all work this way and my existing MPCNC uses one and I want to continue to work with the firmware. For example, I am getting ready to update the firmware to put in the dimensions of my work surface so I can do the dual endstop auto square routine from farther away than 200 mm whereever I end up on the board.

For Marlin+CNC, endstops are just for squaring the machine and homing. If you go with LinuxCNC, things open up, as you can program your own responses to your endstops, so you could also have them act as hard limits.

It could be argued that since we’re running open loop steppers, hard limits do have some value compared to closed loop servos, although that in no way argues that limit switches are all that important for MPCNC designs. There are better stated arguments against limit switches elsewhere.

1 Like

I personally have never put endstops or limit switches on any of my machines. I’ve put hard stops on a couple of them to sqare up the gantry…

but that’s about it. I rehearse (air-mill) if I’m unsure whether a job is going to stay on the playing field but, most of the time, my jobs are small enough I stay safely out in the middle or start against the hard stops.

1 Like

Got the hardware. I have installed the Wheezy LinuxCNC distribution and played around on the simulation.

I’ve been watching videos and reading documentation. I figure I can get a lot of the configuration parameters from deciphering the Marlin firmware configuration. I am still trying to understand all the possibilities. This is the critical part of why I want to use LinuxCNC. It will require me to get to know the hardware and software configuration better.

Friday after work looks good through Sunday evening to give me a good chunk of time to devote to this. I have a project that takes about 1 and a half hours to do on the MPCNC and am just repeating that over and over. Just the setup time is needed and I can play the rest of the time. I’ve done four of these in a row and haven’t had any errors. Sub millimeter precision for a slip fit jewelry box. Ryan’s setup works right out of the gate and I am so happy that he has gotten all these parts to work together and we don’t really have to do much thinking!

4 Likes

You know how it goes. That you know you have been carrying around a rats nest of DVI/Serial/VGA//PS2 Mice and Keyboards/and DB25 cables for fifteen years along with an assortment of DC power cables just in case and now you don’t know where you put them. Will have to go back to work and go for a cable hunt. Minor setup. Will go to the thrift store if all else fails tomorrow.

Ok, found this at work. Brand new in the box cable. Some adapter terminators too and a few other odd cables like the SCSI. Now I can throw this box in recycling.

I assume it will work for the parallel port. Its got the DB25 connectors. I have no idea what I’m getting myself into.

Often those serial cables only have the serial lines populated (seven wires) rather than all 25. Check with a multimeter before you try to use it.

Thanks for the heads up. That may explain what the heck is going on that I am not getting the signals I need. Never thought about that. It’s been so long since I worked with serial and it was always the DB9 that I didn’t realize that the DB25 could be serial connections. It never stops. I had to make my own USB power cable for the breakout board because I didn’t have any USB type A on both ends. Weird that the BOB doesn’t have a type B on one end like printers or the bigger arduino shields can have.

Postscript: Yep, the cable I chose didn’t have all the strands. I opened up the cable that was still in the package and checked it out. Continuity on all 25 pins.

Scrounge/Marion,

Please recognize that the simple 2-board interface I’ve presented here isn’t the conventional way these boards – particularly the CNC shield w/o the Uno – are used. This was simply an idea I had for an inexpensive LinuxCNC interface – an ORIGINAL IDEA/CONCEPT – and you won’t find this particular wiring scheme and board combo anywhere else on the internet. You’re only going to confuse yourself going off and watching videos of these same components used as they NORMALLY are used.

Again, I’m not using the CNC shield as it is normally used… on purpose. I use the CNC shield WITHOUT the UNO (don’t need it… that’s what LinuxCNC is doing)… and the shield basically is just a way to conveniently mount and hook up the step-stick motor drivers. I could have used a prototyping board, a solderless breadboard, or other… but I would have basically had to wire all the connections just like what’s on the CNC shield already… so I used it instead. Please note that there are no active components on that shield (other than the drivers)… it’s just wiring, sockets, pins, a couple of screw terminals, and a reset button. There’s nothing magical about it. But it’s just very logically laid out, provides convenient pins for all the required signals, and was almost perfect for what I needed.

So you know what signals come out of BOB and you know what pins have that same function on the shield. It’s a simple matter, then, of hooking the corresponding signals together… X-step and X-direction to the shield’s X-step and X-direction… Y, same… and Z, same. All these signals are grouped together… in the upper-left corner of the shield as shown here

Use a board jumper to connect the EN/GND pins (a common enable for all the drivers), and then jumper wire the corresponding BOB signals to the shield’s step/dir pins down the line for each axis. Work with X/Y/Z first and it should look similar to this

All that remains is to hook up the parallel and USB cables, +12v motor power, and connect the stepper leads to the appropriate drivers and you’ve got all the required connections made for moving the X/Y/Z axes from LinuxCNC. Once you have LinuxCNC configured properly you should then be able to jog each axis, zero them out wherever, and then load and run jobs. You’ll also need to adjust the SCALE values to calibrate each axis. I cover most of this in my FT forum thread. The same basic information is in my FoamRipper thread on this forum but the photos got mangled/displaced, relative to the text, with the recent forum changeover and it’s harder to follow.

Please follow these StepConf instructions to set up your machine and the parallel port so that you get step and direction signals out on the correct pins for BOB. IIRC I used the Xylotex pre-set pinout… but I could be wrong as I don’t have my machine set up anymore. But the Sherline pre-set basically just swaps the step and direction pins for each axis so if one doesn’t work try the other. One of them should work. Work with just one axis at first and get it running… then you’ll know the step and direction signals are in the proper order.

I may drag out my LinuxCNC PC and set it up to confirm… as I also need to set up MPCNC “Henry” again. It’s sporting a new ERC-MPCNC needle cutter to test and needs a controller board and firmware… or LinuxCNC, again. It’d be reasonably easy to hook it back up. But you should be able to figure this out pretty easily as it’s really pretty straight-forward, once you get the right signals on the right pins.

– David

EDIT: Based on the silk-screened table on BOB, it appears the the Step (Clk) signal for X is on pin 2, and the Direction (CW) is on pin 3 in the parallel cable. Therefore it appears that the “Sherline” preset is the one to use in StepConf. My bad… :stuck_out_tongue_winking_eye:

2 Likes

That’s a cool idea! Wish I had thought about using a CNC shield before I bought my individual stepper drivers.

I’m going to see if I can run linuxcnc with a raspberry pi 4 and the Mesa 7i96 ethernet “bob”. I know the mesa card is relatively expensive (but also friggin awesome) but with the savings using a pi and an uno shield it might still be a viable option for budget builds.

I sure appreciate the help and now that I know understand a little bit more about this whole processes, I’ll try to write everything up and document the things I learned, the issues I have faced and I hope a working solution. I want to be clear that every problem has been my own ignorance and assumption rather than the difficulty or problem with LinuxCNC and these boards in general. Here are some beginner gaffes:

  1. Thinking that all DB25 cables actually had twenty-five wires from terminator to terminator. It’s been my first foray into parallel port hardware. Back in the day I just had to plug these in to printers and the struggle was setting up software. Hardware was fine. You just ignored the parallel port. And I didn’t have much experience with serial communication until I made my own cable for getting my computer connected to the serial port on my ETX90 telescope. My first experience with motor control. And I also did some serial stuff with MIDI. I thought it was always the DB9 connectors.

  2. I assumed that the A4988 drivers could work ok with the NEMA23s I had used with a tinyG. I was going to test these out first before I went to monkey around with the NEMA17s on the MPCNC. Now I understand the current rating of motors and current rating of drivers must be complementary. I was only thinking of voltage and knew that the 24v power supply I had would work with these boards and drivers. Looking up the specs of these motors I need higher rated drivers for the NEMA23s. Fortunately, I have a spare NEMA17 I can use to test with.

  3. That leaves me trying to decipher the signals coming from my parallel port. I am getting a direction signals, but don’t have the capacity to check the step signal well. Am working on that. I also need to double check this DB25 cable. I thought it had all the wires necessary, it might not. I am painstakingly trying to understand the use of a Harbor Freight multi-meter. I know, it is like using Papyrus for graphic designs.

  4. The LinuxCNC install and setup couldn’t be easier. I had no errors with the image I downloaded and installed. This is where I am most comfortable. I can follow an interface ok. It’s the mysterious hardware that throws me for a loop. I am so used to having my Linux machines all current, so it is weird to get an end-of-life distribution. Lots to learn about this aspect of the install.

  5. I am getting into the world of higher capacity motors and drivers, which seems to be the bread and butter of LinuxCNC. The arduino and this shield are most clearly paired and well-documented. I understand that this ecosystem requires a little less computing power when we are talking about three axes and small steppers.

  6. I am a bit flummoxed because I actually had two of the motors spinning quite sprightly, back forth as I tested in the Stepconf wizard. Then I added a third and fourth driver and motors and did the microstepping jumpers. After that it was nothing. I am getting power on the vmot 24v and the logic of 5v for the stepper drivers themselves. I am also getting the direction signal on the driver. And of course all this probing and poor connecting may have blown something or other.

  7. What is my goal? Not necessarily to use LinuxCNC to power my MPCNC, although I’d like to do that. Most importantly it is to learn this stuff at the hardware level. I want to understand the wiring, the signals that make steppers go, the current and voltage settings, the direction, the distance as traveled after computer steps, pulleys, rotation, all that stuff.

  8. I still have a lot to learn about the micro-controller ecosystem that is Marlin and the normal MPCNC world. I’m proceeding along with that and am getting ready to flash my firmware with two local changes: my machine name and the work dimensions of my bed. That is a good start I think.

  9. In the meanwhile I am have opened up Fusion360 again. I finally was able to reproduce my slip fit box in Fusion and get some gcode out at the end. Now I have to chase down the errors and get the MPCNC post-processor understood a bit better and see if I can get a machine ready gcode. One error I had was the way XYZ correspond to TOP/BOTTOM/FRONT. What I assumed on the start, going from what I have been used to in Onshape, wasn’t what I ended up with. Found the setting to switch that in the tool setup (I think that is what I did.)

So stay tuned for more sausage making and thanks @dkj4linux for the assistance in the PM and inviting this conversation to go forward in public.

Hrmm… Maybe someone should write up some documentation about using LinuxCNC for the adventurous MPCNC user. Nothing comprehensive, just what is needed to get started using professional-grade controller software with our humble rigs. Beyond that is a gentle nudge over to the LinuxCNC forums… :slight_smile:

1 Like

I certainly will do my best to share what I discover and when I am successful, to document a how to. I have done a little bit of browsing on the LinuxCNC forum. It’s still the elephant and the six blind men at the moment for me. I have found some bits and pieces but have not done nearly enough study to be fit in. Here is a good start.

That’s quite the laundry list and all over the map. I can’t be of help for most of it. If you will narrow your focus for the moment and concentrate on controlling a few steppers with LinuxCNC, then I can probably help. All the other stuff – right now – is just confusion and noise for our purposes here.

First… you don’t actually need to SEE the step signal to know they are working. You’ve said you’ve seen motion at times, so just trust that they are there for the moment.

Second… look at BOB and see if there is a silk-screened table on it. Either provide a photo or confirm that X-STEP (CLK) is pin 2 and X-DIR (CW) is on pin 3. If that is the case, select either the “Sherline” or “Xylotex” pre-set parallel port configuration when you get to that step in StepConf… whichever puts the X-Step signal on pin 2 and X-Direction on pin 3. It may not be “Sherline” as I thought… I just booted my LinuxCNC PC and I’m using the “Xylotex” pre-set.

stepconf-pinout

Also note that you really only need the first 7 wires in the parallel cable for XYZ use… if your parallel cable has those wires populated then you should be okay. Use your multimeter to insure continuity on those pins. That’s really all you need to know about the cable.

Third… work on getting ONE axis working at a time. Connect the parallel and USB cables to BOB. Hook up that one NEMA17 motor you have to the X stepper output of the shield. Hook up Motor power to the shield.

Fourth… run through StepConf, select “XYZ” for machine type, “Sherline” or “Xylotex” (whichever puts X-stop on pin 2) on the 2nd page… and on the 3rd page IIRC you can test the X axis. Take you best guess on motor steps (200), motor pulley teeth (16 or 20), etc… and then “Test the Axis”. When you can move the axis back and forth, predictably and reliably, you’re good for your parallel-port configuration and connections. Don’t worry at this point about calibration and accuracy of the movement… you just want discernible movement under control. Remove motor power, move the stepper to the Y-axis and repeat. Then test the Z-axis.

With all axes working you’re ready to move on… if not, let’s stop and figure out what’s going on. And, again, pictures would help immensely.

1 Like

Check out my FT thread for a reasonably detailed conversion of several machines (all using A4988/DRV8825 stepper drivers) to LinuxCNC. Marion’s adventures here should pretty much replicate everything I did back then to come up with a simple and inexpensive LinuxCNC interface to MPCNC.

1 Like


Thus far tonight:

I checked again my parallel port cable. All 25 pins connect from one end to another appropriately.

I checked the pinout of the breakout board. P2 is correct and should be X step. P3 should be X direction.

For the CNC shield, I checked the 24v and its good.

I checked again that the driver and the stepper are plugged in correctly.
I have all the jumpers from the breakout board connect to correct pins on the shield.

I assume I need a jumper on that first row that has EN/GND printed on them.

I have the jumpers from the BOB to the 5v/GND needed for these drivers.

I checked 5v to the breakout board and that is good.

Please excuse the camera shot of the computer screen. I have not set up the LinuxCNC to connect to the forum and I haven’t taken the time to find my password stashed somewhere.


Here is the parallel port configuration in Stepconf in LinuxCNC


Here is the test screen with the driver setup. I note I don’t have the Microstepping set to 16 as I have with the jumpers, will fix that, but that hasn’t mattered with/without jumpers. Nothing.

Anyway. I’m going to keep reading and puzzling over this. I have gone over the foam ripper topic on Flitetest and it confirms that I didn’t quite understand the requirements of the of the unipolar NEMA23s I started with. But it also confirms that it isn’t that complicated of a setup once you have the hardware parts. There is something that I am missing but I’ll find it.

Another thing to check is the continuity through those jumper wires. Just throwing that out there… while I’ve played with linuxcnc I’ve never used those boards so i’m no help otherwise

1 Like

What I can tell from your pictures looks pretty good. It looks as though you are using 1/8 microstepping?

Yes, that jumper for EN/GND needs to be in place.

Watch the A4988 driver closely… use your finger to determine it is running too hot to touch. Did you set its Vref… something in the 0.6v to 0.7v range should be fine? If you have extra A4988 modules and aren’t sure about the one you’re testing, you might swap in another to see if it helps. You are using that NEMA17 motor to test? You might consider using DRV8825 driver modules if you have them.

What’s the current rating on the +24v supply you are using? It needs to be several amps at least.

I did indeed get my LinuxCNC PC set up and connected to MPCNC “Henry”. All axes are now working but I’m getting twice the travel I command so will need to revisit my microstepping.

Just so you’ll know… my MPCNC is pretty stock (pre-Burly) and has series-connected steppers for the X/Y axes. I am using DRV8825 stepper driver modules and +12v motor voltage. I am also using the old Ubuntu 8.04 / EMC2 iso on an old Dell Dimension PC. DO NOT UPDATE when it notifies you updates are available… if it ain’t broke, don’t fix it.

– David

2 Likes

I have the jumpers set for 1/16 but I forgot to set the microstepping in the stepconf correctly.

I had one driver that got hot without even having the 24v to the shield on, just with the 5v logic from the USB on the BOB coming through that connection. Something was fried on that one. The driver I have plugged in now is set at .75. I have a prototyping board that I have an esp32 connected to that is driving a NEMA14 from an old scanner using an A4988. I have that motor driving a coin sorter I made. Tomorrow I’ll test each of these drivers in that known and working setup.

I like that Imperial Storm trooper white of “Henry”. I sure appreciate your going through the trouble. I spent some time going through that epic thread on Flitetest. That is quite the build and your generous contributions to that forum and needle cutting is inspiring.

Thanks for the kind words.

For grins… here’s the MPCNC and inexpensive LinuxCNC interface in action… air-milling our famous (infamous?) MPCNC crown…