Spindle rotation sensor

More
20 Sep 2018 00:04 #117772 by pferrick
Hi all-

Having (finally) gotten my head around basic HAL connections, I now would like to work with the sensors that are in my spindle. The spindle has a pneumatically-controlled drawbar, and provides the following:

1. actuator in home position (ie. not in contact with the spindle, so OK to spin)
2. toolholder clamped
3. unclamped (ie. no toolholder present)
4. spindle stopped

Part one will involve using various logic components to let HAL decide if it's safe to actuate the drawbar and release the toolholder. (In other words, sensors #2 and #4 are both true). And if it's OK to start the spindle, etc. I'm pretty confident that I can manage the basic logic connections, but where I'm a bit stumped is with rotation sensor.

The rotation sensor generates a logic TRUE twice per revolution, I suppose with some sort of slotted disk/opto sensor. Anyway, the issue is that depending on the final resting position of the spindle, this sensor might be TRUE or FALSE. So what I need is something along the lines of:

"watch the spindle sensor for some length of time, and if its state hasn't changed then the spindle is stopped"

I'm guessing that a timedelay might be involved, but that's about as far as I've gotten...! I haven't been able to find a HAL component "out there" for this purpose, and to be honest I'm equal parts excited and terrified at the thought of creating one.

Any pointers would be greatly appreciated.

thanks,
Pat

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

More
20 Sep 2018 12:37 #117786 by andypugh
Replied by andypugh on topic Spindle rotation sensor
I wonder if you can replace the slotted disc with one with more holes, and then you would have a spindle encoder for rigid tapping etc.

But, the simplest way to detect rotation with your existing hardware is still to use the encoder component. Then consider the reported velocity to determine if the spindle is turning. (With a lowpass filter this probably will also give a good spindle speed to display in the GUI)

With a single channel encoder you will need to set counter-mode to 1.

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

More
29 Sep 2018 19:54 #118190 by pferrick
Replied by pferrick on topic Spindle rotation sensor
Thanks, Andy! I was successful in adding an encoder, and I have a HAL meter displaying the speed of the spindle.

Now the question is: what lowpass filter will settle down the displayed speed?

I find that the reading jumps up and down (with about a 1s period) by an amount proportional to the speed...around +/- 500 at 5000 RPM...! Not exactly the accuracy that I was hoping for! I tried adding these lines to my hal file, but so far haven't seen any changes:

loadrt lowpass names=lowpass.spindle
addf lowpass.spindle servo-thread
setp lowpass.spindle.gain 0.06

I have read the lowpass man page, but I have to admit that I find sentences like this rather humbling:

The digital filter implemented is equivalent to a unity-gain continuous-time single-pole low-pass filter that is preceded by a zero-order-hold and sampled at a fixed period.

I have a rough idea what most of the phrases in it mean, but somehow I'm having trouble turning that into code!

Thanks again for all your help.

Patrick

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

More
29 Sep 2018 19:59 #118193 by Grotius
Replied by Grotius on topic Spindle rotation sensor
Hi Patrick,

You have a accuracy about 10% on your spindle rpm's with the input of a encoder.
Are you using Mesa?

What kind of photophotonic encoder are your using?

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

More
29 Sep 2018 20:00 #118194 by andypugh
Replied by andypugh on topic Spindle rotation sensor
Just make the gain smaller and smaller until the reading is the compromise between stability and responsiveness.

I think that 0.001 will give a 1s time constant.

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

More
29 Sep 2018 20:37 #118196 by pferrick
Replied by pferrick on topic Spindle rotation sensor
Thank you both for the quick responses.

I tried a gain of 0.001, and it still jumps up and down about 500 RPM every second.

To answer the first question, I am using a 7i76, but not its encoder input. Instead I have the output of the spindle rotation sensor wired into a GPIO, and then I have that "HALwired" to an encoder component, set to counter mode. Maybe I should run the signal from the spindle into the 7i76 encoder input? Should I expect that to perform differently? And if I do, what signal is the Mesa encoder output called?

Whew...!

Patrick

ps - HALwired instead of HARDwired...! For some reason this really cracks me up. No doubt I've been banging my head on this for too long and I should probably give it a rest.

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

More
29 Sep 2018 20:39 #118197 by pferrick
Replied by pferrick on topic Spindle rotation sensor
I don't know what is physically inside my spindle, but whatever it is it generates a logic TRUE twice per revolution. My guess is a disk with a hole in it and an optical sensor.

Patrick

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

More
01 Oct 2018 15:03 #118291 by andypugh
Replied by andypugh on topic Spindle rotation sensor
What does the signal look like in Halscope? Is it possibly asymmetrical?

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

More
06 Oct 2018 16:29 #118495 by pferrick
Replied by pferrick on topic Spindle rotation sensor
That's a good question. I'll check and get back to you.

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

Time to create page: 0.069 seconds
Powered by Kunena Forum