Closed loop - encoder/position not updating while moving
- backyardengineer
- Offline
- New Member
-
Less
More
- Posts: 13
- Thank you received: 3
23 Mar 2026 10:19 #344626
by backyardengineer
Closed loop - encoder/position not updating while moving was created by backyardengineer
Hello,
i am currently stuck implementing a direct closed loop (2 axis lathe, parallel port, stepper motor, linear scale for closed loop).
The problem is: I do get the right position feedback, when moving manually (DRO display is correct) and i can see the correct encoder positions (in Hal-Scope: encoder.0.position). However, as soon as i try to move the axis, it starts to move and errors out with following error. If i look in the hal-scope, the "encoder.0.position" does not move one bit during the move (stepper is moving).
--> Why does read out the position while idling but not while moving ?
Thanks
i am currently stuck implementing a direct closed loop (2 axis lathe, parallel port, stepper motor, linear scale for closed loop).
The problem is: I do get the right position feedback, when moving manually (DRO display is correct) and i can see the correct encoder positions (in Hal-Scope: encoder.0.position). However, as soon as i try to move the axis, it starts to move and errors out with following error. If i look in the hal-scope, the "encoder.0.position" does not move one bit during the move (stepper is moving).
--> Why does read out the position while idling but not while moving ?
Thanks
Please Log in or Create an account to join the conversation.
- meister
- Offline
- Platinum Member
-
Less
More
- Posts: 726
- Thank you received: 441
23 Mar 2026 11:57 #344631
by meister
Replied by meister on topic Closed loop - encoder/position not updating while moving
maybe the move is to fast or the resolution of the encoder too high for parport
Please Log in or Create an account to join the conversation.
- backyardengineer
- Offline
- New Member
-
Less
More
- Posts: 13
- Thank you received: 3
23 Mar 2026 12:09 #344632
by backyardengineer
Replied by backyardengineer on topic Closed loop - encoder/position not updating while moving
nope, moving way slower than by hand. It´s not getting any position change at all, even with super slow acceleration/velocity
Please Log in or Create an account to join the conversation.
- PCW
-
- Away
- Moderator
-
Less
More
- Posts: 17822
- Thank you received: 5214
23 Mar 2026 17:41 #344643
by PCW
Replied by PCW on topic Closed loop - encoder/position not updating while moving
Maybe an electrical issue, if you do a very slow commanded move
do the parallel port inputs pins used for reading the quadrature encoders
toggle as they should? (in halscope)
do the parallel port inputs pins used for reading the quadrature encoders
toggle as they should? (in halscope)
Please Log in or Create an account to join the conversation.
- backyardengineer
- Offline
- New Member
-
Less
More
- Posts: 13
- Thank you received: 3
23 Mar 2026 20:08 #344648
by backyardengineer
Replied by backyardengineer on topic Closed loop - encoder/position not updating while moving
It has somehow to do with the enabled stepper motors. As soon as the drive gets the enable signal the pins don´t change anymore (viewed them in hal config). Wen i check with the multimeter, the signal seems to be switching between 0.2V an 24V correctly (both with stepper enabled/disabled). Maybe it is an issue with those cheap breakout boards ?
Please Log in or Create an account to join the conversation.
- tommylight
-
- Away
- Moderator
-
Less
More
- Posts: 21467
- Thank you received: 7319
23 Mar 2026 22:42 #344651
by tommylight
But, 24V? What encoders are those?
Upload some pictures of the wiring here so we can have a look.
Replied by tommylight on topic Closed loop - encoder/position not updating while moving
That is almost always an interference/wiring/grounding/shielding issue, and cheap BOB's with optocouplers are very slow so will limit speed a lot, the ones with input buffers should be OK.It has somehow to do with the enabled stepper motors. As soon as the drive gets the enable signal the pins don´t change anymore (viewed them in hal config). Wen i check with the multimeter, the signal seems to be switching between 0.2V an 24V correctly (both with stepper enabled/disabled). Maybe it is an issue with those cheap breakout boards ?
But, 24V? What encoders are those?
Upload some pictures of the wiring here so we can have a look.
Please Log in or Create an account to join the conversation.
- backyardengineer
- Offline
- New Member
-
Less
More
- Posts: 13
- Thank you received: 3
24 Mar 2026 17:40 #344680
by backyardengineer
Replied by backyardengineer on topic Closed loop - encoder/position not updating while moving
Thank you for the suggestions. Those are Sino glass scales (KA500 and KA300 TTL 5V). I boosted the signal with npn transistors to 24v (reversing pin logic, shouldn´t matter though) as the smaller scale only gave a 3.3V signal which did not work. The weird thing for me is the working perfectly compared to not working at all, i woud expect a bad/unreliable signal from noise. I will try again on the weekend, putting input on COM1 and Steppers on COM2. Or i finally buy a mesa card ffs
. Any suggestions for a standard 2/3 Axis lathe with very little IO ?
Please Log in or Create an account to join the conversation.
- backyardengineer
- Offline
- New Member
-
Less
More
- Posts: 13
- Thank you received: 3
24 Mar 2026 17:43 #344681
by backyardengineer
Replied by backyardengineer on topic Closed loop - encoder/position not updating while moving
i was aware that i would get max. 1500-3000mm/min out of the COM Port. This would bee acceptable, as i will mainly use LinuxCNC as an ELS option with the occasional automated part (switching axis off when hand cranking of course)
Please Log in or Create an account to join the conversation.
- tommylight
-
- Away
- Moderator
-
Less
More
- Posts: 21467
- Thank you received: 7319
25 Mar 2026 23:51 #344746
by tommylight
Replied by tommylight on topic Closed loop - encoder/position not updating while moving
Some clarifications before this goes sideways:
-COM0/COM1/COM2 are referred to serial ports, be it RS232 o other, usually.
-LPT0/LPT1/LPT2 and sometimes only P0/P1/P2 are referred to parallel ports, usually.
What are you referring to with COMn ?
Serial ports are pretty much useless with LinuxCNC, except for some stuff.
Parallel ports, also known as IEEE 1284, are used for machine control still, are perfectly usable with LinuxCNC, but have limited pulse rate capabilities compared to Mesa board.
Reasonable pulse rate or encoder pulse rate for parallel port would be 10000-20000 PPS, sometimes can go to 50000 PPS with a bit of luck/tweaking the BIOS.
At 3000 RPM, that is 50 RPS, so for a 100PPR encoder ends up 5000 PPS, and for a 1000PPR encoder it is already way to fast for most PC setups, see above.
Now convert that to mm/m, as you gave us no info about drive/gear/reduction.
After all that, yes, you can use a parallel port, yes it will work with encoders (2 max normally per port), and yes, you can lower the speed if you have higher count encoders.
But first, fix the wiring and get rid of interference/bad grounding.
-COM0/COM1/COM2 are referred to serial ports, be it RS232 o other, usually.
-LPT0/LPT1/LPT2 and sometimes only P0/P1/P2 are referred to parallel ports, usually.
What are you referring to with COMn ?
Serial ports are pretty much useless with LinuxCNC, except for some stuff.
Parallel ports, also known as IEEE 1284, are used for machine control still, are perfectly usable with LinuxCNC, but have limited pulse rate capabilities compared to Mesa board.
Reasonable pulse rate or encoder pulse rate for parallel port would be 10000-20000 PPS, sometimes can go to 50000 PPS with a bit of luck/tweaking the BIOS.
At 3000 RPM, that is 50 RPS, so for a 100PPR encoder ends up 5000 PPS, and for a 1000PPR encoder it is already way to fast for most PC setups, see above.
Now convert that to mm/m, as you gave us no info about drive/gear/reduction.
After all that, yes, you can use a parallel port, yes it will work with encoders (2 max normally per port), and yes, you can lower the speed if you have higher count encoders.
But first, fix the wiring and get rid of interference/bad grounding.
Please Log in or Create an account to join the conversation.
- backyardengineer
- Offline
- New Member
-
Less
More
- Posts: 13
- Thank you received: 3
02 Apr 2026 20:28 #345078
by backyardengineer
Replied by backyardengineer on topic Closed loop - encoder/position not updating while moving
Hi, my bad i did not mean COM but parallel port (must be a habit from my Arduino days). I did try to put the encoders on the second par port (parport 1) and for some reason it works now (parport 0 = stepper outputs, parport1 = encoder inputs). No idea why, i don´t think it is grounding related though.
As for the encoders: They are linear scales (5µm), my math was 5000 to 10000PPS * 0.005mm * 60 = 1500 to 3000 mm/min. The spindle has a 400PPR Encoder and max spindle speed is 3000rpm.
I still have to get the inputs on parport0 working to read the spindle encoder. Tomorrow i can send pics of the wiring.
As for the encoders: They are linear scales (5µm), my math was 5000 to 10000PPS * 0.005mm * 60 = 1500 to 3000 mm/min. The spindle has a 400PPR Encoder and max spindle speed is 3000rpm.
I still have to get the inputs on parport0 working to read the spindle encoder. Tomorrow i can send pics of the wiring.
The following user(s) said Thank You: tommylight
Please Log in or Create an account to join the conversation.
Time to create page: 0.075 seconds