Variable pitch belt driven spindle

More
07 Apr 2020 13:03 #163057 by cmorley
I would have assumed it already had limits switches. If it does i certainly would start with that.
Detection of the mechanical speed position is useful if you want to be able to adjust mechanical and VFD at the same time for wider range/more power or faster speed changes.

But if adding analog position is easier, then that certainly gives you more info to use.

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

More
08 Apr 2020 02:43 #163151 by OT-CNC
I think the vari drives are great for manual machines. I have a series 1 and if I had to do it over gain, I probably would ditch the vari discs and replace them with a timing belt drive and just use a vfd for rpm change. I had a terrible time re-machining and balancing them after a bushing rebuild. I'm not sure on your application but over driving them probably isn't a good idea.
I added an encoder to my machine and it gives me the rpm readout but haven't added the vfd yet. How are you planning on getting an index signal? Are you planning on rigid tapping? I wonder if there is better setup to fit an encoder on your type of BP then on the standard heads. Also, keep in mind that the vari disks need to be spinning before changing the rpm dial which may need some delay component added.

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

More
11 Apr 2020 18:31 - 11 Apr 2020 18:35 #163642 by fungus
I've been tinkering and have a couple things set up.

cmorely, you would think that it would have _some_ means of at least open-loop speed detection (reading the position of the belt discs, etc), but it has nothing. The original operator panel has pretty well knackered, but looked like it had buttons for raising/lowering RPM. Apparently this was an operator adjustment. There's not even a place to mount a tachometer, so apparently it would be by reading the sight disc at the front.

I roughly set up a 3-position optical gate for detecting the range, kind of looks like a flux capacitor.
The thought right now is to set 3 ranges in my post processor (in Fusion 360, I did a similar thing for manual gear changes in my Nardini Fast Trace lathe). It will send a M101 P1, 2 or 3 to request one of those three ranges.
I've done some preliminary bash scripting, but I still need to write in something to ensure the spindle is on. I'm using serial commands for the VFD, so it would be great to have the capability to issue a serial command for 60Hz during this ratio change...
#! /bin/bash

#example usage: M101 P1 (changes variable pitch belt to ratio A)
#uses argument P

#parport.0.pin-13-in is input for range A
#parport.0.pin-12-in is input for range B
#parport.0.pin-11-in is input for range C
#parport.0.pin-5-out is the valve to make RPM lower
#parport.0.pin-2-out is the valve to make RPM higher


range_request = $1

case $range_request in
	#change to ratio 1
	#while the input for ratio 1 is not true, move RPM down until the input is true
	1)
		while ! [halcmd getp parport.0.pin-13-in]; do
			if [halcmd getp parport.0.pin-11-in] || [halcmd getp parport.0.pin-12-in]
			then
				halcmd setp parport.0.pin-5-out True
			fi
		done
		#once complete, set both airmotor valves to off
		halcmd setp parport.0.pin-2-out False
		halcmd setp parport.0.pin-5-out False
		;;
	#change to ratio 2
	2)
		while ! [halcmd getp parport.0.pin-12-in]; do
			if [halcmd getp parport.0.pin-13-in]
			then
				halcmd setp parport.0.pin-2-out True
			elif [halcmd getp parport.0.pin-11-in]
			then
				halcmd setp parport.0.pin-5-out True
			fi
		done

		halcmd setp parport.0.pin-2-out False
		halcmd setp parport.0.pin-5-out False
		;;

	3)
		while ! [halcmd getp parport.0.pin-11-in]; do
			if [halcmd getp parport.0.pin-13-in] || [halcmd getp parport.0.pin-12-in]
			then
				halcmd setp parport.0.pin-2-out True
			fi
		done
		halcmd setp parport.0.pin-2-out False
		halcmd setp parport.0.pin-5-out False
		;;
	*)
		halcmd setp parport.0.pin-2-out False
		halcmd setp parport.0.pin-5-out False
		;;
esac
exit 0
Attachments:
Last edit: 11 Apr 2020 18:35 by fungus.

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

More
11 Apr 2020 19:41 #163647 by cmorley
I was thinking it has some way to detect when its at either end of the limit - something that overrides the manual buttons.

I think I would make a realtime component that detects spindle on and when it's on it adjust the belt to the requested range.

bit Input: spindle on, range 0, range 1, range 2
bit outputs: speed up, speed down
s32 input: range request

Pretty close to what you have as a script but it monitors all the time.
then with your M101 you set the range request pin.

In this way it doesn't matter where the M101 is in the program, when the spindle starts the component adjusts.

Might be better to use spindle speed feedback rather then spindle on, so you know the spindle is actually turning maybe even a minimum speed.

I bet this is gonna work great!

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

More
11 Apr 2020 19:43 #163648 by fungus
I'm using the hy_vfd component. Within my custom.hal, I have scaled the spindle:
setp scale.0.gain 0.92
Which worked for about the 1000RPM position on the visual RPM wheel.

Maybe I could write to this in those switch cases to set the correct scale for each one?

Also, as far as getting the scaled speed command into the VFD:
net scaled-spindle scale.0.out => vfd.speed-command
Would it be a violation to just call
vfd.speed-command <xx>
with a constant to start the spindle in each adjustment, then
vfd.speed-command 0.0
afterward to stop the spindle? As for direction, I would assume it would use the last commanded spindle direction, which could be handy to preserve (rather than changing directions).

New (preliminary) code:
#! /bin/bash

#example usage: M101 P1 (changes variable pitch belt to ratio A)
#uses argument P

#parport.0.pin-13-in is input for range A
#parport.0.pin-12-in is input for range B
#parport.0.pin-11-in is input for range C
#parport.0.pin-5-out is the valve to make RPM lower
#parport.0.pin-2-out is the valve to make RPM higher


range_request = $1

case $range_request in
	#change to ratio 1
	#while the input for ratio 1 is not true, move RPM down until the input is true
	1)
		while ! [halcmd getp parport.0.pin-13-in]; do
			if [halcmd getp parport.0.pin-11-in] || [halcmd getp parport.0.pin-12-in]
			then
				#start the spindle, unscaled
				vfd.speed-command 60
				halcmd setp parport.0.pin-5-out True
			fi
		done

		#once complete, stop the spindle and set both airmotor valves to off
		vfd.speed-command 0.0
		halcmd setp parport.0.pin-2-out False
		halcmd setp parport.0.pin-5-out False
		#set the correct gain for this range
		setp scale.0.gain 0.33
		;;
	#change to ratio 2
	2)
		while ! [halcmd getp parport.0.pin-12-in]; do
			if [halcmd getp parport.0.pin-13-in]
			then
				vfd.speed-command 60
				halcmd setp parport.0.pin-2-out True
			elif [halcmd getp parport.0.pin-11-in]
			then
				vfd.speed-command 60
				halcmd setp parport.0.pin-5-out True
			fi
		done
		vfd.speed-command 0.0
		halcmd setp parport.0.pin-2-out False
		halcmd setp parport.0.pin-5-out False
		setp scale.0.gain 0.66
		;;

	3)
		while ! [halcmd getp parport.0.pin-11-in]; do
			if [halcmd getp parport.0.pin-13-in] || [halcmd getp parport.0.pin-12-in]
			then
				vfd.speed-command 60
				halcmd setp parport.0.pin-2-out True
			fi
		done
		vfd.speed-command 0.0
		halcmd setp parport.0.pin-2-out False
		halcmd setp parport.0.pin-5-out False
		setp scale.0.gain 0.99
		;;
	*)
		halcmd setp parport.0.pin-2-out False
		halcmd setp parport.0.pin-5-out False
		;;
esac
exit 0

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

More
11 Apr 2020 20:07 #163651 by fungus
Lordy. I need to learn how to build realtime components, but you're making my hands sweat. Hahaha. Currently looking to see what would be involved in this.

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

More
11 Apr 2020 22:21 #163668 by fungus
I looked into creating a realtime component, and I like your reasoning behind it. I think it's just a bit too much while my machine's down though. I would like to revisit it at a later time if at all possible (also placing it on github for others to use).

I tried a couple different flavors of this (one with the pins directly using getp/setp, the other with signals using gets/sets, both with some address tweaks) but I get nothing out of either. No errors, no spindle movement, nothing.

Am I doing something obviously wrong? (I'm a bad programmer!)
#! /bin/bash

#example usage: M101 P1 (changes variable pitch belt to ratio A)
#uses argument P

#parport.0.pin-13-in is input for range A
#parport.0.pin-12-in is input for range B
#parport.0.pin-11-in is input for range C
#parport.0.pin-5-out is the valve to make RPM lower
#parport.0.pin-2-out is the valve to make RPM higher


range_request = $1

case $range_request in
	#change to ratio 1
	#while the input for ratio 1 is not true, move RPM down until the input is true
	1)
		while ! [halcmd getp parport.0.pin-13-in]; do
			if [halcmd getp parport.0.pin-11-in] || [halcmd getp parport.0.pin-12-in]
			then
				#start the spindle, unscaled
				vfd.speed-command 60
				halcmd setp parport.0.pin-5-out True
			fi
		done

		#once complete, stop the spindle and set both airmotor valves to off
		vfd.speed-command 0.0
		halcmd setp parport.0.pin-2-out False
		halcmd setp parport.0.pin-5-out False
		#set the correct gain for this range
		setp scale.0.gain 0.33
		;;
	#change to ratio 2
	2)
		while ! [halcmd getp parport.0.pin-12-in]; do
			if [halcmd getp parport.0.pin-13-in]
			then
				vfd.speed-command 60
				halcmd setp parport.0.pin-2-out True
			elif [halcmd getp parport.0.pin-11-in]
			then
				vfd.speed-command 60
				halcmd setp parport.0.pin-5-out True
			fi
		done
		vfd.speed-command 0.0
		halcmd setp parport.0.pin-2-out False
		halcmd setp parport.0.pin-5-out False
		setp scale.0.gain 0.66
		;;

	3)
		while ! [halcmd getp parport.0.pin-11-in]; do
			if [halcmd getp parport.0.pin-13-in] || [halcmd getp parport.0.pin-12-in]
			then
				vfd.speed-command 60
				halcmd setp parport.0.pin-2-out True
			fi
		done
		vfd.speed-command 0.0
		halcmd setp parport.0.pin-2-out False
		halcmd setp parport.0.pin-5-out False
		setp scale.0.gain 0.99
		;;
	*)
		halcmd setp parport.0.pin-2-out False
		halcmd setp parport.0.pin-5-out False
		;;
esac
exit 0

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

More
11 Apr 2020 23:17 #163674 by cmorley
add this :

halcmd show pin

then run linuxcnc from a terminal, if it prints all the HAL pins to the terminal then you know its getting run

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

More
11 Apr 2020 23:17 #163675 by cmorley
make sure the file is executable too

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

More
12 Apr 2020 00:03 #163677 by fungus
I added
halcmd show pin
halcmd show sig
into the M1xx, but I saw no print of the pins or signals in terminal.

It's definitely executable, and within the search path (it will error out if not executable, and I have it in the NC file folder).

I do have a "Run" LED on the front panel I made, which blinks while in automatic mode. It cycles once when I issue the "M1xx Px" command, so it's acting like it's just shooting through without hitting any loops. I'm going to try some echos.

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

Time to create page: 0.151 seconds
Powered by Kunena Forum