Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: rogerbsstt on December 21, 2008, 05:18:25 PM

Title: Connecting an MPG to Mach3
Post by: rogerbsstt on December 21, 2008, 05:18:25 PM
Gentlemen,
I have recently obtained an MPG that I have been trying to connect to my Mach3 / mill. The unit is a HEDS-5700 C10 optical encoder. with 100CPR and 5v input.I have wired the unit up as per the tech data for the unit, and have tested the wiring to show that A & B outputs indicate 5v pulses when the wheel is turned.
I have connected the input wiring 5V and grd to the power connections on my CNC4PC  C10 breakout board (as per their wiring diagram), and have connected the output A & B wires to pin nos 13 and 15 on the board. In Mach 3 I have enabled MPG#1, selected port no 1, pin no 13, then port #1, pin no 15, I have left the steps set at 2 (as indicated for 100CPR in the Mach3 manual), and the velocity to 100.  I have used the Tab key to bring up the jog/mpg screen, set jog to MPG,
 selected Step/velocity for jog type, and axis 1 to X.  When I turn the wheel I get no response. When I go to the diag screen and move the wheel no leds light up in the pin status. When I checked the voltage on the pins 13 & 15 while they where disconnected from the breakout board I got 4.86 volt signals from the A & B wires, but when they were connected to the breakout board the max signal was .8 volts. After stumbling across the calibration screen for MPGs in Mach3, when I run through the process, all the settings came back 0. I assume it is because Mach3 is not getting a reading from the MPG, but as I can get a 5v signal out of the unit, I cant see what is wrong, and as I'm not exactly an electrical genius, cant figure out what I have missed. Please can you offer some help as I really want to use this unit on my mill.  THANKS for any assistance.  

A SAFE and happy holiday to all.
 rogerbsstt
Title: Re: Connecting an MPG to Mach3
Post by: Hood on December 21, 2008, 05:23:12 PM
Doesnt sound like you have missed anything but rather for some reason the signals are not passing through the BOB. Where were you measuring the voltage when connected to the BOB, was it at the MPG connection side of the BOB or the computer side?
Hood
Title: Re: Connecting an MPG to Mach3
Post by: rogerbsstt on December 21, 2008, 06:57:34 PM
Hood,
thanks for your fast reply,

I measured the voltage from the BOB  13 & 15 pin connection screws. Perhaps I should try two other pins??
Thanks

rogerbsstt.
Title: Re: Connecting an MPG to Mach3
Post by: Hood on December 21, 2008, 07:06:01 PM
Kind of sounds like the voltage is getting pulled down on the BOB, I am not great with electronics but certainly sounds that way. Do you have a second port? If so then you could wire in direct to the port and take the 5V/0v from the computer as well, thats the way I have it on the Bridgeport no breakout needed. On the Lathe I have it into my Breakout board and it works fine but thats a PMDX122.
Hood
Title: Re: Connecting an MPG to Mach3
Post by: rogerbsstt on December 21, 2008, 07:12:43 PM
Hood,
Thanks,
I have a second port in the computer so I will try it,

Thanks
rogerbsstt
Title: Re: Connecting an MPG to Mach3
Post by: Sage on December 21, 2008, 07:53:19 PM
Is a pullup resistor required on the parallel port input pins?

Sage
Title: Re: Connecting an MPG to Mach3
Post by: Hood on December 22, 2008, 06:12:49 AM
Is a pullup resistor required on the parallel port input pins?

Sage

Are you meaning if connected direct to the Parallel Port? If yes then I didnt but that may depend on the type of MPG?

Hood
Title: Re: Connecting an MPG to Mach3
Post by: Sage on December 22, 2008, 08:32:22 AM
It seems he has lost his logic levels in the transition through the BOB.
I'm not familiar with the model of BOB quoted above.  Maybe the outputs of the BOB which are connected to the parallel port inputs require a pull up to restore the logic levels. They would be required if the bOB had open collector drivers on the output.
I'm not sure if parallel port inputs have internal pullups to satisfy the requirement.
It wouldn't hurt to try a pullup of 4k7 or so between the parallel port input (along with the BOB output) to +5v to see if the logic levels return.


Sage
Title: Re: Connecting an MPG to Mach3
Post by: Hood on December 22, 2008, 08:37:42 AM
ah got you :)
Hood
Title: Re: Connecting an MPG to Mach3
Post by: rogerbsstt on December 22, 2008, 03:50:55 PM
Gentlemen,
thank you all for your comments.
The CNC4PC C10 breakout board has pulldown resistors on all input & outputs according to their documentation.
I will try all the ideas offered in the next few days.I have a second parrallel port on the computor.
Sage, is the pullup resister you suggest a 4.7 kilo ohm value.?
Any further suggetions will be welcomed.

again Thanks
rogerbsstt
Title: Re: Connecting an MPG to Mach3
Post by: Sage on December 23, 2008, 09:24:28 AM
Rogerbsst:
4.7k (Written as 4k7 in the industry so the decimal point will not be misinterpreted - mostly a problem on lousy paper prints) is what I suggested. But it sort of depends on what they have as a pull down. Pull-downs are a bit of a pain (and quite un-necessary if the circuit is designed properly) since they always form a divider with whatever else you put on the line to pull it up.
 The trick is to get a pull-up resistor value that gives to at least 3v on the line when the circuit tries to go high. You may have to try a few values.
 What value do they have as a pull-down? Is there a circuit diagram of the output available to look at?

Sage
Title: Re: Connecting an MPG to Mach3
Post by: rogerbsstt on December 23, 2008, 09:24:45 PM
Sage,
right on the money. I fitted two 4K7 resistors across the 5v and 13 / 15 pins and the MPG now works. GREAT STUFF!
I can get a 1 step movement on the X axis of .0021 mm. I am stoked.
THANKS to HOOD and you for your suggestions.
Merry Xmas from Australia, and happy NEW YEAR to you all.

rogerbsstt
Title: Re: Connecting an MPG to Mach3
Post by: Sage on December 24, 2008, 11:51:02 AM
Great !!!
Glad to hear it. You may want to check the two logic levels. The high logic level voltage on the pin should be over 3v and the low should be below - say 1v else you may get flakey operation. Lower the resistor value if the high logic voltage is below 3v. And as previously mentioned it will be a balancing act to maintain a low logic level that insn't too high.


Sage
Title: Re: Connecting an MPG to Mach3
Post by: rogerbsstt on December 30, 2008, 08:11:27 PM
Thanks,
I will check those values.

rogerbsstt
Title: Re: Connecting an MPG to Mach3
Post by: rogerbsstt on January 04, 2009, 04:28:32 PM
Sage, Hood,
Thank you for your previous advice, the 4K7 resistors gives a max 2.89 v Hi at the pin and .2v Low, and the unit works OK. but after checking the Hi / low volts as suggested, I tried using a transistor to replace the resistor. I used a CBC327 (TO-92h) semi-conductor, (sorry I really dont what the correct terrms are), connected the emmitter(E pin) to the 5v and the Common(C pin) to the board 13 /15 pins, the A & B MPG signal wires connected to the central (B pin). When I checked the Hi / Low volts I got 4.84v hi and .21v low at the board.
The MPG works the machine so I think this appears to be an answer to finding the correct resistor to raise the Hi v to over 3v.
Please advise me if you can see any problems with this set up.

rogerbsstt
Title: Re: Connecting an MPG to Mach3
Post by: Sage on January 05, 2009, 09:33:04 AM
The transistor will work fine to change the levels to more solid values BUT (assuming I follow what you have done) the MPG signal has now been inverted using the transistor i.e. when the MPG gives a low the BOB is now seeing a high and vise versa. I'm not sure what Mach is doing with the signal but I'm surprised it isn't a bit confused. Perhaps it is looking at logic edges only and not the levels.
  Apparently it's not making any difference and if it works stick with it.
 As for your old single resistor arrangement, The 2.8v was a marginal high and it looks like the low did not suffer so you might have gotten away with just a lower resistor than 4k7 as a pull up - say 3k3 or 2k2. If you were buying resistors every time to try this then leave it like it is and see what happens. I have piles of components around to use to get it just right so I have an advantage there.

Also. I'm not sure what the MPG is using to drive it's output but it might be a bit easier on the transistor if you leave the 4k7 in the line going to the transistor base (B) to limit the current when it drives the transistor base low. Check the temperature of the transistor when it is supplying a high to the BOB. Probably won't be a problem.

Keep these comments in mind if you experience problems later but as I say if it works leave it alone. You'll be better off like it is now with the transistor if everyting is working.

 Good work.

Sage
Title: Re: Connecting an MPG to Mach3
Post by: rogerbsstt on January 05, 2009, 04:47:25 PM
Sage,
Many thanks for your comments. I will check the transistors temp as I go, perhaps I will also try some other resistor values as a backup just in case of a problem with the trannys. The MPG data specifies the outputs at min -.5v at -1ma, to max 7v at 5ma on the signal wires A & B.
From what I see the Mach3 doesnt care if the signal is HI / Low or Low /Hi because in the MPG config setup there is no Hi / low choices as in other config inputs and I guess Mach3 just reads the changes.

One last thing I need to resolve is how do I get my glass scale encoder to display on the 4th axis DRO in Mach3. In a past response HOOD mentioned changing the 4th axis OEM code to an encoder DRO. He stated it can be done in screen 4. I have no experience with programming and cant find a screen 4 that show the DRO. Can someone please explain in simple steps how to do this.

Thanks Again

rogerbsstt

Title: Re: Connecting an MPG to Mach3
Post by: Hood on January 05, 2009, 05:04:52 PM
 Cant remember saying that but then again I cant remember what I have just typed :D

OEM code list can be found at the top of the forum in one of the stickies, you will find all of the documented OEMs in it.
Hood
Title: Re: Connecting an MPG to Mach3
Post by: Hood on January 05, 2009, 05:07:45 PM
Just reading again and wondering if you are meaning you dont know how to use screen4, is that what you are meaning?

Hood
Title: Re: Connecting an MPG to Mach3
Post by: rogerbsstt on January 06, 2009, 09:13:23 PM
Hood,
Thanks, Yes I mean I dont even know what screen 4 is or where it is.
and sorry, but what 'Sticky' ?? has the OEM codes.
I feel like a dunce, but I dont have much to do with programs and such, I just use the machines.
Hope you can help,

rogerbsstt.
Title: Re: Connecting an MPG to Mach3
Post by: Chaoticone on January 06, 2009, 10:20:15 PM
Screen 4 is a program that you use to make or customize screens for Mach. It can be found in the downloads section at the top of this page.

A sticky is a topic that is allways at the top of a board. It will be one of the first few listed in the general discussion board in this case.

No reason to feel like a dunce, non of us were born knowing any of this, but your willing to learn. That is all you need to do well with Mach.

Brett
Title: Re: Connecting an MPG to Mach3
Post by: Hood on January 07, 2009, 02:48:07 AM
No probs
 Screen4 is a small screen making/altering programme that comes with Mach, you should see it in the Mach3 folder on your drive (screen4.exe)
If you double click that and then when it starts choose to open a screen, if you are using the standard it will be called 1024.set and you will find it by browsing to your Mach3 folder (screen4 should look there by default)
 Once the screen is opened if you doble click on the DRO you want a box will open with various things in it one of which is the OEM code or it may even be set with the drop down list. If the DRO that you want is in the drop down list then all you do is choose that, if not then you need to enter the OEM code for the DRO. When you have done that just save the screenset and you are ready to go :) I would suggest you save the screenset as a different name however, that way when you upgrade Mach it wont get overwritten with the standard screen. If you for exapmle named your screen rogerbsstt.set you would just open Mach, go to View menu then load screens and browse to Mach3 folder and choose your screen and it will  load.

Now to the OEM code list, its in a thread I started, the thread has been stickied, ie it stays near the top of the forum and doesnt drop down like others do when no replies have been posted. Anyway if you click here you will find the list. http://www.machsupport.com/forum/index.php/topic,6657.0.html
Any more questions just ask :)
Hood
Title: Re: Connecting an MPG to Mach3
Post by: Hood on January 07, 2009, 02:49:34 AM
Ah see Brett has already andswered some of your questions :)
Hood
Title: Re: Connecting an MPG to Mach3
Post by: rogerbsstt on January 11, 2009, 06:18:38 PM
Thanks again,
I have successfully got the MPG to work using the transistor system, I had trouble getting the correct resistor value to provide the values needed,  so I went back to the Tranny idea.
I am still having trouble with the Glass Scale, maybe I need to retest my circiut, but will spend more time on it later this month.
Thank you all for the info on Screen 4 etc,  and also for the ongoing help and suggestions from you all.

rogerbsstt.
Title: Re: Connecting an MPG to Mach3
Post by: RICH on January 11, 2009, 06:49:23 PM
You will need to download SCREEN4  from the sites Downloads>MACH & LAZYCAM> scroll down to SCREENS.
RICH