MPG jitters around

More
04 Feb 2018 02:08 #105383 by Jakemestre1
Hello All,
I've been building a CNC lathe and for the last couple of days I've been trying for the life of me to get my mpg working with the MESA 5i25_7i76 board. The only thing I can get it to do is jitter around and not move in any given direction. So far I've selected the mode two for mpg in my main hal file. I've connected the 5V mpg to inputs hm2_5i25.0.7i76.0.0.enc1.count based on the amazing 7i76_Anschluss_2016-12-03.pdf and used a couple different code attempts to get counts to drive motion. I've tried the ilowpass filter as well as not but nothing seems to get me controlled motion. When using the halmeter I can see the x or z axis selected and an incriment of .1, .01, or .001 of my choosing on the rotary switch. All of which change when I switch mechanical switches. The MPG count doesn't really change though. I hooked up a volt meter and I definitely see what would probably be a quad output from A and B from the MPG.
Any help would be super super appreciated. Here is the code I've got that makes things jitter:
#Attempt on 2/3/2018 to make the mpg to work.
loadrt mux4 names=mpg-scale

# MPG Jog Speeds
addf mpg-scale servo-thread

# MPG encoder feedback (but all of the following cause crashes)
#setp hm2_5i25.0.7i76.0.0.enc1.counter-mode 0
#setp hm2_5i25.0.7i76.0.0.enc1.filter 1
#setp hm2_5i25.0.7i76.0.0.enc1.index-invert 0
#setp hm2_5i25.0.7i76.0.0.enc1.index-mask 0
#setp hm2_5i25.0.7i76.0.0.enc1.index-mask-invert 0

net mpg-count hm2_5i25.0.7i76.0.0.enc1.count
net mpg-count => axis.0.jog-counts
net mpg-count => axis.2.jog-counts

setp mpg-scale.in0 .001
setp mpg-scale.in1 .01
setp mpg-scale.in2 .1

# Axis Select
net mpg-x axis.0.jog-enable <= hm2_5i25.0.7i76.0.0.input-20
net mpg-z axis.2.jog-enable <= hm2_5i25.0.7i76.0.0.input-21

# Scale Select
# set the MPG scale based on the inputs from the selector switch
net pos2 mpg-scale.sel0 <= hm2_5i25.0.7i76.0.0.input-22
net pos3 mpg-scale.sel1 <= hm2_5i25.0.7i76.0.0.input-23

net axis-mpg-jog-scale axis.0.jog-scale <= mpg-scale.out
net axis-mpg-jog-scale axis.2.jog-scale <= mpg-scale.out
Attached is my main hal and ini files if that helps. Please pardon my rudimentary programming skills.
Attachments:

Please Log in or Create an account to join the conversation.

More
04 Feb 2018 09:12 - 04 Feb 2018 09:13 #105392 by Clive S
Replied by Clive S on topic MPG jitters around
Your hal file is showing is not loading, it is 0Kb
Last edit: 04 Feb 2018 09:13 by Clive S.

Please Log in or Create an account to join the conversation.

More
04 Feb 2018 09:52 #105393 by raglanlittlejohn
Replied by raglanlittlejohn on topic MPG jitters around
Heres my mpg connection drawing for an mpg. This goes into a Mesa 7i85S which has 4 encoders. I see the 7i76 only has one encoder, would it be better to use a software encoder for the mpg?.

This browser does not support PDFs. Please download the PDF to view it: Download PDF

Attachments:
The following user(s) said Thank You: Jakemestre1

Please Log in or Create an account to join the conversation.

More
04 Feb 2018 12:30 #105396 by rodw
Replied by rodw on topic MPG jitters around
This link on my build might help but its for a 7i76e which supports MPG encoders on IO pins so its not using the encoder input.
forum.linuxcnc.org/show-your-stuff/32029...utter-build?start=20

I only used 2 wires.

I would start in Halshow and look to see that all the signals are working. Is the scale working? Are the joints/axes receiving the scale? is the count moving up and down with each click of the jog wheel.
The following user(s) said Thank You: Jakemestre1

Please Log in or Create an account to join the conversation.

More
04 Feb 2018 21:37 #105419 by Jakemestre1
Replied by Jakemestre1 on topic MPG jitters around
Thanks guys!
Clive, I'll figure out how to update the hal file I uploaded.
raglanlittlejohn, Thanks for your diagram. I've got a wiring diagram for the 7i76e which is virtually the same board as the 7i76 but connected via ethernet instead of the 5i25. If I can't get this to work I'll look at a software encoder as an alternative.
Hi Rodw, Thank you so much for responding, I actually used your code at one point to test out some things. It wasn't working for me at the moment and I had already been jittering with the MPG on the code attached, so I figured I'd try to solve the problem there. If I can't get this code to function I think I'll try yours again.
I see each axis selecting with switch, changing scale, and the counter is going from 0-1 and back again. I'll see the machine move the selected scale in in the correct direction but then it returns to the previous position and the count goes back to 0. Am I in some kind of closed loop position mode or something?

Please Log in or Create an account to join the conversation.

More
04 Feb 2018 21:55 - 04 Feb 2018 21:57 #105423 by PCW
Replied by PCW on topic MPG jitters around
if the counter goes from 0 to 1 and back again, that suggests that only one of the encoder signals
is getting to the 7I76E MPG inputs, or that there's a signal level issue at the 7I76MPG input pins
or perhaps a missing common connection between the MPG ground and field voltage common

To check. measure the voltage at the 7I76E MPG inputs relative to field voltage common ( TB1 pin 8 )
It looks like you are using enc1 so MPG-A should go to IN18 ( TB5 pin 3 ) and MPG-B to IN19 ( TB5 pin 4 )

Check that both states of both signals are valid ( < .8V for low and >3.5V for high )
Last edit: 04 Feb 2018 21:57 by PCW.
The following user(s) said Thank You: Jakemestre1

Please Log in or Create an account to join the conversation.

More
04 Feb 2018 22:23 #105426 by raglanlittlejohn
Replied by raglanlittlejohn on topic MPG jitters around
here is part of my hal file re my mpg, hope this helps.

This browser does not support PDFs. Please download the PDF to view it: Download PDF

Attachments:

Please Log in or Create an account to join the conversation.

More
05 Feb 2018 19:50 #105459 by Jakemestre1
Replied by Jakemestre1 on topic MPG jitters around
SOLVED!!!

PCW, Thank you so much. That was tremendously helpful. I checked everything and while its still a bit of a rats nest while getting all the different things to work all the connections looked good. I ended up connecting my Antek linear power supply 5V, 24V as the logic and Field power respectively instead of the 5i25 5V power. Still no dice. I had happened to order another mpg for another machine and thought to myself, "I wonder if the mpg itself isn't what's causing the issue?!?!" Turns out it was and the new one works great. Direction was reversed so I switched A and B and now I've got a MPG controlled machine. As soon as I saw the axis move when I spun the wheel, I had to run around outside with arms in the air yelling WOOHOO!
Thanks guys. this forum is fantastic.

Please Log in or Create an account to join the conversation.

Time to create page: 0.104 seconds
Powered by Kunena Forum