2 seperate MPG handwheels for each axis - CNC Lathe build

More
17 May 2020 12:38 #168054 by rodw
This is where I have mine connected.
Attachments:
The following user(s) said Thank You: tommylight

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

More
17 May 2020 12:38 #168055 by tommylight
To speed things up a bit, i am going to eat something and grab one of my 7i77 and a 5i25 or 6i25 if i can find them and do a mock up for testing, and some encoders. Back in 20 to 30 minutes.

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

More
17 May 2020 12:40 #168056 by rodw

Works!
What i did. I took the second MPG handwheel i had lying around and connected all 4 wires to the terminals but without the resistors. Halmeter shows counts!

EDIT: and of course i changed the white and blue wire back to TB5


Great stuff! I did say I did not use resistors!

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

More
17 May 2020 12:53 - 17 May 2020 12:56 #168057 by denhen89
Okay, one MPG works, but the one where the resistors were wired, does not work. I put all wires back to the first MPG, but of course without the resitors and hal does not show the counts.
Have wired up the second mpg again, halmeter shows counts. Back again to the first= no counts.
Is it possible that the MPG got damaged because of the resistors? (2k0 resistors)
Last edit: 17 May 2020 12:56 by denhen89.

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

More
17 May 2020 12:59 #168058 by rodw
swap the known good MPG to the other input and see if it will count

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

More
17 May 2020 13:06 #168059 by denhen89
Rodw, thanks but it seems i found the problem.
I measure Ohm on the terminals of both MPGs:
Red stick(dont know the correct word) on terminal 0V and black stick A, then B , then the A and B terminals on bottom of the mpg. All are giving 5.4 Ohm.
But, on the MPG which does not show any counts i get on all 5.4 Ohm, but not on the main "A" terminal. It shows: 0.001 Ohm
So it seems something with the terminal A on the first MPG i tested is not okay. Right now i am not sure if its because of the resistors or if i shorted something
The following user(s) said Thank You: tommylight, rodw

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

More
17 May 2020 14:18 #168062 by tommylight
To late?
Glad it works, not glad for the faulty MPG.
2KOhm resistors can not do any damage as they were connected, must have had a 5V connected to output A at some point in it's lifetime. Anyway, i have a Mesa 7i77 and some others here, just in case.

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

More
17 May 2020 14:45 - 17 May 2020 14:45 #168068 by Clive S
To late now put I have done a mill with a 7i96 with this code no switches
# Include your customized HAL commands here
#7i96 mesa baz


# change number of encoders here
loadrt  encoder num_chan=5

addf  encoder.capture-position servo-thread
addf  encoder.update-counters servo-thread


# MPG stuff here
####  load ilowpass for mpg smoothing  ###

loadrt   ilowpass names=ilowpass.mpgX,ilowpass.mpgY,ilowpass.mpgZ

addf     ilowpass.mpgX  servo-thread
addf     ilowpass.mpgY  servo-thread
addf     ilowpass.mpgZ  servo-thread

setp   ilowpass.mpgX.scale   1
setp   ilowpass.mpgX.gain   0.1

setp   ilowpass.mpgY.scale   1
setp   ilowpass.mpgY.gain   0.1

setp   ilowpass.mpgZ.scale   1
setp   ilowpass.mpgZ.gain   0.1


# for velocity mode      (when you stop spinning the dial the axis stops)
# must be set for each axis
setp  joint.0.jog-vel-mode  1
setp   axis.x.jog-vel-mode  1

setp  joint.1.jog-vel-mode  1
setp   axis.y.jog-vel-mode  1

setp  joint.2.jog-vel-mode  1
setp   axis.z.jog-vel-mode  1

 # "times 4 mode" one count per full quadrature cycle, instead of the usual one count per edge.  
 # mpg jog wheels often have a full quadrature cycle per "click". 0 for off and 1 for on.

setp  encoder.0.x4-mode 0
setp  encoder.1.x4-mode 0
setp  encoder.2.x4-mode 0

#set axis to the required increment ( 0.01) 

net   jog-inc-x  joint.0.jog-scale axis.x.jog-scale 
sets  jog-inc-x  0.05

net   jog-inc-y  joint.1.jog-scale axis.y.jog-scale 
sets  jog-inc-y  0.01

net   jog-inc-z  joint.2.jog-scale axis.z.jog-scale 
sets  jog-inc-z  0.01

#set inputs to 7i96

#encoder X 
net  mpg-xa encoder.0.phase-A  <=  hm2_7i96.0.gpio.000.in
net  mpg-xb encoder.0.phase-B  <=  hm2_7i96.0.gpio.001.in

#encoder Y 
net  mpg-ya encoder.1.phase-A  <=  hm2_7i96.0.gpio.002.in
net  mpg-yb encoder.1.phase-B  <=  hm2_7i96.0.gpio.003.in

#encoder Z 
net  mpg-za encoder.2.phase-A  <=  hm2_7i96.0.gpio.004.in
net  mpg-zb encoder.2.phase-B  <=  hm2_7i96.0.gpio.005.in

# send mpg-encoder counts to required axis

# x encoder
net    enc-counts-x      encoder.0.counts 
net    enc-counts-x      ilowpass.mpgX.in  

net  enc_out-x   ilowpass.mpgX.out
net  enc_out-x   axis.x.jog-counts 
net  enc_out-x   joint.0.jog-counts 

setp    axis.x.jog-enable  true
setp   joint.0.jog-enable  true
## The above line is to be able to jog without homing ##

# Y encoder
net    enc-counts-y     encoder.1.counts 
net    enc-counts-y     ilowpass.mpgY.in  

net    enc_out-y     ilowpass.mpgY.out
net    enc_out-y     axis.y.jog-counts      
net    enc_out-y    joint.1.jog-counts 

setp   axis.y.jog-enable  true
setp  joint.1.jog-enable  true

# Z encoder
net    enc-counts-z     encoder.2.counts 
net    enc-counts-z     ilowpass.mpgZ.in  

net   enc_out-z    ilowpass.mpgZ.out
net   enc_out-z    axis.z.jog-counts      
net   enc_out-z   joint.2.jog-counts 

setp   axis.z.jog-enable   true
setp  joint.2.jog-enable   true
Last edit: 17 May 2020 14:45 by Clive S.
The following user(s) said Thank You: Masiwood123

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

More
17 May 2020 14:48 - 17 May 2020 14:50 #168069 by denhen89
Some good news: I managed to move the X axis with the MPG (only DRO, without motor). The scale i choose in the GUI and it works perfectly. I just had to home both axis first and then it worked. I am happy :)

I am really very thankful to you guys that you spent your time to help me out with those problems. I appreciate that a lot. I will return the favor with some pictures and video when the Lathe is finished :P
I will order a new MPG and wait until i get it and also get the switch for the scale and some buttons. In meantime i will do the mechanical part of the lathe and as soon everything is done i will start with the wiring and configuration.
It was good to make a break as you suggested me and now i can focus on the mechanical part better :)

I am pretty sure i will need some help later with the switches and buttons, but i bought the same type of switch for the scale as Rodw used for his plasma, so i might be able to copy and paste some lines.

Again thanks and i wish you a nice rest of the Sunday!
Last edit: 17 May 2020 14:50 by denhen89.
The following user(s) said Thank You: tommylight, Clive S

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

More
17 May 2020 14:57 #168071 by denhen89
@PCW: Good to know, but then it seems i somehow put 5v on A as you wrote, or the MPG was already faulty. Who knows, but good that i had a second one and tested it without the resistors, otherwise i would be screwed :dry:

@Clive S: Thanks for that! I will need that later for sure, but i saw that you used a fixed value for the scale for each axis and you are not able to change it in the GUI, correct?
Really nice to have that HAL file, i will later test it.
I had to put a code into the custom_postgui.hal, to choose the scale from the drop down menu in the GUI. Later when the Lathe is finished, i think its good to have a physical switch on a panel where the MPG will be mounted, but also good to know that its possible to use the MPG without any switches.

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

Time to create page: 0.144 seconds
Powered by Kunena Forum