how to make M7 (mist on) generate step pulses

More
23 Nov 2021 11:21 #227394 by mikeT
I have a stepper motor driven peristaltic pump feeding fluid to my lubrication mister system. I would like to configure my system to generate step pulses to drive this stepper/pump. Can this be done somehow with the M7 (mist on) command?

I have been testing the stepper/peristaltic pump by connecting it to the A axis and giving a G01 A999 F2 command. Unfortunately this only works for the duration of the command. I would like the stepper/ peristaltic pump to run continuously, idealy under control of the M7 command.

Is it possible to configure LinuxxCNC to do this? Or do I need an external step pulse generator?

Thank you for your help and advice

Mike
 

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

More
23 Nov 2021 12:30 #227399 by andypugh
Yes. Something like this (you will have to weave it into your existing HAL)
loadrt stepgen ctrl_type=p,p,p,v
addf stepgen.make-pulses base-thread
addf stepgen.capture-position servo-thread
addf stepgen.update-freq servo-thread
setp stepgen.3.velocity-command 100
net pump-on iocontrol.0.coolant-mist => stepgen.3.enable

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

More
23 Nov 2021 15:12 - 23 Nov 2021 15:14 #227410 by mikeT
Thanks for the fast reply Andy, Things are certainly looking promising.

I am not too comfortable with this software. Hardware is better for me.

I think you are using something called stepgen.3 to generate step pulses when coolant-mist is enabled. Is that correct?

So, is coolant-mist enabled when M7 command is issued?

Do the pump step pulses appear at the pin assigned to Coolant mist (pin 17) on parralell port 1?

Does velocity- command 100 set the pulse rate?

Sorry to ask you to spoon feed me, but I will soon get the hang of it.

Regards

Mike
Last edit: 23 Nov 2021 15:14 by mikeT.

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

More
23 Nov 2021 16:14 #227419 by andypugh

I think you are using something called stepgen.3 to generate step pulses when coolant-mist is enabled. Is that correct?


Yes. You probably already have stepgen.0, stepgen.1 and stepgen.2 used in your HAL file.

So, is coolant-mist enabled when M7 command is issued?


Yes, the HAL pin iocontrol.0.coolant-mist is directly controlled by the M7 command.
You can check this with the hal-meter (look in the "machine" menu of the Axis GUI, if that is what you are using. It is on the setup tab of Gmoccapy. I don't know where it is on other GUIs)

Do the pump step pulses appear at the pin assigned to Coolant mist (pin 17) on parralell port 1?


As listed above the step pulses do not actually go anywhere at all. You would need to have something like
net pump-pulse stepgen.3.step parport.1.pin-00-out

Does velocity- command 100 set the pulse rate?

Yes. With the default scaling of the stepgen it is in pulses per second.
The following user(s) said Thank You: mikeT

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

More
23 Nov 2021 17:30 #227423 by mikeT
Thank you Andy for your generous help and patience

Each line makes sense on it's own. but you must be very knowlegable to know what to string together.

A couple more dumb questions, if I may.

The 7 lines of code you provided must be 'woven into' my existing HAL file. Is there any particular place where they must reside in the HAL file?

Am I correct in thinking the Coolant Mist output pin on the parallel port should be wired to the Step Input pin on the stepper driver brick? and the Direction pin hard wired with a pull up/down resistor as necessary?

Then all I need is the courage to jump into the HAL files.

Thank again

Mike

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

More
23 Nov 2021 18:10 #227425 by andypugh

The 7 lines of code you provided must be 'woven into' my existing HAL file. Is there any particular place where they must reside in the HAL file?


Many of them are likely to already exist in your HAL file, or will be slight modifications of existing lines.
For example to add the extra stepgen it is probably just a case of adding a ",v" to the end of an existing "loadrt" command, but it might involve adding the whole "ctrl_type=p,p,p,v" depending on how your current HAL is formatted.

Am I correct in thinking the Coolant Mist output pin on the parallel port should be wired to the Step Input pin on the stepper driver brick? and the Direction pin hard wired with a pull up/down resistor as necessary?


If you already have the iocontrol.0.coolant-mist pin netted to a parallel port pin, then yes.

Note that the format of a "net" command is
net somename somepin
or
net somename somepin anotherpin yetanotherpin

where the net names ("somename") are labels that you can freely choose for your own information, but the pin names must actually exist and be created by loaded HAL components.

With LinuxCNC loaded you can get a reference list of all HAL pins with a command line command "halcmd show pin"

You can try leaving the dir pin on the driver unconnected. If the motor turns the wrong way then just reverse two of the motor wires (eg A+ and A-). (but de-power the driver before disconnecting the motor, for the safety of the driver rather than your own safety)

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

More
24 Nov 2021 15:43 - 24 Nov 2021 15:45 #227503 by mikeT
Hello Andy

Making some progress, but uncomfortable with the code stuff.

I now have Coolant Mist netted to parport.0. pin 14 out and pin 14 switches Hi to Lo when I press the coolant mist button on the Axis screen....Progess

The following lines already exist in my HAL file

addf stepgen.make-pulses base-thread
addf stepgen.capture-position servo-thread
addf stepgen.update-freq servo-thread

My HAL file already has the follwing loadrt line:
loadrt stepgen step_ type = 0,0,0,0

So do I simply add the whole line?
loadrt stepgen ctrl_type=p,p,p,v

My Hal file already has the following net lines:
net coolant mist <= iocontrol.0.coolant mist
net coolant mist => parport.0. pin-14-0out

So do I simply add the whole line ?
net pump-pulse stepgen.3.step parport..0.pin-14-out

Sorry to be so painfull slow but they say it is better to ask than to guess

Thanks for your help

Mike
Last edit: 24 Nov 2021 15:45 by mikeT.

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

More
24 Nov 2021 16:14 #227508 by andypugh

addf stepgen.make-pulses base-thread
addf stepgen.capture-position servo-thread
addf stepgen.update-freq servo-thread


Nothing to do there


My HAL file already has the follwing loadrt line:
loadrt stepgen step_ type = 0,0,0,0

So do I simply add the whole line?
loadrt stepgen ctrl_type=p,p,p,v


No, append ctrl_type to the end. And it looks like you already have 4 stepgens so we will add another:
loadrt stepgen step_ type = 0,0,0,0,0 ctrl_type=p,p,p,p,v

My Hal file already has the following net lines:
net coolant mist <= iocontrol.0.coolant mist
net coolant mist => parport.0. pin-14-0out

So do I simply add the whole line ?
net pump-pulse stepgen.3.step parport..0.pin-14-out


Delete any existing lines that refer to coolant-mist or parport pin 14 and replace with the new ones.

Sorry to be so painfull slow but they say it is better to ask than to guess


It's hard to break anything with a stepper system and a bad HAL config. Compared to with physical wiring at least, or a servo system.
The following user(s) said Thank You: mikeT

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

More
24 Nov 2021 16:15 #227509 by andypugh
Oh, and because you already had 4 stepgens, you should be using stepgen.4 in all the new lines. (because we count from zero)

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

More
24 Nov 2021 16:23 #227510 by mikeT
Thank you once again Andy, you are a star.

It may be hard to break anything with a stepper system and a bad HAL config. but it's quite easy to stop it from working.

Thanks

Mike

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

Time to create page: 0.179 seconds
Powered by Kunena Forum