[SOLVED] Adjustable timed output flasher

More
04 Jan 2022 01:31 #230709 by spumco
I'd like to set up an air blast (not continuous mist) to pulse on/off.  I can use a siggen to do this, but I'd also like to be able to adjust the on and off times independently from a hardware button/knob.  I set something up like this on a friends commercial VMC with stand-alone timer relays and it's been a huge hit clearing deep pockets while running unattended.

I can think of a few ways to do this in LCNC, not sure what the best/easiest is:
  • Multi-click
    • Single momentary button, press once for cycle 1, twice for cycle 2, etc.
    • Cycles are connected to multiple siggens or hal timer somehow
  • Analog pots
    • Pot1 is ON, pot2 is OFF
    • Connect analog value to some sort of siggen and scale?
  • Encoder knobs
    • same as with pots, but counts = time somehow

And is this better handled through hal or Classic Ladder?

Anyone want to take a stab at pointing me in the right direction?

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

More
04 Jan 2022 04:26 #230714 by tommylight
Software stepgen in velocity mode, VCP panel with + and - for speed, any output even slow side power outputs on Mesa should do just fine.
Or software PWM, same thing but can also do duty cycle.
The following user(s) said Thank You: spumco

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

More
04 Jan 2022 06:19 #230723 by spumco
That looks pretty good Tommy.

I can see how it could be set up to change the on/off cycle frequency by changing the velocity up and down.

But not sure how I could adjust the on time independently from the off time.  If I connect the step length and space somehow to user-adjustable inputs, then I'd need a third input to change the velocity command?  Or leave the velocity command pre-set in hal (setp) and just adjust the step length and space, suitably scaled?

And trigger on/off with a toggle connected to stepgen.N.enable?

-Ralph

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

More
04 Jan 2022 08:21 #230730 by tommylight
linuxcnc.org/docs/2.8/html/man/man9/siggen.9.html
Forgot about the above, siggen can also be used.
PWM can have frequency and the on/off time (duty cycle) adjustable, i think from 1 to 99%.

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

More
04 Jan 2022 14:07 #230764 by chris@cnc
I wrote a small hal module to switch on/off my mist collector. At the moment you have 4 input value.
in0=1 -> output 1
in1+in2=1 -> output 1
in2+in3=1 -> output on = timer 1, off = timer 2
you can change timer on / off with setp pin command. 
Its easy written you can adjust to your purpose and how to compile and load in hal is written in file header comment.
Attachments:
The following user(s) said Thank You: spumco

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

More
05 Jan 2022 06:02 #230831 by spumco
I've been testing both pwmgen and stepgen all evening and have run in to a couple problems.
  • pwmgen.N.pwm-freq doesn't appear to be able to accept a value lower than 0.5.  This results in a cycle frequency of one second.  I can set the value and scale to get a blinking output, but I can't seem to get the cycle longer.  Every time I use halshow to input 0.1 (for a 10-second cycle) in pwmgen.0.pwm-freq it reverts to 0.5 when I enable the output.
  • stepgen also (sort-of) works, but because I can't adjust the steplen and stepspace parameters by connecting a pin (analog value) to them I can't change them on the fly.

I don't really want to go down the VCP rabbit hole - was hoping to get this working with meat-space pots.  And I'd like to get a range of about 0.5-1.5 seconds ON time and 1 to 30 seconds OFF time.

Is it possible to use hal pins/signals to adjust hal parameters on the fly? (if so, I can use stepgen)
Is there a way to get the pwm frequency slower than 1hz?

chris@cnc - is that a non-standard hal component you attached?  I've never done anything like that - still a newbie at this.

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

More
05 Jan 2022 06:23 #230836 by cmorley
HAL parameters can not be connected to so can not be changed by other components.

Classicladder is pretty good at this stuff, if you like ladder programming.
The following user(s) said Thank You: spumco

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

More
05 Jan 2022 14:18 - 05 Jan 2022 14:20 #230866 by spumco
I would say that like is not the appropriate adjective for ladder programming, but I'll have a go at it.  I spent some time last night reviewing Ladder and watching some of the great Feral Engineer vids on CL.

The basic function I'm after seems pretty simple in concept, but I don't know how to pass/change values from hardware to a Ladder variable.  So far, all I can think of is having multiple values in Ladder that I can chose from with a change in input... but not change the values themselves.

If I cant change timer or counter values on the fly, I might was well do it in HAL with a multi-click button and a few pre-set siggens.  No on-the-fly adjustment possible - just 3 or 4 different on/off cycles to choose from.

See picture of timer relay scheme.  I want t1 and t2 independently adjustable with a pot or encoder.

 
Attachments:
Last edit: 05 Jan 2022 14:20 by spumco.

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

More
05 Jan 2022 16:15 - 05 Jan 2022 16:33 #230874 by PCW
You can do this with the time delay component:
loadrt timedelay
loadrt not
addf timedelay.0 servo-thread
addf not.0 servo-thread


net timeloop1 timedelay.0.out not.0.in
net timeloop2 timedelay.0.in not.0.out

And then net timedelay.0.on-delay and timedelay.0.off-delay to
pins from encoders etc that set the appropriate times
Last edit: 05 Jan 2022 16:33 by PCW.
The following user(s) said Thank You: Ritterchen, spumco

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

More
05 Jan 2022 16:58 #230878 by chris@cnc


    • chris@cnc - is that a non-standard hal component you attached?  I've never done anything like that - still a newbie at this.


I'm a newbie too, and it's not a standard. For me, it was easier than rewriting my config with the ladder. At the moment, timer can only set with the setp command. Maybe someone can show me how to make a save float input. So could it be possible to use encoder for timer adjust. It's on my to-do list, but behind number 500.

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

Time to create page: 0.235 seconds
Powered by Kunena Forum