Hello Guest it is May 13, 2021, 02:23:41 AM

Author Topic: External MPG with CNCRoom MB2 and ESS  (Read 1532 times)

0 Members and 1 Guest are viewing this topic.

Offline CRS

  •  61 61
    • View Profile
External MPG with CNCRoom MB2 and ESS
« on: May 25, 2017, 06:55:24 AM »
In case anyone may find this of interest.

I will try to detail my little success connecting a stand-alone external MPG into Mach4 via the Ethernet Smooth Stepper, using the MB2 (Mach Break-Out Board # 2) from CNCRoom in Thailand.

The main issue here is that the MB2 uses industry standard 24V for all its inputs and outputs.  Which is great for several other reasons, but meant I needed to get things back to 5V, as the MPG is rated at 5V.

I could have used some transistors as they draw less power than the LED in an opto coupler, but I had optos handy, so used them to connect the A & B Phase connection from the MPG into the two inputs in the MB2.  If anyone is interested I will make a sketch and attach as a pdf.

Weerasak from CNCRoom helped me to get the circuit correct, as I had it wired slightly differently and wasn’t getting desirable results.  Now it works like a gem.

I set up the ESS configuration with the two inputs mapped to AUX Encoder 0 Phase A and Phase B.  Then in Mach’s configuration, in the MPG tab, in the first row (Mpg #0) I set Encoder to AUX Encoder 0, Counts Per Detent to 4, I actually just set Acceleration and Velocity to 100%.  That may need some tweaking down the line, but for now it works perfectly.

By default this moved the axis 1 mm per Detent/Increment of the wheel.  I had downloaded a Lua script for a CNC4PC Pendant that Chaoticone had kindly uploaded some time back.  The script was written for 6 axes, so I edited it down to 3 axes and deleted all the stuff that I didn’t think I needed.  I renamed the function to simply MPG.  Hope that doesn’t offend Chaoticone.  And thanks for the script.  It works perfectly.

The Lua script gives you the ability to use a couple of external rotary selector switches to choose your axis to jog and also the speed at which to jog.  0.1mm per Detent, 0.01 and 0.001 mm per Detent.  The script works like a dream and with the speed set to 0.1 mm, I spun the wheel exactly 50 full rotations as fast as I could and it came up spot on at 500 mm, with very little lag.

Things that I learnt.  When running G code the Jogging and MPG are disabled.  But if you hit Feed Hold and then accidentally bump the MPG wheel, the cycle will inadvertently start again.  Not real flash when you realise that.  So as part of the rotary selector switch, it’s a good idea to have an off position isolating the A & B phase connections.

I will attach the Lua script in its modified form as well.  Hope someone can use this, I have taken enough from this forum,… maybe for once I can help someone else.

Re: External MPG with CNCRoom MB2 and ESS
« Reply #1 on: May 20, 2018, 03:28:23 AM »
For MPG with line driver output. You can interface it thru PNP inputs.
The 470 ohm chip resistors are needed to make 24v voltage level to 5v.


In the video telling about removing filter capacitor because signal from encoder (mounted on spindle) is much faster. For manual MPG, we don't need to remove those capacitors.

The CNCRoom.com, the place where Industrial Hobbyists can talk and trade!