# Anyone Have Experience Connecting a MPG to LinuxCNC?



## devils4ever (Jan 27, 2022)

I'm thinking of adding a MPG (Manual Pulse Generator) to my LinuxCNC PC to get me away from the keyboard and make life simpler.

Has anyone added one?

How hard is it to do? Do I need to change a HAL file (or something)?

Which model of MPG?


----------



## graham-xrf (Jan 27, 2022)

Other than that I have always used Linux PCs, I don't (yet) understand what you need in the way of pulse generation, meaning what voltage, what pulse rate, what connected to, etc. We should start with setting out what exactly pulses you need.

Sure, with any Linux PC, you can have your own app, driven by your own commands, but as with all PCs, the interface to the outside world kit is the bit you need. Quite a lot depends if you have any spare routes, like a USB, or network connection, or Bluetooth, whatever.

My route to working outside kit has been Raspberry Pi, because it gives one a whole lot of options for doing stuff like making pulse trains, etc from the GPIO set of pins, and the various add-on PCBs one can get for a a few bucks from eBay. They have everything from signal generators, A/D converters, relay controllers, cameras, whatever. Of course, a $40 Raspberry Pi 4 runs the whole LinuxOS, and can easily run LinuxCNC by itself, and has two HDMI video outputs, 4 USBs, and BlueTooth, and Network, and WiFi, and has 40 GPIO pins, and you can browse the net for instructions from it, and have it play music as well!

But .. there are other ways. You can have a little Pi board be in the same room as your LinuxCNC machine, and have it connected via WiFi or Bluetooth, or USB, and be your pulse generator.

Suppose you opt to keep the Linux PC running LinuxCNC. There are lots of powerful little Raspberry Pi boards that can talk to any Linux Computer from the $4 Raspberry Pi Zero, right up to the $35 Pi4. Supply is a bit frenetic right now, because of how much of professional industry is using them. You might need to get creative, and fix it up with a little case and a 5V power supply, but most can steal some from the USB.

If I were into CNC, (and I will be one day), I would opt to put a Raspberry Pi in a box, with a heatsink, and a PSU, load up with Raspian (which is Debian), and get it to make my pulses. A cheap eBay GPIO add-on with opto-isolated interface would let me make pulses all the way up to direct motor control drivers. Python programming to control GPIO comes with it, and the software examples out there are free, and plentiful.

Have a look at the Pi site -> RaspBerry Pi boards
Google for Raspberry Pi signal generator projects, keywords "Raspberry Pi Pulse Generator"
Try the same link, and set to images.
There may be something you see that works for you.


----------



## jeffkash (Jan 27, 2022)

There is an article in the current issue of Digital Machinist magazine on adding a MPG (actually 3). The author uses a Raspberry Pi microcontroller to turn the MPG pulses into an USB keyboard data stream to interface with the CNC software .It is relatively easy to do, but it is helpful if you are comfortable with Raspberry Pi or Arduino.


----------



## devils4ever (Jan 27, 2022)

I think you misunderstood my intent. I want to be able to move the X, Y, and Z axis on my mill by using a remote pendant like this one I found on eBay. It is USB based.

I believe the hard part is getting LinuxCNC to accept and understand the MPG pendant. I would have to modify the HAL files or something like that. That's the part that I don't quite get.

I have that issue of Digital Machinist, but it wasn't clear how to hook it up to the LinuxCNC PC. I'll have to reread it.


----------



## RJSakowski (Jan 27, 2022)

Tormach's Path Pilot controller is based on LinuxCNC and uses a jog shuttle to accomplish what you want.  The jog shuttle interfaces with the controller PC via a USB port.  Beyond that, I have no knowledge but the presumption would be that it would be an option withing the LinuxCNC engine.


----------



## matthewsx (Jan 27, 2022)

Watching this, need to get my project back on track.


----------



## jeffkash (Jan 27, 2022)

What is the protocol of the remote pendant? If it mimics the keyboard commands that Linuxcnc expects, you are good to go. Just plug it into a USB port. If not, yes you need to modify a file in LinuxCNC to translate the pendant output to the commands linuxcnc expects.


----------



## devils4ever (Jan 27, 2022)

Don't know.


----------



## matthewsx (Jan 27, 2022)

From the source....



			MPG Pendant


----------



## devils4ever (Jan 27, 2022)

Hmm. I'm not sure about that one. It mentions connecting to a second parallel port. I don't have two, but I guess I could add one. I was hoping for USB to make things easier.

Thanks.


----------



## matthewsx (Jan 27, 2022)

Most of the ones advertised say they work with LinuxCNC, have you tried installing the XHC-WHB04B-6 driver









						USB mpg setup guidance
					

Howdy, Recently I changed my CNC mill from a Mach3/USB controller combo to a LinuxCNC 2.7 PC with a parallel port. I already managed to get all the...




					forum.linuxcnc.org
				




There's some YouTube videos out there too.

John


----------



## strantor (Jan 27, 2022)

I've purchased a MPG for my LinuxCNC mill but I haven't installed it yet. I will let you know when I do. The one I got is all "discrete" signals. No USB, no bluetooth. It has an open collector encoder output and all the switches and buttons are dry contact. This gives me the most flexibility. Loading drivers in Linux isn't so straightforward. Nothing about LinuxCNC is straightforward. I do not want to fight that fight. If I have enough IO on my Mesa board I'll wire it straight in. If not, I'll use an arduino or a PLC to accept the MPG signals and relay them to LinuxCNC over serial or something, maybe keyboard emulator.

What kind of controller are you using? Mesa boards? Some serial BOB? How much open i/o do you have?


----------



## devils4ever (Jan 28, 2022)

I haven't purchased anything yet. I was looking for advice and past experiences.

I did see that this one by vistacnc has a detailed installation guide and drivers for LinuxCNC. I might give it a try.


----------



## lustenaderj (Jan 30, 2022)

I have the P4-S from VistaCNC.  Quite simple, I just followed the directions that they provide for installing on LinuxCNC.  It works great, and is so much more convenient than a keyboard.



			vistaCNC


----------



## devils4ever (Jan 31, 2022)

lustenaderj: I talked to VistaCNC and they said that I would need to update the firmware in the MPG for LinuxCNC and then install the drivers on the motherboard. Sounded easy enough.

strantor: I have a motherboard with built-in parallel port connected to a BoB. Nothing fancy. Straightforward.


----------



## devils4ever (Feb 6, 2022)

I just placed the order for the P2-S MPG from VistaCNC. They said I need to upgrade the pendant firmware to LinuxCNC and install a driver on the PC.

Hope all this goes well!


----------



## devils4ever (Feb 17, 2022)

So, I updated the firmware in the pendant and installed the needed drivers on the PC. All works well, except the PC won't boot with the pendant plugged into the USB port. If I unplug the pendant, boot up, then plug in the pendant, it works fine.

Any ideas?


----------



## strantor (Feb 17, 2022)

devils4ever said:


> So, I updated the firmware in the pendant and installed the needed drivers on the PC. All works well, except the PC won't boot with the pendant plugged into the USB port. If I unplug the pendant, boot up, then plug in the pendant, it works fine.
> 
> Any ideas?


what does it say on the screen where it fails to boot?


----------



## matthewsx (Feb 17, 2022)

Change you boot order in BIOS


----------



## devils4ever (Feb 17, 2022)

strantor said:


> what does it say on the screen where it fails to boot?



[  8.12345678] CPU1: Not responding.
[16.12345678] CPU2: Not responding.


----------



## devils4ever (Feb 17, 2022)

matthewsx said:


> Change you boot order in BIOS



I have a Q1900B-ITX motherboard. I was able to get into the BIOS and look at the boot menu. The only boot option listed is the SSD. I don't even see an option to boot from the USB.


----------



## strantor (Feb 17, 2022)

devils4ever said:


> [  8.12345678] CPU1: Not responding.
> [16.12345678] CPU2: Not responding.


Oh, my. No, I'm sorry I have no idea. I was thinking one of two things, maybe it's recognizing the MPG as a USB drive and trying to boot from it, or it's failing to recognize the driver during boot. But this is something else.


----------



## matthewsx (Feb 18, 2022)

devils4ever said:


> I have a Q1900B-ITX motherboard. I was able to get into the BIOS and look at the boot menu. The only boot option listed is the SSD. I don't even see an option to boot from the USB.


How do you install your OS?


----------



## devils4ever (Feb 18, 2022)

IIRC, the OS was installed via USB stick to SSD.


----------



## devils4ever (Feb 22, 2022)

So, I'm seeing the ASUS BIOS screen flash on for a second, then I see the GRUB screen come on. After that, I get the "CPU Not responding" message. So, I'm thinking it's not a boot issue. The PC seems to be partially booting until the dreaded "CPU Not responding" message.

I'm at a lost for ideas and vistaCNC doesn't seem interested in helping me resolve this, unfortunately. They've ignored my email.

It's not the end of the world to plug in the USB cable after boot, but it's not very efficient either.

Any ideas?


----------



## Boswell (Feb 22, 2022)

I'm not much of a UNIX person but I see that GRUB is a boot loader application (GRand Unified Bootloader) I have never used it and know nothing about it but it seems like there is still a real possibility that at some point your system is trying to boot from the USB device, which in this case is the VISTA pendent. It still might be worth checking the ASIS BIOS to ensure that the boot from USB is either disabled or at least lower priority than the hard drive. Also look into how GRUB is configured to see if it has an option to use a USB boot and at least temporarily disable it.


----------



## devils4ever (Feb 22, 2022)

Yeah, I checked with the BIOS and the only thing listed as a boot source is the SSD.

You might be correct in thinking GRUB might be trying to boot from the USB. I'll look at that.


----------



## strantor (Feb 22, 2022)

devils4ever said:


> I'm thinking it's not a boot issue. The PC seems to be partially booting until the dreaded "CPU Not responding" message.
> 
> I'm at a lost for ideas and vistaCNC doesn't seem interested in helping me resolve this, unfortunately. They've ignored my email.


I don't really blame them. I mean, they should respond at least to say "sorry, bud. I don't know." Maybe offer a refund if you send it back. But the way that drivers work in Linux, the way that LinuxCNC works in Linux, the way that Linux works period, is just not very intuitive or consistent across different machines. Hence:


strantor said:


> The one I got is all "discrete" signals. No USB, no bluetooth. It has an open collector encoder output and all the switches and buttons are dry contact. This gives me the most flexibility. Loading drivers in Linux isn't so straightforward. Nothing about LinuxCNC is straightforward. I do not want to fight that fight.



If you're ok with plugging in the USB MPG after boot then I'd just live with it. If not, you'll probably invest dozens of hours into figuring this out yourself or make some kind of drastic change (different PC, different USB MPG, Different shop lighting, only run on Wednesdays, etc.) there might be 10 people in the world who would know exactly what's going and how to fix it; apparently none of them are on this forum and none of them work at VistaCNC. If they're on any forums they would probably be on cnczone.


----------



## FOMOGO (Feb 23, 2022)

Is this a Ukrainian machine?​​Anyone Have Experience Connecting a RPG to LinuxCNC?​


----------



## devils4ever (Feb 23, 2022)

I got a response from VistaCNC. They told me to try a USB hub between the pendant and the PC. Went to Staples to get one and tried it. No luck. Still have the same issue when booting.


----------



## devils4ever (Feb 26, 2022)

I give up. I ordered a USB hub with switches on each port. So, now I have the pendant turned off until after I boot up, then turn it on, then start LinuxCNC. It works, but it's not very elegant. 

I wish VistaCNC had a solution. I'm not very impressed with their (lack of) support.


----------



## lustenaderj (Feb 28, 2022)

https://download.asrock.com/Manual/Q1900B-ITX.pdf
		


Page 40 - try disabling legacy USB support.
Page 44 - try enabling fast boot, which should prevent any attempt to boot from USB.

Crapshoot, but it sounds more like motherboard settings issues than pendant issues.


----------



## DavidR8 (Mar 1, 2022)

devils4ever said:


> I give up. I ordered a USB hub with switches on each port. So, now I have the pendant turned off until after I boot up, then turn it on, then start LinuxCNC. It works, but it's not very elegant.
> 
> I wish VistaCNC had a solution. I'm not very impressed with their (lack of) support.


I've not heard good things about VistaCNC


----------



## devils4ever (Mar 1, 2022)

lustenaderj said:


> Page 40 - try disabling legacy USB support.
> Page 44 - try enabling fast boot, which should prevent any attempt to boot from USB.
> 
> Crapshoot, but it sounds more like motherboard settings issues than pendant issues.



WOW! You nailed it! I disabled legacy USB support and now it boots normally with the pendant plugged it! Thank you so much!

I really didn't think it was a BIOS issue since the GRUB screen was coming up which is past the BIOS start up.

I haven't tried the fast boot option. Why mess with success?


----------



## lustenaderj (Mar 5, 2022)

Very welcome.  Glad it was an easy, if semi-elusive, fix.

With Microsoft pushing Windows toward requiring more modern hardware, I wonder how many of those buggy backward compatibility driven BIOS features will even exist in a few more years.  Which would cause a whole world of trouble for the people that truly rely on those features....


----------

