Question on encoders and limit switches
Moderators: TomKerekes, dynomotion
Question on encoders and limit switches
As per AMC's recommendation, I'm using a KFLOP board with a KANALOG board to drive an Advanced Motion Control AB30A200AC servo driver, which in turn drives a H2WTech linear motor. Since I'm somewhat worried about position, especially near the ends of the track, I suppose that I will need limit switches and probably a linear encoder. Can you recommend some for use with the KFLOP board?
- TomKerekes
- Posts: 2677
- Joined: Mon Dec 04, 2017 1:49 am
Re: Question on encoders and limit switches
Hi pblase,
Most any switches or proximity sensors should work.
A User just asked about these very inexpensive switches:
https://www.amazon.com/Longruner-Mechan ... B06XTB7WMK
Or a proximity sensor like this:
https://cnc4pc.com/12mm-inductive-switch-npn-nc.html
Most any linear encoder should work that has 5V digital differential outputs. KFLOP/Kanalog is limited to 1 million quadrature counts/sec. So for example a 1um resolution would limit your speed to 1m/s. I prefer optical encoders over other types such as magnetic as they are usually much more accurate as they are usually based on 20um optical lines rather than 2000um magnets.
HTH
Most any switches or proximity sensors should work.
A User just asked about these very inexpensive switches:
https://www.amazon.com/Longruner-Mechan ... B06XTB7WMK
Or a proximity sensor like this:
https://cnc4pc.com/12mm-inductive-switch-npn-nc.html
Most any linear encoder should work that has 5V digital differential outputs. KFLOP/Kanalog is limited to 1 million quadrature counts/sec. So for example a 1um resolution would limit your speed to 1m/s. I prefer optical encoders over other types such as magnetic as they are usually much more accurate as they are usually based on 20um optical lines rather than 2000um magnets.
HTH
Regards,
Tom Kerekes
Dynomotion, Inc.
Tom Kerekes
Dynomotion, Inc.
Re: Question on encoders and limit switches
Hi Tom,
I had some questions regarding the encoder integration with the KFLOP board. I recently bought and put together the KFLOP motion board with 2 KSTEPs and 8 Steppers (and it works like magic). I was hoping to add the encoder feedback from these motors to the control. What pin configuration do I use? I found the functional diagram, however, I saw that you are using the JP5 port for both encoder inputs and step/dir outputs. The functional diagram says that I need to use JP5 pins 1 to 8 for both encoder inputs and step/dir outputs. That doesn't make any sense to me. I will be highly obliged if you can suggest some solution where I can use all the components (1KFLOP, 2 KSTEPS, 8 Steppers,8 Encoders ) together. Thank you.
Regards,
Sagar
I had some questions regarding the encoder integration with the KFLOP board. I recently bought and put together the KFLOP motion board with 2 KSTEPs and 8 Steppers (and it works like magic). I was hoping to add the encoder feedback from these motors to the control. What pin configuration do I use? I found the functional diagram, however, I saw that you are using the JP5 port for both encoder inputs and step/dir outputs. The functional diagram says that I need to use JP5 pins 1 to 8 for both encoder inputs and step/dir outputs. That doesn't make any sense to me. I will be highly obliged if you can suggest some solution where I can use all the components (1KFLOP, 2 KSTEPS, 8 Steppers,8 Encoders ) together. Thank you.
Regards,
Sagar
- TomKerekes
- Posts: 2677
- Joined: Mon Dec 04, 2017 1:49 am
Re: Question on encoders and limit switches
Hi Sagar,
We already sent an email to you regarding this. I'll repeat it below:
Hi Sagar,
The encoder inputs can be multiplexed over to KFLOP JP4 and JP6 if JP5 and JP7 are in use.
See the MuxEncoders.c example.
Note these are 3.3V inputs and shouldn't be driven hard (more than 10ma) above 3.8V. This is not usually an issue as most encoders don't do this. They also have 150 ohm termination.
HTH
Regards
TK
We already sent an email to you regarding this. I'll repeat it below:
Hi Sagar,
The encoder inputs can be multiplexed over to KFLOP JP4 and JP6 if JP5 and JP7 are in use.
See the MuxEncoders.c example.
Note these are 3.3V inputs and shouldn't be driven hard (more than 10ma) above 3.8V. This is not usually an issue as most encoders don't do this. They also have 150 ohm termination.
HTH
Regards
TK
Regards,
Tom Kerekes
Dynomotion, Inc.
Tom Kerekes
Dynomotion, Inc.
Re: Question on encoders and limit switches
Hi Tom,
Thank you for your reply. I am fairly new to configuring the kflop control board so I am not sure what to do with the MuxEncoder.c file. For example, do I have to initialize this file? and if so, how do I do it?
Also, since I am using the JP7 and JP5 ports as step/dir outputs to communicate with the 2 KSTEPs, can I use the JP4 and JP6 ports solely for encoder inputs. Is there a particular pin configuration that I need to choose for JP4 and JP6 ? or can I set any of the pins on JP6/JP4 to accept the encoder inputs (and how do I do this)?
Can I use any of the pins on the KFLOP board to provide the Vcc and GND outputs to the encoders?
Really appreciate your help. Thank you.
Best,
Sagar
Thank you for your reply. I am fairly new to configuring the kflop control board so I am not sure what to do with the MuxEncoder.c file. For example, do I have to initialize this file? and if so, how do I do it?
Also, since I am using the JP7 and JP5 ports as step/dir outputs to communicate with the 2 KSTEPs, can I use the JP4 and JP6 ports solely for encoder inputs. Is there a particular pin configuration that I need to choose for JP4 and JP6 ? or can I set any of the pins on JP6/JP4 to accept the encoder inputs (and how do I do this)?
Can I use any of the pins on the KFLOP board to provide the Vcc and GND outputs to the encoders?
Really appreciate your help. Thank you.
Best,
Sagar
- TomKerekes
- Posts: 2677
- Joined: Mon Dec 04, 2017 1:49 am
Re: Question on encoders and limit switches
Hi Sagar,
// Mux encoder inputs from KFLOP JP7 & JP5 to JP4 aand JP6
FPGAW(ENC_NOISE_FILTER_ADD) = ENC_0_3_JP4 + ENC_4_7_JP6 + ENC_NOISE_FILTER_DEFAULT_VAL;
Add the following line of code into your Initialization C Program. It needs to be executed once to multiplex the encoders. Encoders 0-3 will then be input on JP4 and 4-7 will be on JP6. Both JP4 and Jp6 have 10 IO bits. The 4 encoders will appear on the first 8 IO bits. 2 bits for each encoder's A B channels in order. So for example Encoder #0 will appear on JP4 IO16 (Pin5) and IO17 (Pin6)Thank you for your reply. I am fairly new to configuring the kflop control board so I am not sure what to do with the MuxEncoder.c file. For example, do I have to initialize this file? and if so, how do I do it?
// Mux encoder inputs from KFLOP JP7 & JP5 to JP4 aand JP6
FPGAW(ENC_NOISE_FILTER_ADD) = ENC_0_3_JP4 + ENC_4_7_JP6 + ENC_NOISE_FILTER_DEFAULT_VAL;
You may use any +5V and GND pins on KFLOP for your encoders. JP4 and JP6 have +5V available on Pin1 and GND on Pin8Can I use any of the pins on the KFLOP board to provide the Vcc and GND outputs to the encoders?
Regards,
Tom Kerekes
Dynomotion, Inc.
Tom Kerekes
Dynomotion, Inc.
Re: Question on encoders and limit switches
Hi Tom!
Thanks again. Just one last thing.
For :
And once initialized, I am guessing that the sequence goes like this :
JP4
Encoder#0 : JP4 IO16 (Pin5) and JP4 IO17 (Pin6)
Encoder#1 : JP4 IO18 (Pin7) and JP4 IO19 (Pin10)
Encoder#2 : JP4 IO20 (Pin11) and JP4 IO21(Pin12)
Encoder#3 : JP4 IO22(Pin13) and JP4 IO22(Pin14)
JP6
Encoder#4 : JP6 IO26 (Pin5) and JP6 IO27 (Pin6)
Encoder#5 : JP6 IO28 (Pin7) and JP6 IO29 (Pin10)
Encoder#6 : JP6 IO30 (Pin11) and JP6 IO31(Pin12)
Encoder#7 : JP6 IO32(Pin13) and JP6 IO33(Pin14)
And I will be keeping the pin and IO configurations for the stepper's on JP7 and JP5 the same as before without making any changes.
Is this correct?
Thank you again for your patience
Thanks again. Just one last thing.
For :
Where exactly do I initialize the code? is it inside the kmotionCNC software (under the tool setup/ user buttons window? )Add the following line of code into your Initialization C Program. It needs to be executed once to multiplex the encoders.
And once initialized, I am guessing that the sequence goes like this :
JP4
Encoder#0 : JP4 IO16 (Pin5) and JP4 IO17 (Pin6)
Encoder#1 : JP4 IO18 (Pin7) and JP4 IO19 (Pin10)
Encoder#2 : JP4 IO20 (Pin11) and JP4 IO21(Pin12)
Encoder#3 : JP4 IO22(Pin13) and JP4 IO22(Pin14)
JP6
Encoder#4 : JP6 IO26 (Pin5) and JP6 IO27 (Pin6)
Encoder#5 : JP6 IO28 (Pin7) and JP6 IO29 (Pin10)
Encoder#6 : JP6 IO30 (Pin11) and JP6 IO31(Pin12)
Encoder#7 : JP6 IO32(Pin13) and JP6 IO33(Pin14)
And I will be keeping the pin and IO configurations for the stepper's on JP7 and JP5 the same as before without making any changes.
Is this correct?
Thank you again for your patience
- TomKerekes
- Posts: 2677
- Joined: Mon Dec 04, 2017 1:49 am
Re: Question on encoders and limit switches
Hi Sagar,
No. The User Button is configured in KMotionCNC to run a C Program to Initialize your system. Put the code inside the main function in the C Program.Where exactly do I initialize the code? is it inside the kmotionCNC software (under the tool setup/ user buttons window? )
CorrectAnd once initialized, I am guessing that the sequence goes like this :
JP4
Encoder#0 : JP4 IO16 (Pin5) and JP4 IO17 (Pin6)
Encoder#1 : JP4 IO18 (Pin7) and JP4 IO19 (Pin10)
Encoder#2 : JP4 IO20 (Pin11) and JP4 IO21(Pin12)
Encoder#3 : JP4 IO22(Pin13) and JP4 IO22(Pin14)
JP6
Encoder#4 : JP6 IO26 (Pin5) and JP6 IO27 (Pin6)
Encoder#5 : JP6 IO28 (Pin7) and JP6 IO29 (Pin10)
Encoder#6 : JP6 IO30 (Pin11) and JP6 IO31(Pin12)
Encoder#7 : JP6 IO32(Pin13) and JP6 IO33(Pin14)
And I will be keeping the pin and IO configurations for the stepper's on JP7 and JP5 the same as before without making any changes.
Regards,
Tom Kerekes
Dynomotion, Inc.
Tom Kerekes
Dynomotion, Inc.
Re: Question on encoders and limit switches
Hi Tom,
I used :
FPGAW(ENC_NOISE_FILTER_ADD) = ENC_0_3_JP4 + ENC_4_7_JP6 + ENC_NOISE_FILTER_DEFAULT_VAL;
in my C program, however, the encoders are not working. The board disconnects from the computer as soon as it runs a few lines of G-code (It works perfectly fine without the encoder connections and a different config setup). Also, the step response plot for the measured velocity is 0. I am using the same JP4 and JP6 pins and I/Os as we discussed earlier.
I am uploading my code here (new8axis.txt)
Is it because I am using the wrong configuration?
My steppers have 5VDC differential encoders. I am supplying the 5V from an external source. And I am operating my KFLOP with USB power. I am also uploading a screenshot of the digital I/O screen.
Thank you again
I used :
FPGAW(ENC_NOISE_FILTER_ADD) = ENC_0_3_JP4 + ENC_4_7_JP6 + ENC_NOISE_FILTER_DEFAULT_VAL;
in my C program, however, the encoders are not working. The board disconnects from the computer as soon as it runs a few lines of G-code (It works perfectly fine without the encoder connections and a different config setup). Also, the step response plot for the measured velocity is 0. I am using the same JP4 and JP6 pins and I/Os as we discussed earlier.
I am uploading my code here (new8axis.txt)
Is it because I am using the wrong configuration?
My steppers have 5VDC differential encoders. I am supplying the 5V from an external source. And I am operating my KFLOP with USB power. I am also uploading a screenshot of the digital I/O screen.
Thank you again
- Attachments
-
- new8axis.txt
- (11.39 KiB) Downloaded 134 times
- TomKerekes
- Posts: 2677
- Joined: Mon Dec 04, 2017 1:49 am
Re: Question on encoders and limit switches
Hi Sagar,
It seems you configured IO bit numbers for the Input Channels rather than the Encoder Channel number to use.
For example KFLOP Axis Channel #0 should specify InputChan0=0 to use Encoder Channel #0.
You might read this article.
It isn't clear why this would cause a disconnect, but please correct this and see if there are still any problems.
It seems you configured IO bit numbers for the Input Channels rather than the Encoder Channel number to use.
For example KFLOP Axis Channel #0 should specify InputChan0=0 to use Encoder Channel #0.
You might read this article.
It isn't clear why this would cause a disconnect, but please correct this and see if there are still any problems.
Regards,
Tom Kerekes
Dynomotion, Inc.
Tom Kerekes
Dynomotion, Inc.