4 bit parallel ADC for spindle gear control

More
17 Oct 2016 12:26 #81718 by johnmc
Good day All
Has any one used a 4 bit parallel ADC to take the analogue signal 0 to 10v from the mesa board, and use the digital output to select required gear for example in a 16 speed gearbox .
Regards john

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

More
17 Oct 2016 13:30 #81724 by andypugh
I doubt anyone has tried this. And I am not sure it is a sensible thing to try. Why not use 4 output bits from HAL and use HAL logic to pick the required gear? That would also make it easy to not turn on the motor until the gear is selected.

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

More
18 Oct 2016 03:36 #81757 by johnmc
Good Day Andy
Thanks for the reply
The problem is how can I convert a spindle speed S into a 4 bit logic that will allow the correct gear ratio to be activated.
I thought the 0 to 10 volt spindle speed would be divided by the analogue to digital converter with a 4 bit signal , and with the truth table select the correct speed gear ratio clutches .
I have thought about this 16 speed problem for 4 years and without a solution within my limited ability.
At present I have started the conversion of a mazak lathe and have the axis homing on the encoder index.
The lathe conversion road looks fairly long ahead.
Best Regards john

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

More
18 Oct 2016 08:21 - 18 Oct 2016 08:39 #81762 by andypugh

The problem is how can I convert a spindle speed S into a 4 bit logic that will allow the correct gear ratio to be activated.
I thought the 0 to 10 volt spindle speed would be divided by the analogue to digital converter with a 4 bit signal , and with the truth table select the correct speed gear ratio clutches .


I don't think that there is much point taking the digital speed signal in HAL out to the real world as an analogue signal, then converting it back to digital for further processing.

Does the lathe have a VFD or does it run a fixed speed in each gear?

I have a vaguely similar situation with my CNC lathe, albeit I have a VFD and only two speed ranges selected by electromagnetic clutch.

(I was going to post documentation links, but it looks like the main LinuxCNC.org web site is down at the moment)
One way to do what you want, though not a very elegant one, would be to use the HAL "lincurve" component. You could set up Lincurve to output a number based on spindle speed command. The number would be a binary representation of the combination of clutches required.
The reason that this is inelegant is that the output of Linucurve is floating-point, and converting to an integer format to extract the separate clutch signals might fall foul of rounding errors. Also it is not aware of spindle state, and will try to change gear any time the spindle speed command changes.

A better solution is probably a custom HAL component like the one I have for my lathe. Exactly what this would look like depends on how you want to control the spindle, whether gear-change with the spindle under load is allowed, whether gear change with the spindle spinning is allowed, etc.

The component will look like this (written in English rather than C)

make a set of params for the spindle speed ranges
make a set of params to define the clutch positions for each speed
;;
If the spindle is stopped, don't do anything
If the spindle speed command is less than threshold 1
Set the clutches for the lowest speed
Go into a waiting-for-stop state
If the spindle speed command is less than the second threshold
Set the clutches for the lowest speed
Go into a waiting-for-stop state
...
(Spindle Running, waiting for stop)
If the spindle speed < safe-to-change-gear speed
Go back to the top

The implementation on my lathe has a manual over-ride switch for situations where the spindle speed is set by the GUI. I only needed a 3-position switch for this (high, low, auto), your situation might be more interesting.
Last edit: 18 Oct 2016 08:39 by andypugh.

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

More
18 Oct 2016 11:06 #81770 by johnmc
Good day Andy
Thanks for your considered reply.
Lathe has 16 fixed speeds with the clutches at present under 4 bit logic control, of the electro magnetic clutches,
gears are changed when the is no load.
Where is the information that will allow me to make use of a HAL component , to make to 16 discrete S words.
I wrote the plc for the old ANCA controller 20 years ago, with anca's own plc .
At 75 years young my reasoning is not that sharp.
If all else fails, a manual 16 position decoding switch may be the answer.
Thanks again
Cheers john

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

More
18 Oct 2016 12:07 #81775 by andypugh
There are docs on the main LinuxCNC site on both writing custom HAL components and on Classic Ladder, the built-in PLC that LinuxCNC has.

If you are familiar with PLC programming then CL might be your preferred solution.

Unfortunately I can't get you links at the moment as the host appears to be down.
The following user(s) said Thank You: johnmc

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

More
18 Oct 2016 14:23 #81785 by skunkworks
I wrote a comp for our HMC - 4 bit binary 16 speed gear box. (it was my first comp so it is pretty scary ;) )

(it was quite a few years ago)

electronicsam.com/images/KandT/conversio...fig/gearshift16.comp

The following user(s) said Thank You: johnmc

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

More
18 Oct 2016 14:45 #81790 by andypugh

I wrote a comp for our HMC - 4 bit binary 16 speed gear box. (it was my first comp so it is pretty scary ;) )


Aye, no offence, like, but that's pretty messy code.

I will try to knock-up a generic version this evening.

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

More
18 Oct 2016 14:51 #81793 by skunkworks
I agree :) - no offence taken.

I have not touched it since I got it working - it has been flawless.. (surprised the heck out of me..)

sam

I wrote a comp for our HMC - 4 bit binary 16 speed gear box. (it was my first comp so it is pretty scary ;) )


Aye, no offence, like, but that's pretty messy code.

I will try to knock-up a generic version this evening.

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

More
19 Oct 2016 22:25 #81873 by johnmc
Good day Sam
Thanks for your 16 speed gearbox solution.
This method gives me much food for thought ,when using your KT mill do you program the G code with a set S speed
and the code automatically selects the nearest gear ratio.
Best Regards john

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

Time to create page: 0.084 seconds
Powered by Kunena Forum