Spindle Encoder Issues

More
10 Nov 2023 21:09 #285051 by Trevy3
I currently have two issues with my spindle encoder I just installed. The first is figuring out how to get the speed feedback bar working in gmoccapy. The second is the feedback rpm is not at all correct above about 300rpm. I am working with a C11G parport board.

On the first issue, I know I need to put "net spindle-fb-rpm-abs-filtered => gmoccapy.spindle_feedback_bar" and "net spindle-at-speed => gmoccapy.spindle_at_speed_led" in the custom postgui hal file, and that's fine, but the problem is I'm not sure how to set up the main hal file to get the "spindle-fb-rpm-abs-filtered" output. I have looked as much as I can but other people have them set up for ethernet setups instead of parport. If anyone could guide me in the right direction to set up the spindle output, that would be great. I have been testing the rpm in axis with the pyvcp panel since gmoccapy feedback isn't working.

 

File Attachment:

File Name: MiniLatheN...1-10.hal
File Size:4 KB


The second issue is the feedback rpm in axis pyvcp panel and halshow is jumping around a lot above 300rpm. It goes from 20 to about 500rpm randomly, so it's not getting the encoder signal correctly for some reason. I am using a 360p/r encoder at 5V. It has a gear increase so I have it set to 480p/r, or 1920p/r quad in hal. It operates slightly better without quadrature, but still has the issue.
www.amazon.com/Signswise-Incremental-Enc...r%2Caps%2C230&sr=8-1.

Here is the halmeter at 50% speed, about 1000rpm.

 

The encoder pulses correctly at low rpm, so it's not that. It also doesn't appear to be a noise issue, I have it away from power wires. The only thing I can think of right now is it may be a timing issue of some sort. I have it assigned to the base clock right now. If anyone knows what could be causing this, that would be great.
Attachments:

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

More
10 Nov 2023 22:02 #285055 by tommylight
Replied by tommylight on topic Spindle Encoder Issues
Do you get latency warnings when you start LinuxCNC?
Using a parallel port limits a lot the speed of pulses it can generate or read, in your case 10000 pulses per second, and that is exactly where you are running into issues as 300RPM at 1920 PPR is 9600 pulses per second, granted 1920 is 960 pulses per pin plus 960 pauses in between.
A 100PPR encoder would help a bit, in your case probably 900-1200 RPM, but again way to low to be usable.
-
If you just need the speed, a sensor with a slotted disk with 5-10 slots will do just fine and get to over 10000 RPM readings.

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

More
10 Nov 2023 22:22 #285060 by Trevy3
Replied by Trevy3 on topic Spindle Encoder Issues
Yes, I was a bit concerned with the latency issues of parport. Would the best solution here be to switch to a 7i96s or similar to fix this? I would like to do synced motion. Switching boards will definitely be quite a bit of work for me, I'll also need to get a relay board and pwm to analog converter for the spindle control. But if that's the only way to get higher speeds, then that might be what I do.

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

More
10 Nov 2023 23:55 #285064 by tommylight
Replied by tommylight on topic Spindle Encoder Issues
Mesa 7i96S has a spindle output and spindle encoder input, it does analog 0-10V out of the box.
Also can read encoder in mega hertz ranges per second, so any encoder will do.

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

More
16 Nov 2023 11:09 #285598 by timo
Replied by timo on topic Spindle Encoder Issues
I tried a (cheap) parport BOB with a 100 ppr Encoder. The thing was hopeless.
It was loosing signals all the time even at relatively low spindle speeds below 500 rpm.
Use a dedicated hardware! The only useful advise I can give. Tommylight is right.

Sorry that I keep posting the same yet again, but it took me so many hours to try to make it work and with the right hardware it just was plug and play in 2 hours up and running.
The following user(s) said Thank You: tommylight

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

More
16 Nov 2023 16:46 - 16 Nov 2023 16:50 #285631 by Mecanix
Replied by Mecanix on topic Spindle Encoder Issues

I tried a (cheap) parport BOB with a 100 ppr Encoder. The thing was hopeless.
It was loosing signals all the time even at relatively low spindle speeds below 500 rpm.
 
 


I would like to see evidence for this claim if possible.

I am running a 100p/r over one of the cheapest possible BOB you can make out of kicad and $4 worth of passives, opto and connectors, and I am getting spot-on pulse for Phase A, Phase B and Index Z (all 3) up to 2200RPM. Measured with both a Rigol 250Mhz oscilloscope and confirmed with the Lncn software scope. And that after a few hundred thread and rigid tapping operations. None failed. Sure you're not hosting the town's EMI and entire district's noise in your system? 

[EMCMOT]
EMCMOT = motmod
COMM_TIMEOUT = 1.0
BASE_PERIOD = 50000
SERVO_PERIOD = 1000000



Last edit: 16 Nov 2023 16:50 by Mecanix.

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

More
16 Nov 2023 17:09 - 16 Nov 2023 17:21 #285632 by Mecanix
Replied by Mecanix on topic Spindle Encoder Issues
For others who are looking for an easy, cost effective and highly reliable A, B and Z pulse solution (0~2200RPM).
Encoder used OMRON E6B2-CWZ3E
LinuxCnc 2.9.1, Debian 12. Shielded signal wired. 
Geez...

(hal)
loadrt [KINS]KINEMATICS
loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS
loadrt hal_parport cfg="0x0378 x"

(ini)
[EMCMOT]
EMCMOT = motmod
COMM_TIMEOUT = 1.0
BASE_PERIOD = 50000
SERVO_PERIOD = 1000000

Attachments:
Last edit: 16 Nov 2023 17:21 by Mecanix.
The following user(s) said Thank You: timo

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

More
16 Nov 2023 17:20 #285633 by tommylight
Replied by tommylight on topic Spindle Encoder Issues
2200RPM is a very slow spindle, so it works easily with parallel port, granted you have good optos and a good PC latency ...
See, to many things in play there, but most important is shielded cable, as you have mentioned.
And finding a PC that can reliably do 50000 base period is becoming harder, as is finding it with a built in parallel port.
Had a Fujitsu-Siemens workstation that did 15000 reliably ... it died! :(

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

More
16 Nov 2023 17:26 #285636 by Mecanix
Replied by Mecanix on topic Spindle Encoder Issues
Lenovo ThinkCenter M6180S. Can be brought down much lower too, and put up with higher RPM ofc. For this set-up however I sure can guaranty 2200RPM as this is what's been threading and tapping hundreds of parts already.

So much out of a fifty bucks entire set-up. Lcnc for the Noble Prize.
The following user(s) said Thank You: tommylight

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

More
17 Nov 2023 08:06 - 17 Nov 2023 09:14 #285708 by timo
Replied by timo on topic Spindle Encoder Issues
Haha,
@ Mecanix ( only philosophical content not technical )

You will have to live with my anecdotal evidence. I live with your anecdotal evidence! :-)
I am not going to try to replicate my nightmare experience to proof anything here, no chance! Does not make sense at all.
If your system works for you that is fair (and good) enough.
Are you sure that all your knowledge, time spent and ownership of electronic tools is only worth 50$? ( I hope you are not self employed or have a boss who knows how you value your own efforts )

I noticed (by the time) that the workpiece and the cutter went out of sync after the process went on for 20 minutes or so, This was causing artefacts on my workpiece (skinny gear teeth)
  • Encoder (I use probably the same as you, there are original Omrons and Fake China, I am not sure about mine, it was 2nd (or 3rd) hand.
  • BOB mine is different from yours. They do not all have the same response time. People and datasheets claim that there are different types of opto couplers.
  • Latency of my PC, I do not remember the numbers, but it was not impressive ( maybe more on the "just barely good enough" side of things. )
  • Anecdotal part: Can you proof that yours is working? :-) (just mocking you) I mean depending on the use case a few lost counts here and there might not matter that much.
  • EMI? No I am not so sure about that, my setup is sketchy as hell. Very possibly a good point and a big suspect, If I wanted to dig into the issue deeper this is high up the list. But I just want the machine do something, not dive deep into hardware design to get something done that I can buy. (relatively affordable). Let alone convincing my neighbours that they have to EMI proof the EDM machines, so that I can use my China BOB. :-)
  • I had discussions with Mach3 users, they claim they can thread on a lathe with only one index pulse per rev. :-/ I am not convinced.
  • Confirmation that it is working is still no less anecdotal evidence than my claim that it was hopeless (for me). I still would advise people to consider better hardware, because that obviously relies less on luck.
    • There is as always a trade off. (Time, Oscilloscope $$$$$$, soldering, desoldering, re-soldering, (re)ordering boards and parts, reading datasheets, knowing what you are doing )


      Greetings Timo


      p.s. My lawyer wants to charge me 500 USD just to read this post....  ;-/
Last edit: 17 Nov 2023 09:14 by timo.

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

Time to create page: 0.127 seconds
Powered by Kunena Forum