- Posts: 54
- Thank you received: 0
Spindle Encoder For Speed Control
- danimal300
- Topic Author
- Offline
- Senior Member
-
I have 2.6.5 controlling a G540 to run my retrofit machine.
I have installed a simple hall switch encoder that I have a verified 8V pulse at 1 pulse per revolution, but I could easily add magnets to get more pulses if needed.
I have tried reading every .hal modification file that I can find online, but honestly I have no idea what emc2 is looking for. I have verified the pinout on the G540 and selected pin1 which corresponds to pin10 on the parallel port. Using stepconfig, I can get the speed display to show up, but it does nothing.
Can someone explain to me the big picture (i.e pulse comes into machine, is read by xxx.hal configuration which looks at xxx.hal file and outputs the scaled RPM value to the screen)
Second, for a very simple configuration like this what would I need to add to my .hal files? Also I accidently ran stepconfig and lost my backlash values and various other little tweaks, so I am not opposed to upgrading or changing anything if that makes life easier/ better because I will be doing everything again anyway. So my machine is starting from a stock configuration, and the only real changes to anything are for step and workspace configuration.
Please Log in to join the conversation.
- Todd Zuercher
- Offline
- Platinum Member
-
- Posts: 4739
- Thank you received: 2
linuxcnc.org/docs/html/examples/spindle.html#_spindle_feedback
linuxcnc.org/docs/html/examples/spindle.html#_spindle_at_speed
For your situation only using one pulse/rev, you would connect the signal connected to the parallel port input to both the index and A-phase of the encoder component.
The basic gist of it is the encoder component reads the pulses and outputs a velocity signal that is connected to the spindle feedback and any display you use.
Please Log in to join the conversation.
- danimal300
- Topic Author
- Offline
- Senior Member
-
- Posts: 54
- Thank you received: 0
encoder.N.index-enable bit i/o
When true, counts and position are reset to zero on the next rising edge of Phase-Z. At the same time, index-enable is reset to zero to indicate that the rising edge has occurred.
I only have a single a chanel, should I duplicate it and bring it in on pin 11 as the index? (being that I have one pulse per revolution)
Please Log in to join the conversation.
- danimal300
- Topic Author
- Offline
- Senior Member
-
- Posts: 54
- Thank you received: 0
Todd Zuercher wrote: There are pretty good instructions (including example code to add to your hal file) in the Linuxcnc documentation here.
linuxcnc.org/docs/html/examples/spindle.html#_spindle_feedback
linuxcnc.org/docs/html/examples/spindle.html#_spindle_at_speed
For your situation only using one pulse/rev, you would connect the signal connected to the parallel port input to both the index and A-phase of the encoder component.
The basic gist of it is the encoder component reads the pulses and outputs a velocity signal that is connected to the spindle feedback and any display you use.
Just so I am understanding this, the code supplements in the linked files should go into custom_postgui.hal correct?
I get the file exists error when I place the Spindle Synchronized Motion into that hal file.
Please Log in to join the conversation.
- danimal300
- Topic Author
- Offline
- Senior Member
-
- Posts: 54
- Thank you received: 0
Man it hurts to spend an entire holiday weekend trying to fix something thats not broken. Well I learned a ton about hal, so thats nice.
Please Log in to join the conversation.
Attachment not found
Then I would assign BOTH the ENCODER A and INDEX to the same para port pin... (Pin13)...
Copy from manual... edited...
Re: linuxcnc.org/docs/html/examples/spindle.html#_spindle_feedback
Does that look about right? (I'll wire it up and attempt it likely this weekend time permitting. It would be nice to have an active spindle speed display instead of just a static one. (And a true "at speed" indicator as well.)
Thanks,
Jerry
Please Log in to join the conversation.
- danimal300
- Topic Author
- Offline
- Senior Member
-
- Posts: 54
- Thank you received: 0
Please Log in to join the conversation.
