Encoder Pins linked to LCNC
01 Feb 2019 17:56 #125485
by andypugh
Probably true.
Homing to absolute encoders came in in 2016
github.com/LinuxCNC/linuxcnc/commit/f59b...9e0fd6b15af29a0c29c3
Reading serial absolute encoders was 2013
github.com/LinuxCNC/linuxcnc/commit/83f2...d099a1150fb601cd785d
Replied by andypugh on topic Encoder Pins linked to LCNC
years and years ago only incremental encoders would work
Probably true.
Homing to absolute encoders came in in 2016
github.com/LinuxCNC/linuxcnc/commit/f59b...9e0fd6b15af29a0c29c3
Reading serial absolute encoders was 2013
github.com/LinuxCNC/linuxcnc/commit/83f2...d099a1150fb601cd785d
Please Log in or Create an account to join the conversation.
21 Mar 2019 01:59 #129135
by CORBETT
Replied by CORBETT on topic Encoder Pins linked to LCNC
Ok, finally was able to get back to the original project. After wasting a lot of time, I realized that the new encoders were open collector and I had thought we bought voltage output type... So with this in mind I went and pulled one of the open collector 5 volt encoders from the machine and added a 10K pull up resistor wired to the +24V BUS and now have the EL5151 input led flashing for the first time ever. Now when you rotate the encoder, the input led’s for A & B channel flash accordingly letting me know the module is “seeing” the encoder output. Now that I finally have one of the existing machine encoders working with the EL5151 encoder module, I tried opening the hal configuration to watch the encoder pins but could not see a change in any of the pins.
Todd, I tried tying the x-pos-fb to the encoder scale pin which I am pretty sure is “lcec.0.D19.enc-pos-scale”, but did not get it working. I have tried watching all of the pins and hooking the x-pos-fb to other pins such as the “enc-count”, “enc-pos”, “enc-period” but nothing seems to work. I would have assumed there would be some change in the enc period or count pins, but nothing happens when rotating the encoder. I did follow up and remove the “loadrt encoder” component, so that is not a issue. Below is the list of encoder pins in case I am trying to tie to the wrong pin.
7 s32 OUT 0 lcec.0.D19.enc-count
7 bit OUT FALSE lcec.0.D19.enc-expol-stall
7 bit OUT FALSE lcec.0.D19.enc-ina
7 bit OUT FALSE lcec.0.D19.enc-inb
7 bit OUT FALSE lcec.0.D19.enc-inc
7 bit I/O FALSE lcec.0.D19.enc-index-c-enable
7 bit I/O FALSE lcec.0.D19.enc-index-ext-neg-enable
7 bit I/O FALSE lcec.0.D19.enc-index-ext-pos-enable
7 bit OUT FALSE lcec.0.D19.enc-inext
7 bit OUT FALSE lcec.0.D19.enc-latch-c-valid
7 bit OUT FALSE lcec.0.D19.enc-latch-ext-valid
7 float OUT 3.355443 lcec.0.D19.enc-period
7 float OUT 0 lcec.0.D19.enc-pos
7 float I/O 1 lcec.0.D19.enc-pos-scale
7 s32 OUT 0 lcec.0.D19.enc-raw-count
7 s32 OUT 0 lcec.0.D19.enc-raw-latch
7 u32 OUT 0x01FFFFFE lcec.0.D19.enc-raw-period
7 bit IN FALSE lcec.0.D19.enc-reset
7 bit I/O FALSE lcec.0.D19.enc-set-raw-count
7 s32 IN 0 lcec.0.D19.enc-set-raw-count-val
7 bit OUT FALSE lcec.0.D19.enc-sync-error
7 bit OUT TRUE lcec.0.D19.enc-tx-toggle
7 bit OUT TRUE lcec.0.D19.slave-online
7 bit OUT TRUE lcec.0.D19.slave-oper
7 bit OUT FALSE lcec.0.D19.slave-state-init
7 bit OUT TRUE lcec.0.D19.slave-state-op
7 bit OUT FALSE lcec.0.D19.slave-state-preop
7 bit OUT FALSE lcec.0.D19.slave-state-safeop
Any Idea what I am doing wrong?
Thanks,
Robert
Todd, I tried tying the x-pos-fb to the encoder scale pin which I am pretty sure is “lcec.0.D19.enc-pos-scale”, but did not get it working. I have tried watching all of the pins and hooking the x-pos-fb to other pins such as the “enc-count”, “enc-pos”, “enc-period” but nothing seems to work. I would have assumed there would be some change in the enc period or count pins, but nothing happens when rotating the encoder. I did follow up and remove the “loadrt encoder” component, so that is not a issue. Below is the list of encoder pins in case I am trying to tie to the wrong pin.
7 s32 OUT 0 lcec.0.D19.enc-count
7 bit OUT FALSE lcec.0.D19.enc-expol-stall
7 bit OUT FALSE lcec.0.D19.enc-ina
7 bit OUT FALSE lcec.0.D19.enc-inb
7 bit OUT FALSE lcec.0.D19.enc-inc
7 bit I/O FALSE lcec.0.D19.enc-index-c-enable
7 bit I/O FALSE lcec.0.D19.enc-index-ext-neg-enable
7 bit I/O FALSE lcec.0.D19.enc-index-ext-pos-enable
7 bit OUT FALSE lcec.0.D19.enc-inext
7 bit OUT FALSE lcec.0.D19.enc-latch-c-valid
7 bit OUT FALSE lcec.0.D19.enc-latch-ext-valid
7 float OUT 3.355443 lcec.0.D19.enc-period
7 float OUT 0 lcec.0.D19.enc-pos
7 float I/O 1 lcec.0.D19.enc-pos-scale
7 s32 OUT 0 lcec.0.D19.enc-raw-count
7 s32 OUT 0 lcec.0.D19.enc-raw-latch
7 u32 OUT 0x01FFFFFE lcec.0.D19.enc-raw-period
7 bit IN FALSE lcec.0.D19.enc-reset
7 bit I/O FALSE lcec.0.D19.enc-set-raw-count
7 s32 IN 0 lcec.0.D19.enc-set-raw-count-val
7 bit OUT FALSE lcec.0.D19.enc-sync-error
7 bit OUT TRUE lcec.0.D19.enc-tx-toggle
7 bit OUT TRUE lcec.0.D19.slave-online
7 bit OUT TRUE lcec.0.D19.slave-oper
7 bit OUT FALSE lcec.0.D19.slave-state-init
7 bit OUT TRUE lcec.0.D19.slave-state-op
7 bit OUT FALSE lcec.0.D19.slave-state-preop
7 bit OUT FALSE lcec.0.D19.slave-state-safeop
Any Idea what I am doing wrong?
Thanks,
Robert
Please Log in or Create an account to join the conversation.
21 Mar 2019 07:06 #129143
by pl7i92
Replied by pl7i92 on topic Encoder Pins linked to LCNC
you may give the infos of this reread also THE Base Controller
so Users dont ned to find out on backsides what hardware you are using
most pins are OUT state
so Users dont ned to find out on backsides what hardware you are using
most pins are OUT state
Please Log in or Create an account to join the conversation.
21 Mar 2019 10:03 #129150
by andypugh
Replied by andypugh on topic Encoder Pins linked to LCNC
First check if you see any changes in the in-a, in-b and in-c pins. Those should pulse as the encoder rotates.
If those are changing then the count should change too.
I don't know anything at all about EtherCAT, though, so can't help with the specifics.
How are you monitoring the pins? With Halmeter?
If those are changing then the count should change too.
I don't know anything at all about EtherCAT, though, so can't help with the specifics.
How are you monitoring the pins? With Halmeter?
Please Log in or Create an account to join the conversation.
24 Mar 2019 03:35 #129432
by CORBETT
Replied by CORBETT on topic Encoder Pins linked to LCNC
Yeah, the more that I think about it the more that I believe there is a parameter that needs to be set in the Beckhoff module. I am starting to think that it needs to be setup or re-set in the Beckhoff Twin-CAT software. I don't see any change in the A or B channel output or anything changing on any of the other pins. I know the module can have several modes, and I think they may be set wrong and not outputting when looking at them in LCNC. I may jump over to the "EtherCAT HAL driver" thread and see if anyone there has set one up or is familiar with this specific module.
Please Log in or Create an account to join the conversation.
27 Apr 2019 05:11 #132062
by CORBETT
Replied by CORBETT on topic Encoder Pins linked to LCNC
Ok, here is a update and my current problem.
I knew that something was up with the Beckhoff EL5151's as it has to be a parameter or something setup in Beckhofff TwinCAT.
I have a test setup in the house that is identical to the unit that is installed in my Hurco out in the shop. I have been using a Beckhoff CX computer tied to the EK1100 & Slave's. These particular units are PC104 type motherboards and therefore do not have a PCI or PCIe slot, so I decided to go pull one of our office computers (Dell OptiPlex 9020) and added a DB25 PCIe card. Then found a older CNC4PC C10 breakout board that we had on the shelf and hooked the existing 5v encoders to the inputs. Then re-worked the HAL code to use hal_parport for the encoder inputs and finally have the encoders showing up and working. Then after a bit of trial and error, have gotten the SCALE really close. I put a dial indicator in the spindle and when moving the Y ballscrew 0.10" manually by hand, I was getting 0.1002 on the Axis GUI readout. Then did the same process with Z to get it SCALED, as I can easily get to the Y & Z ballscrews and move them by hand with amp shunted. X is not as quick to get to, but have it scaled.
Also, I have gotten everything else hooked up and working correctly through EtherCAT. The proximity switches are tied in, the spindle is fully working in forward and reverse plus brake. Also re-built the pendant and have the pushbuttons working. Plus have the analog outputs from the EL4132's hooked to the Servomate Amp. Before I had gotten the encoders working through the breakout board, I wrote some wacky HAL code using sim.encoders to at least check if each axis was moving in the correct direction. I had the proximity switches tied in and working, plus my E-stop is tied in both to LCNC and directly to the controller to shunt the servomate amp if anything went wrong. Everything did move in the correct directions, but was drifting when the amp was enabled. I thought that it was something wrong with my HAL code and brushed it off at the time.
Well now I have the encoders working and since they work, I can see that when I enable the machine all three encoders start moving in one direction. I kept thinking I had something wrong in the HAL code, but then I decided to remove the signal wires from the amp and when I enabled the amp it drifted the same way as before.
SO my problem and question is do I need to adjust the amp and stop the drift, or do I get the HAL code correct by closing the loop and let LCNC control the drift? I have read conflicting things on the net and not quite sure what is the correct path. I would assume the amps are tuned fine as everything was working ok until my OEM Hurco computer went out.
If the amp needs adjusting, my future question is does anyone know what POT that I need to adjust to stop the drift. Each board has 6 pots on it. (CLM, GAN, BAL, TAC, AUX, SIG), which I believe is CLM - current limit, GAN - gain adjustment, BAL - balance for -10/+10, TAC - tach feedback, AUX - auxilary???, and SIG - signal. Everywhere I looked on the net shows a process for tuning the amps, but I believe I had seen somewhere that you back off on the gain to stop drift, but I am not sure.
I wanted to ask here before just messing with the POT's as I know it is easy to screw the tuning up. Plus I know my HAL code is most likely off as I not completely sure the pid part is correct, but wanted to find out which direction is the proper way to go from here.
Thanks,
Robert
I knew that something was up with the Beckhoff EL5151's as it has to be a parameter or something setup in Beckhofff TwinCAT.
I have a test setup in the house that is identical to the unit that is installed in my Hurco out in the shop. I have been using a Beckhoff CX computer tied to the EK1100 & Slave's. These particular units are PC104 type motherboards and therefore do not have a PCI or PCIe slot, so I decided to go pull one of our office computers (Dell OptiPlex 9020) and added a DB25 PCIe card. Then found a older CNC4PC C10 breakout board that we had on the shelf and hooked the existing 5v encoders to the inputs. Then re-worked the HAL code to use hal_parport for the encoder inputs and finally have the encoders showing up and working. Then after a bit of trial and error, have gotten the SCALE really close. I put a dial indicator in the spindle and when moving the Y ballscrew 0.10" manually by hand, I was getting 0.1002 on the Axis GUI readout. Then did the same process with Z to get it SCALED, as I can easily get to the Y & Z ballscrews and move them by hand with amp shunted. X is not as quick to get to, but have it scaled.
Also, I have gotten everything else hooked up and working correctly through EtherCAT. The proximity switches are tied in, the spindle is fully working in forward and reverse plus brake. Also re-built the pendant and have the pushbuttons working. Plus have the analog outputs from the EL4132's hooked to the Servomate Amp. Before I had gotten the encoders working through the breakout board, I wrote some wacky HAL code using sim.encoders to at least check if each axis was moving in the correct direction. I had the proximity switches tied in and working, plus my E-stop is tied in both to LCNC and directly to the controller to shunt the servomate amp if anything went wrong. Everything did move in the correct directions, but was drifting when the amp was enabled. I thought that it was something wrong with my HAL code and brushed it off at the time.
Well now I have the encoders working and since they work, I can see that when I enable the machine all three encoders start moving in one direction. I kept thinking I had something wrong in the HAL code, but then I decided to remove the signal wires from the amp and when I enabled the amp it drifted the same way as before.
SO my problem and question is do I need to adjust the amp and stop the drift, or do I get the HAL code correct by closing the loop and let LCNC control the drift? I have read conflicting things on the net and not quite sure what is the correct path. I would assume the amps are tuned fine as everything was working ok until my OEM Hurco computer went out.
If the amp needs adjusting, my future question is does anyone know what POT that I need to adjust to stop the drift. Each board has 6 pots on it. (CLM, GAN, BAL, TAC, AUX, SIG), which I believe is CLM - current limit, GAN - gain adjustment, BAL - balance for -10/+10, TAC - tach feedback, AUX - auxilary???, and SIG - signal. Everywhere I looked on the net shows a process for tuning the amps, but I believe I had seen somewhere that you back off on the gain to stop drift, but I am not sure.
I wanted to ask here before just messing with the POT's as I know it is easy to screw the tuning up. Plus I know my HAL code is most likely off as I not completely sure the pid part is correct, but wanted to find out which direction is the proper way to go from here.
Thanks,
Robert
Please Log in or Create an account to join the conversation.
- tommylight
- Away
- Moderator
Less
More
- Posts: 19218
- Thank you received: 6440
27 Apr 2019 10:53 #132082
by tommylight
Replied by tommylight on topic Encoder Pins linked to LCNC
Adjusting the drives should be avoided, they are supposed to drift slowly when no input is present.
Have to read the rest of the thread as i read everything and i do not want to mess something.
Linuxcnc when properly set and enabled, no drift should occur and if you try to move the motors manually they should resist vigorously.
Have to read the rest of the thread as i read everything and i do not want to mess something.
Linuxcnc when properly set and enabled, no drift should occur and if you try to move the motors manually they should resist vigorously.
The following user(s) said Thank You: CORBETT
Please Log in or Create an account to join the conversation.
28 Apr 2019 04:48 #132159
by CORBETT
Replied by CORBETT on topic Encoder Pins linked to LCNC
Tommy,
Thanks for responding so quick. I was thinking that it should be done with LCNC at this point, but wanted to make sure as I had seen a different post that had me second guessing myself.
Originally, I was reading some older info I saved years ago from Jon Elson, and he had stated servo drift would happen and that when the loop was closed in EMC that it would control the drift.... but I had read part of John Thornton's tuning page and one of the first things was to stop the drift, which made me second guess everything. In other words, I was starting think that the amps needed re-tuning to the Beckhoff hardware, but that didn't make sense as it's -10/+10 voltage which is nothing special between hardware, so therefore I was positive that the amps were ok and I was simply wrong on my HAL code and not closing the loop. I am not totally verse in all of the PID code and linking everything together, so that is why I am second guessing things and needed confirmation of which route to take. I definitely did not want to mess up the tuning since they were fine before. I feel that I am close on the code and hope I can get it figured out soon.
Once again, thanks for taking part of your time to help point me in the correct direction as it is easy to waste time on dead ends…. It is much appreciated.
Thanks,
Robert
Thanks for responding so quick. I was thinking that it should be done with LCNC at this point, but wanted to make sure as I had seen a different post that had me second guessing myself.
Originally, I was reading some older info I saved years ago from Jon Elson, and he had stated servo drift would happen and that when the loop was closed in EMC that it would control the drift.... but I had read part of John Thornton's tuning page and one of the first things was to stop the drift, which made me second guess everything. In other words, I was starting think that the amps needed re-tuning to the Beckhoff hardware, but that didn't make sense as it's -10/+10 voltage which is nothing special between hardware, so therefore I was positive that the amps were ok and I was simply wrong on my HAL code and not closing the loop. I am not totally verse in all of the PID code and linking everything together, so that is why I am second guessing things and needed confirmation of which route to take. I definitely did not want to mess up the tuning since they were fine before. I feel that I am close on the code and hope I can get it figured out soon.
Once again, thanks for taking part of your time to help point me in the correct direction as it is easy to waste time on dead ends…. It is much appreciated.
Thanks,
Robert
Please Log in or Create an account to join the conversation.
28 Apr 2019 07:41 #132162
by HueyHQ
Replied by HueyHQ on topic Encoder Pins linked to LCNC
Tommy: Is this true? I also read JTs post about setting the drives before tuning, and zeroed out all drift. Is this part of the reason I am having trouble tuning my servos?Adjusting the drives should be avoided, they are supposed to drift slowly when no input is present.
Have to read the rest of the thread as i read everything and i do not want to mess something.
Linuxcnc when properly set and enabled, no drift should occur and if you try to move the motors manually they should resist vigorously.
Please Log in or Create an account to join the conversation.
28 Apr 2019 15:43 #132181
by CORBETT
Replied by CORBETT on topic Encoder Pins linked to LCNC
Also on a tangent...
If anyone has a early 80's Hurco KMB1 and has any questions on how to interface with the machine, don't hesitate to contact me (Just so you know, I am not on here every day... very busy).
I have the complete operators manual, parts manual, and wiring schematics. I have kept all of my OEM parts in the machine and simply removed the computer and power supply, then wired directly into the TB3 and TB8 connectors, plus other wiring that went to the OEM computer. Let me do state that I am not a electrical and/or mechanical engineer and simply would give info and help to anyone that was in my situation (stuck like chuck), and do not assume any liability... in layman's terms I don't want anyone to get hurt or killed... This is suppose to be a positive experience, not a negative one.
Thanks,
Robert
If anyone has a early 80's Hurco KMB1 and has any questions on how to interface with the machine, don't hesitate to contact me (Just so you know, I am not on here every day... very busy).
I have the complete operators manual, parts manual, and wiring schematics. I have kept all of my OEM parts in the machine and simply removed the computer and power supply, then wired directly into the TB3 and TB8 connectors, plus other wiring that went to the OEM computer. Let me do state that I am not a electrical and/or mechanical engineer and simply would give info and help to anyone that was in my situation (stuck like chuck), and do not assume any liability... in layman's terms I don't want anyone to get hurt or killed... This is suppose to be a positive experience, not a negative one.
Thanks,
Robert
Please Log in or Create an account to join the conversation.
Time to create page: 0.167 seconds