Fitting an encoder to non Tormach mill (5i25)

More
11 Sep 2018 09:34 #117325 by rafferty
I've fitted a DIY optical encoder to the mill spindle, giving index pulse and two quadrature phase outputs.

Read the "Fitting an encoder on a Tormach 1100" thread and realise Tormach's modified encoder just takes a pulse per rev input.

Had a play with "num_encoders=" parameter, (setting to 0, 1 , 2) under v1.9.13 and now under v2.1.3, results are the same.

num_encoders=0, as expected no encoder.
hm2/hm2_5i25.0:     IO Pin 000 (P3-01): StepGen #4, pin Step (Output)
hm2/hm2_5i25.0:     IO Pin 001 (P3-14): IOPort
hm2/hm2_5i25.0:     IO Pin 002 (P3-02): StepGen #0, pin Direction (Output)
hm2/hm2_5i25.0:     IO Pin 003 (P3-15): IOPort
hm2/hm2_5i25.0:     IO Pin 004 (P3-03): StepGen #0, pin Step (Output)
hm2/hm2_5i25.0:     IO Pin 005 (P3-16): IOPort
hm2/hm2_5i25.0:     IO Pin 006 (P3-04): StepGen #1, pin Direction (Output)
hm2/hm2_5i25.0:     IO Pin 007 (P3-17): PWMGen #0, pin Out0 (PWM or Up) (Output)
hm2/hm2_5i25.0:     IO Pin 008 (P3-05): StepGen #1, pin Step (Output)
hm2/hm2_5i25.0:     IO Pin 009 (P3-06): StepGen #2, pin Direction (Output)
hm2/hm2_5i25.0:     IO Pin 010 (P3-07): StepGen #2, pin Step (Output)
hm2/hm2_5i25.0:     IO Pin 011 (P3-08): StepGen #3, pin Direction (Output)
hm2/hm2_5i25.0:     IO Pin 012 (P3-09): StepGen #3, pin Step (Output)
hm2/hm2_5i25.0:     IO Pin 013 (P3-10): IOPort
hm2/hm2_5i25.0:     IO Pin 014 (P3-11): IOPort
hm2/hm2_5i25.0:     IO Pin 015 (P3-12): IOPort
hm2/hm2_5i25.0:     IO Pin 016 (P3-13): IOPort
hm2/hm2_5i25.0:     IO Pin 017 (P2-01): IOPort
hm2/hm2_5i25.0:     IO Pin 018 (P2-14): IOPort
hm2/hm2_5i25.0:     IO Pin 019 (P2-02): IOPort
hm2/hm2_5i25.0:     IO Pin 020 (P2-15): IOPort
hm2/hm2_5i25.0:     IO Pin 021 (P2-03): IOPort
hm2/hm2_5i25.0:     IO Pin 022 (P2-16): IOPort
hm2/hm2_5i25.0:     IO Pin 023 (P2-04): IOPort
hm2/hm2_5i25.0:     IO Pin 024 (P2-17): IOPort
hm2/hm2_5i25.0:     IO Pin 025 (P2-05): IOPort
hm2/hm2_5i25.0:     IO Pin 026 (P2-06): IOPort
hm2/hm2_5i25.0:     IO Pin 027 (P2-07): IOPort
hm2/hm2_5i25.0:     IO Pin 028 (P2-08): IOPort
hm2/hm2_5i25.0:     IO Pin 029 (P2-09): IOPort
hm2/hm2_5i25.0:     IO Pin 030 (P2-10): IOPort
hm2/hm2_5i25.0:     IO Pin 031 (P2-11): IOPort
hm2/hm2_5i25.0:     IO Pin 032 (P2-12): IOPort
hm2/hm2_5i25.0:     IO Pin 033 (P2-13): IOPort

num_encoders=1, adds the pulse per rev encoder over the IO Pin 016
hm2/hm2_5i25.0:     IO Pin 000 (P3-01): StepGen #4, pin Step (Output)
hm2/hm2_5i25.0:     IO Pin 001 (P3-14): IOPort
hm2/hm2_5i25.0:     IO Pin 002 (P3-02): StepGen #0, pin Direction (Output)
hm2/hm2_5i25.0:     IO Pin 003 (P3-15): IOPort
hm2/hm2_5i25.0:     IO Pin 004 (P3-03): StepGen #0, pin Step (Output)
hm2/hm2_5i25.0:     IO Pin 005 (P3-16): IOPort
hm2/hm2_5i25.0:     IO Pin 006 (P3-04): StepGen #1, pin Direction (Output)
hm2/hm2_5i25.0:     IO Pin 007 (P3-17): PWMGen #0, pin Out0 (PWM or Up) (Output)
hm2/hm2_5i25.0:     IO Pin 008 (P3-05): StepGen #1, pin Step (Output)
hm2/hm2_5i25.0:     IO Pin 009 (P3-06): StepGen #2, pin Direction (Output)
hm2/hm2_5i25.0:     IO Pin 010 (P3-07): StepGen #2, pin Step (Output)
hm2/hm2_5i25.0:     IO Pin 011 (P3-08): StepGen #3, pin Direction (Output)
hm2/hm2_5i25.0:     IO Pin 012 (P3-09): StepGen #3, pin Step (Output)
hm2/hm2_5i25.0:     IO Pin 013 (P3-10): IOPort
hm2/hm2_5i25.0:     IO Pin 014 (P3-11): IOPort
hm2/hm2_5i25.0:     IO Pin 015 (P3-12): IOPort
hm2/hm2_5i25.0:     IO Pin 016 (P3-13): Encoder #0, pin Index (Input)
hm2/hm2_5i25.0:     IO Pin 017 (P2-01): IOPort
hm2/hm2_5i25.0:     IO Pin 018 (P2-14): IOPort
hm2/hm2_5i25.0:     IO Pin 019 (P2-02): IOPort
hm2/hm2_5i25.0:     IO Pin 020 (P2-15): IOPort
hm2/hm2_5i25.0:     IO Pin 021 (P2-03): IOPort
hm2/hm2_5i25.0:     IO Pin 022 (P2-16): IOPort
hm2/hm2_5i25.0:     IO Pin 023 (P2-04): IOPort
hm2/hm2_5i25.0:     IO Pin 024 (P2-17): IOPort
hm2/hm2_5i25.0:     IO Pin 025 (P2-05): IOPort
hm2/hm2_5i25.0:     IO Pin 026 (P2-06): IOPort
hm2/hm2_5i25.0:     IO Pin 027 (P2-07): IOPort
hm2/hm2_5i25.0:     IO Pin 028 (P2-08): IOPort
hm2/hm2_5i25.0:     IO Pin 029 (P2-09): IOPort
hm2/hm2_5i25.0:     IO Pin 030 (P2-10): IOPort
hm2/hm2_5i25.0:     IO Pin 031 (P2-11): IOPort
hm2/hm2_5i25.0:     IO Pin 032 (P2-12): IOPort
hm2/hm2_5i25.0:     IO Pin 033 (P2-13): IOPort

num_encoders=2, adds the pulse per rev encoder but also what looks like a 'real' index and 2 phase encoder on P2, the second DB25.
hm2/hm2_5i25.0:     IO Pin 000 (P3-01): StepGen #4, pin Step (Output)			
hm2/hm2_5i25.0:     IO Pin 001 (P3-14): IOPort                                  
hm2/hm2_5i25.0:     IO Pin 002 (P3-02): StepGen #0, pin Direction (Output)      
hm2/hm2_5i25.0:     IO Pin 003 (P3-15): IOPort                                  
hm2/hm2_5i25.0:     IO Pin 004 (P3-03): StepGen #0, pin Step (Output)           
hm2/hm2_5i25.0:     IO Pin 005 (P3-16): IOPort                                  
hm2/hm2_5i25.0:     IO Pin 006 (P3-04): StepGen #1, pin Direction (Output)      
hm2/hm2_5i25.0:     IO Pin 007 (P3-17): PWMGen #0, pin Out0 (PWM or Up) (Output)
hm2/hm2_5i25.0:     IO Pin 008 (P3-05): StepGen #1, pin Step (Output)           
hm2/hm2_5i25.0:     IO Pin 009 (P3-06): StepGen #2, pin Direction (Output)      
hm2/hm2_5i25.0:     IO Pin 010 (P3-07): StepGen #2, pin Step (Output)           
hm2/hm2_5i25.0:     IO Pin 011 (P3-08): StepGen #3, pin Direction (Output)      
hm2/hm2_5i25.0:     IO Pin 012 (P3-09): StepGen #3, pin Step (Output)           
hm2/hm2_5i25.0:     IO Pin 013 (P3-10): IOPort                                  
hm2/hm2_5i25.0:     IO Pin 014 (P3-11): IOPort                                  
hm2/hm2_5i25.0:     IO Pin 015 (P3-12): IOPort                                  
hm2/hm2_5i25.0:     IO Pin 016 (P3-13): Encoder #0, pin Index (Input)           
hm2/hm2_5i25.0:     IO Pin 017 (P2-01): IOPort
hm2/hm2_5i25.0:     IO Pin 018 (P2-14): IOPort
hm2/hm2_5i25.0:     IO Pin 019 (P2-02): IOPort
hm2/hm2_5i25.0:     IO Pin 020 (P2-15): IOPort
hm2/hm2_5i25.0:     IO Pin 021 (P2-03): IOPort
hm2/hm2_5i25.0:     IO Pin 022 (P2-16): IOPort
hm2/hm2_5i25.0:     IO Pin 023 (P2-04): IOPort
hm2/hm2_5i25.0:     IO Pin 024 (P2-17): IOPort
hm2/hm2_5i25.0:     IO Pin 025 (P2-05): IOPort
hm2/hm2_5i25.0:     IO Pin 026 (P2-06): IOPort
hm2/hm2_5i25.0:     IO Pin 027 (P2-07): IOPort
hm2/hm2_5i25.0:     IO Pin 028 (P2-08): IOPort
hm2/hm2_5i25.0:     IO Pin 029 (P2-09): IOPort
hm2/hm2_5i25.0:     IO Pin 030 (P2-10): Encoder #1, pin Index (Input)
hm2/hm2_5i25.0:     IO Pin 031 (P2-11): Encoder #1, pin A (Input)
hm2/hm2_5i25.0:     IO Pin 032 (P2-12): Encoder #1, pin B (Input)
hm2/hm2_5i25.0:     IO Pin 033 (P2-13): IOPort

Does anyone know anything about this 2nd encoder? Is it available ?

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

More
11 Sep 2018 11:43 #117328 by Clive S
This is the code I am using on the Tormach.

net spindle-position hm2_5i25.0.encoder.00.position => motion.spindle-revs
net spindle-velocity hm2_5i25.0.encoder.00.velocity => motion.spindle-speed-in
net spindle-index-enable hm2_5i25.0.encoder.00.index-enable <=> motion.spindle-index-enable
setp hm2_5i25.0.encoder.00.scale -4000

With halmeter you will need to find the names of your (hm2_5125.0.encoder.00.position) it could be )01 etc. and the same for the other pins. You might also have to remove the - sign for the scale if it is counting the wrong way

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

More
11 Sep 2018 12:44 - 11 Sep 2018 12:46 #117329 by rafferty
Didn't you end up using a 7i85 encoder and a custom 5i25 bitfile?

Is the code you suggest for that 7i85/5i25 custom bitfile configuration?

I would like to use just the 5i25 with the newly found "real" encoder if possible.

Will do some testing of the newly found encoder with your suggested code.
Last edit: 11 Sep 2018 12:46 by rafferty. Reason: correction

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

More
11 Sep 2018 15:46 #117348 by Clive S
Yes I am using the custom bit file for a 7i85 but this is because I wanted 3 mpg's and the spindle encoder and it provided a neat way of doing it.

You will be able to use the high speed encoder on the second port . if you connect it up you should see the pins change state with the halmeter.

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

More
11 Sep 2018 17:14 #117354 by PCW
I'm pretty sure Tormach 1 pin encoder (for RapidTurn) does not work as a standard encoder
even if the A,B lines are brought out.

If you dont have a Tormach machine, I would use a non-Tormach bitfile with standard encoders

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

More
11 Sep 2018 22:50 #117368 by rafferty

I'm pretty sure Tormach 1 pin encoder (for RapidTurn) does not work as a standard encoder
even if the A,B lines are brought out.


Is it possible encoder 0 is Tormach pulse per rev, and encoder >0 is standard...?

If you dont have a Tormach machine, I would use a non-Tormach bitfile with standard encoders


It's non Tormach but I'm committed to their DB25 P3 pinout because of the interface hardware I built which looks exactly like a Tormach to the 5i25, down to the watchdog.

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

More
14 Sep 2018 06:50 #117505 by rafferty
Today I did some experimentation with num_encoders=2.

Initially just added 2 encoders to the 100-3 ini file and used ADMIN HALMETER to look at the 2nd encoder's pins while I pulled the A, B and Index pins high and low. This worked.

Connected my DIY optical sensor's A, B and Index outputs to the encoder inputs, added simple encoder initialisation code to postgui file and again used halmeter to look at the signals.

There's a velocity output signal that is at least roughly proportional to spindle RPM from 200 to 3000 RPM and the sign is correct with respect to direction (after I swapped the A and B phases of course). The velocity value jumps about a bit, around +/-10 %, signal looks pretty clean on a CRO.

Is this worth persisting with?

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

More
14 Sep 2018 07:02 #117507 by Clive S
Watching with interest. Did you try the code above in post #117328

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

More
14 Sep 2018 07:24 #117508 by rafferty

Watching with interest. Did you try the code above in post #117328


Sorry, no, not today, it might be a bit early to risk that. I was reading up on encoders this afternoon.

I'm not really confident what I'm seeing as velocity is correct. I'll feed it a clean square wave tomorrow and see if that's stable, if yes the +/-10% variation has an external cause.

Your code is for G33 co-ordianted motion I recall.

At one stage I took some bits of the duality ini and hal files and had actual spindle RPM on the DRO, I'll have to dive in to the UI python again, see if I can work out what I did.

Ken

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

More
14 Sep 2018 12:50 #117523 by andypugh

Is this worth persisting with?


It sounds like it. You just need to make that encoder (speed, position) go to the right pins in HAL.

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

Moderators: cncbasher
Time to create page: 0.104 seconds
Powered by Kunena Forum