Realtime PWM mode added.

Discussions and file drops for Auggie
Post Reply
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4591
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Realtime PWM mode added.

Post by ArtF »

Hi All:

  Well, I contacted the Pokeys developers this morning and asked them if we could discuss adding PWM realtime
control as it would apply to a laser.  I hate to ask for such things , I know how it can screw up development
schedules.. so I told them it was no rush job. After a few minutes of discussion, Matevz, their programmer told me he'd look into it. This afternoon a new release was outand Ive just finished testing it.  Works great, my thx to the guys in the lab, :).

  So, that was the last piece required for everything software wise, shoudlnt be long hardware wise and I should be able to start
engraving tests.. I posted the first scripting lesson today, Ill add one periodically as I can..

  I also found the source of my network errors, a program named genie.exe loaded by netgear routers.. killed it and
all runs well. I guess everything is running on track. :)

The new mode is added already to the motion libraries and means one can control a lasers pwm power signal
each ms with a new power. This means granularity of dot will be a function of engraving speed. As an example,
my X axis is 400steps per mm, so at 3000mm/min ( 50 per second), thats approx 20 steps taken for each dot
of settable power or 20 dots per mm or 500 DPI with the power being variable on each dot...
if Ive calced that right.. That will also be limited by PWM period and the laser itself of course, but it was a
key requirement for this to work.. thought Id mention it. :)


Art





GlennD
Old Timer
Posts: 80
Joined: Tue Oct 18, 2011 4:19 pm

Re: Realtime PWM mode added.

Post by GlennD »

Yea i do that to some of the plants that I write programs for.
Yep look at this cool feature I have working.
Then don't share...
  ;) :) :D ;D

I understand what you are saying the good people never want to bother anyone.
But
Of course Pokeys would work on a suggestion by you. 
I certainly would just cause all of the fun you provide the world.

Good to hear you have your network issue taken care of.

Glenn
Joakim
Old Timer
Posts: 56
Joined: Mon Sep 17, 2012 5:48 am

Re: Realtime PWM mode added.

Post by Joakim »

First - Auggie is an awesome program and has been on my wish list for a long time. Just the program for all us, who like to build experimental laser/CNC/3D machines (and hate the limitations on GCode  ;)). Thank you Art!

Just to understand the new mode: Is the laser output power a function of time or speed?
Speed dependent mode could make life a lot easier, as the power output would only depend on how far we have traveled since last laser pulse => dept of cut would be independent on the speed.

On the K40 I get these annoying "holes" at vector starts when doing vector graphics and I have to go very fast to cut thin materials like paper...  :(

- Joakim

(I have a K40 Chinese laser ready to be rebuild for Auggie (and PoKeys56)  :) )
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4591
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: Realtime PWM mode added.

Post by ArtF »

Hi Joakim:

I think perhaps Ill explain the full theory of what Im doing here.. I think Ive hit that spot.:)
Forgive the length of this one...

  The PWM control is set every ms ( while in motion), here is the way it works..

Normally, without considering power, motors are moved in 1ms way-points
from the jerk planners. There are two of them one for each set of 4 axis.  That's
8 bytes of data for each ms, the byte varies from 0 ( no steps or system is motionless)
to 125 for that ms as that makes 125Khz the maximum speed. These control
speed bytes are constantly sent by Auggie to the pokeys, no matter what, as long as
your not in E stop mode , speed bytes are sent continuously.

  What Pokeys has done for me, is change the meaning of the byte for
any axis I declare to a number from 0-100 as duty cycle for the PWM. This means
you trade any of the extra 4 axis ( 5,6,7,or 8) for pwm control of the laser.
You can trade another ( or 2) for use as an index-able conveyors, spindles..whatever.. 

  What that means in implementation, is that I will control that byte to
set power based on a few things. Speed, acceleration, and power requested,
I will make averaging algorithms to spread the power as a "Joules per mm"
setting rather than joules per second.

    This has a very nice feature, it means if speed is zero, power is as well,
so laser power is ensured to be off when not moving, and power goes
higher the faster you move. Auggie will calculate ( with user assistance
by selection of options, ) how much power per mm, and what kind
of correction function to apply for acceleration periods. Lasers are
very often nonlinear in their output, so my initial thought is to add
visual calibrations, so a matrix of small engravings on a test board
to quantify that lasers linearity ( or non-linearity) visually by selection
of "which of the following 10 is smoothest", or "which of the following
has the best grey scale " or ..whatever.. I suspect between those
of us who join in we can come up with what are basically test patterns
from which you will selected the items that represent your systems ability to cope
with the various nonlinearities in its operation, you will then apply
correction filters to that profile to make that laser operate as closely as
it can to other lasers running the same program. My current thought
is to make a high order polynomial to represent your particular lasers
response function as a result of several multiple answer questions based
on small quick repetitive cuts with different curves till an algorithm
can compute the best matching intersection of test pattern responce.
 
  Because of the (no-motion = no laser) property, ( I loved this
in Darwin's Laser mode), when you turn on the laser with
the "Laser on " button, nothing happens. If you jog or do any feedrate
move while in that mode, the laser runs only for that motion, and the
power is adjusted during accel and decel to attempt to make even a
slowly accelerated line as linear as possible in power.

  Now, its not possible to do this with perfection, I admit this up front,
but until we actually make calibration and correction tables and bezier
curves of power profiles to match up our systems, we just wont know
how close we can get. But as far as I know this has never been done in
the way I envision it, so...I gotta try. :)

  Perusing the web for similar control of lasers under Windows looks
to me to be very expensive, in fact it looks similar to the day when I
did research on motion controllers when I built my first router and
decided I had to make a program that did CNC as I was way too cheap
to pay for the current software. We may never match the capabilities of
high end laser controllers, but I know from personal experience, if we
can attract a core base of users that hits that critical number( which is
always unknown beforehand), your knowledge, and theirs, combined
with a willingness to experiment, may invent something that is
useful, functional, and a further evolution of the hobbyist experience.

  One last word. Auggie is short for "The Augmented Controller" and Ive had
trouble till now explaining what the augmentation is about. It was the reason
I started down this road, but ironically was the thing I couldn't quite bring into
focus till near the end, and haven't even started the code for it, though its written
already in my head. The fact I COULDNT control a laser ms by ms in any other
controller is what drove this. Darwin could, nothing else could. Its important, in
industry to have safety and interlocks and keep the user ( generally considered
the weakest link of a cnc system) away from low level operations. Auggie
is trying to put the user into the hardware..at a very low level. In this it differs
from all other controllers. Its augmention mode is meant to load data, any data,
and apply it in the way the user wants. Since the format of the data is unknown to
me ( the guy writing the software , lol ), I have to accept it may be images, or
spreadsheet data, or a 3d model or just probe points from a probing operation,
and give you tools to tell the various algorithms how YOU want it interpreted. Ill
be giving you the equivalent of shader threads which in graphics run in parallel
on all pixels. So I want to write script frames where you decide on the power output
for a given instant based on your data. As a very rough example of what Im
envisioning as "Augmentation" are scripts similar to this, which you will modify to suit..

  global MyBlueBurns = function( x, y)
{
      dataword = AugmenterData( AugData1 ); //returns data word representing current tool
                                                                  //position in matrix grid of loaded data( image, spreadsheet whatever..)
    OutPower = AugmentScale( dataword & 0xff ); //this is a photo, get just the blue word..scale the power to it
    return OutPower;
}

  Such a script would be "called" for every single ms of motion and feed the power word the data
representing that moment in time, how you deal with it will be up to you. The above would
laser engrave only based on the blue words in the image. Obviously vastly more complex ways
of interpreting data could be done. Perhaps with focus,youd  turn on a second augmentor script
and you could do

global MyFocus = function( x, y)
{
    dataword = AugmenterData( AugData2 ); //returns data word representing current postion on 3d model
    NewFocus =  dataword.z();  //this is a 3d model , use the Z to move the focus.
    return NewFocus;
}

    I think one should be able to run multiple augmentions, each affecting one or more realtime operations
during motions. To activate such things.. youd call then in Gcode as Auggie understands special Gcode
commands. So it would look similar to

g1X10Y10 //ready for spiral raster
{SetAugment( 1, "my3dmodel.stl" , MyFocus ); }
{SetAugment( 2, "PhotoOfMe.jpg" , MyPower ); }
{SetAugmentScale( 8, 10 )}
...
Gcode program of a 2d spiral raster..
...

      So your scripts of control become the augmentations for the run.
That, in a nutshell is what I envision the end system to look like, though
such things tend to change over time... you just never know...


Sorry for the long ramble, but I's early, Im fresh, and I figured it was time
to do a more full explanation.. besides, Im a little burned, Im taking most of the day
off. :)


Art


   
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4591
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: Realtime PWM mode added.

Post by ArtF »

Joakim:

  I just noticed you have a Pokeys 56, and Im sorry to report that while PWM is possible, its
only possible on the 57 upwards. I dont think its just on the 57cnc, but Im pretty sure its
57 upwards. Auggie does work with a 56, but will likely be limited to a different mode called
"Fast Control" which is purely digital in nature. It will have the ability ( like machs plugin) to
control on or off during any ms, but not power. Power in such systems is dithering, so with a 56
youd have to use an augmentation to do a dithering pattern as it goes. Not that is isnt doable,
just a different technique without quite as much latitude.

  I should mention that only the 57CNC has the extra 4 axis for the extended controls, though
a 56 will be able to control a laser on its Z channel, just not with PWM variation.. It can
however, do constant on modes at PWM selectable power, just not realtime correction.

Art
 
Joakim
Old Timer
Posts: 56
Joined: Mon Sep 17, 2012 5:48 am

Re: Realtime PWM mode added.

Post by Joakim »

Art:

I also have a PoKeys57E (never can have too many of these great devices...).
When connecting to the device via PoKeys program it reports as Device type PoKeys56E firmware version 3.1.68. I have the option to upgrade the firmware to PoKeys57 series device - this can not be undone.

Not sure if I should upgrade? Do I need the device to be PoKeys57 series to work with the new PWM?
(Maybe someone in the forum has tried this upgrade)

To be on the safe side I ordered one PoKeys57CNC today, just in case the PoKeys57E can't be used.

To the explanation of the PWM control:
No problem with the length - I like to get a good insight into the inner workings.  :) Much better to know than just to try and guess... Good posting  :)

About a year ago, I tried to implement "joules per mm" i PoKeys with PoBlocks PLC via logical blocks, but I came to the conclusion, that it was the wrong tool to make a good working solution. What I needed was to get inside the motion control and add laser power control to a digital output.
This is exactly what I read you have done with PWM control, great work!

I totally agree with your conclusions and vision for Auggie. After the patent for 3D printing technology expired there has been an explosion of new developments in that area and nearly everyone can afford to do 3D printing today. If everyone contribute with a little piece and all will benefit.

I understand that the primary four axis (X, Y, Z and A) are motion connected, but how are they related to the four Free Axis?
And are two of the Free Axis special PWM enabled or is PWM send to other digital output pins?
On K40 (and other lasers) two outputs are needed:

1) Laser tube power (mA) (could be manual)
2) Laser on/off pulses (motion controlled)

Will they be hooked up to two of the Free Axis?

Just a note - I see Auggie as one of the best attempts to get away from the low level GCode. Love the integrated scripting and the flexibility. Easy to learn if you have a background in other programming languages (C#, C++, JavaScript ...).
I won't miss the times I had to fire up the CAD/CAM program to do simple CNC cuttings, just because it was to difficult or time consuming to write the GCode by hand...

- Joakim
GlennD
Old Timer
Posts: 80
Joined: Tue Oct 18, 2011 4:19 pm

Re: Realtime PWM mode added.

Post by GlennD »

For the K40 I would think that the mA settings would be one of the PWM pins (22 was my current plan) since it normally doesn't change through out the cut.  Although I could see a potential to change it for different processes.
I would like to keep as many of the free axis open for other things that I haven't thought of yet.  :D

Even if you wanted a "manual" knob run the potentiometer through the 57cnc that way you could always set it through code as well.  Just my thought on it.


Glenn
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4591
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: Realtime PWM mode added.

Post by ArtF »

Hi:

>>I also have a PoKeys57E (never can have too many of these great devices.. .).
When connectin g to the device via PoKeys program it reports as Device type PoKeys56E firmware version 3.1.68. I have the option to upgrade the firmware to PoKeys57 series device - this can not be undone.

  Id upgrade it, I dont really see a downside.. does it say there is one?

>>Not sure if I should upgrade? Do I need the device to be PoKeys57 series to work with the new PWM?
(Maybe someone in the forum has tried this upgrade)

  I understand any 57 can do the new PWM mode, so updating it seems best I suspect..

>>To be on the safe side I ordered one PoKeys57C NC today, just in case the PoKeys57E can't be used.

  Good side of that is the extra 4 axis..

>>I understan d that the primary four axis (X, Y, Z and A) are motion connected, but how are they related to the four Free Axis?
>>And are two of the Free Axis special PWM enabled or is PWM send to other digital output pins?

    There are two trajectory planners, both tempest. But the first is always attached to the first 4 ( or 3) axis. The second planner
is special in that it can ignore any of the 4 axis and so can be a 1, 2, 3 or 4 axis planner. I will attempt to allow any combinations
on the free axis, so whatever you dont use for constant speed or PWM may be used for trajectory planning on the second planner.
Other than thay both planners are totally separate.

>>On K40 (and other lasers) two outputs are needed:

1) Laser tube power (mA) (could be manual)

>>  I think this is where you want PWM to control the power,

2) Laser on/off pulses (motion controlle d)

and this would be any digital pin that can be turned on during motion. I suspect the K40 may need
some special handling and I know limits will be there as my CO2 glass laser wont fire below  a
certain PWM power setting.. linearity may be bad as well, but we'll correct that as best we can and
see what happens, it will, at the very least..be interesting. I never discount the value of that. :)


>>Will they be hooked up to two of the Free Axis?

  Yes, I believe so. A lot will depend on how fast your laser can respond to the PWM for power..
thats an unknown till we attempt some tests, luckily Auggie seems to be attracting people like
yourself who can run more sophisticated testing ... While Auggie is for anyone at any level,
it will take a few of us used to toying about to make it all work... :)

Thx
Art
Joakim
Old Timer
Posts: 56
Joined: Mon Sep 17, 2012 5:48 am

Re: Realtime PWM mode added.

Post by Joakim »

Glenn:
You are right. The mA setting could be one of the PWM output. The only time I change this setting is between jobs or if a job has both vector graphics and cutting.
The 40W tube I have in my K40 has a usable range from 4 - 17mA and are not linear. The range from 17 - 20mA has very little effect on cutting but will wear the tube faster (red it on the net...).

Would be nice to program a function for the PWM output to have a control value from 0 to 100%.

- Joakim
Joakim
Old Timer
Posts: 56
Joined: Mon Sep 17, 2012 5:48 am

Re: Realtime PWM mode added.

Post by Joakim »

Art:

Just upgraded the firmware in the PoKeys57E, first to recovery mode and then to firmware 4.1.68.
Everything seems to be as before - Noticed that the backlash compensation is now enabled i motion control.

Viewed your YouTube video and got the explanation for the two sets of motion controlled axis (XYZA + 1234).
If I use two of the Free Axis for laser pulse and power there will still be two more axis for other uses.

A year ago, when I first experimented with pulse control, I found some tests on the K40 timing on the internet. As I recall the minimum pulse was about 1ms, optimal 2ms and above 3ms was more like constant on.
At 2ms the output power was twice the rated value of the tube (60-80W for a 40W tube) because some power build up in the ionized gas. This is just numbers from my memory, but pretty interesting to have that high power when pulsing the laser...  :)
If the pulse is too short the laser won't fire and too long it behaves like constant on.

My plan is to completely rewire the K40 with new end stops and replacing the flat ribbon cable (Y axis) - this will take some time before I am ready to do some tests. But will be fun to do...  :)

Is Auggie safe enough to connect to a real laser? I have only been playing around with Auggie without mechanics attached.

- Joakim
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4591
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: Realtime PWM mode added.

Post by ArtF »

J:

>>A year ago, when I first experimen ted with pulse control, I found some tests on the K40 timing on the internet. As I recall the minimum pulse was about 1ms, optimal 2ms and above 3ms was more like constant on.
At 2ms the output power was twice the rated value of the tube (60-80W for a 40W tube) because some power build up in the ionized gas. This is just numbers from my memory, but pretty interesti ng to have that high power when pulsing the laser...  Smiley
If the pulse is too short the laser won't fire and too long it behaves like constant on.

    The ionization effect is short, typically it wont do much for you unless you run very slow.. but you timing seems short to me, my RF
laser runs about 5Khz ( most can run to 20Khz, but I limit mine to 5. Tweaky would be the expert there, but I cant see why we cant hook
your MA meter to an analogue pin on a pokeys and read the current for an onscreen DRO, then play with timing to see what the real parameters are.. I suspect only testing will tell the truth on each tube. Im not sure if a power supply tickle will allow the speed Id think
you should get or not, but I suspect you can get faster than 1ms..

>>My plan is to completel y rewire the K40 with new end stops and replacing the flat ribbon cable (Y axis) - this will take some time before I am ready to do some tests. But will be fun to do...  Smiley
>>Is Auggie safe enough to connect to a real laser? I have only been playing around with Auggie without mechanics attached.


  Im waiting on a ballscrew , a din rail and a few small things before mine gets hooked up but it wont be long before
I hook mine up. Certainly you can run the mechanics, but as with all experimental programs take it slowly, test each motion
and such. I may beat you to it, but if I dont let us know how your motion seems..Ive only been testing with stepper, but
servo is what Ill use in the laser. It is also possible to turn on lasing, but Id rather wait to explain that as I get mine working
as I often tweak system internals when I find a problem,...and I find problems by using it..

    We dont yet have any scaling or calibration functions, Ill be writing those as I calibrate mine..

Art
Joakim
Old Timer
Posts: 56
Joined: Mon Sep 17, 2012 5:48 am

Re: Realtime PWM mode added.

Post by Joakim »

Some time has gone... and I am finally ready...  :D

The K40 is rewired, motors are running X and Y (Ethernet requires 0 in delay in my config).

Reading forum posts, seeing videos and playing with Auggie, I am still not sure, how to connect the fire pin on the laser power supply to PoKeys57CNC to get real time PWM. Is it the Step/Dir on axis 8 or some other PWM pin?
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4591
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: Realtime PWM mode added.

Post by ArtF »

Hi Joakim:

    YaNrNo is just hooking his up too, so we'll have more info shortly...

But as to what to do.. Turn on the laser Spindle Library, (Turn off any others..).

  You have to edit that library file by checking it out in the debugger and editing the PWM
number to use. Generally, youll use two signals depending on the laser power supply.

Most have "LaserOn" or "TTL" as the first, and PWM as the second. What you need to feed each depends on
the power supply. Some, simply leave the TTL float , ( which enables the power supply), and feed PWM into the
PWM input, this works fine. Others need to pull the TTL input high or low to enable the laser. I use relay #1 to
turn on my laser supply. You need to know what it takes turn on the TTL or LaserOn input. Wire up Relay1
to do that , and it should turn on or off with the "LaserOn" button on the main GUI beside spindle speed.

  The theory here is we enable the supply with that button, recoding the button script to turn on some
other relay or pin if required. Once on, the laser doesnt shoot because PWM will be at 1%
( or whatever PWM minimum is set to.). So long as the laser on button is active, the laser supply will be live.

  The PWM stays at PWMMin unless commanded, and it wont turn on without M3 being in effect.  The SetSpindleState
function in the laserSpindle library controls this from variables at the top.

global LaserAxis = p.GetInt("Axis",8);
global LaserMaxPower = 100;  //max power = 100%
global LaserPWMPeriod = p.GetFloat("Period",.0002); //for 5khz tickle 
global LaserPWMChannel = p.GetInt("Channel",4);

I wouldnt change LaserAxis, leave it 8 for now, I need to add some config changes to allow it to be changed,
but you may change the LaserPWMPeriod and LaserPWMPeriod to use whatever channel and period you like.
Its set for 5khz.. but if you need 20khz for a glass co2.. change it to look like this..

global LaserAxis = p.GetInt("Axis",8);
global LaserMaxPower = 100;  //max power = 100%
global LaserPWMPeriod = .00005; //for 20khz period 
global LaserPWMChannel = 4;  //for channel 4

  Just change those last 2 if you need to. You will typically hook the Pokeys 0 volt to the 0volt terminal,
and the pwm channel to the PWM input..

  We're working on this now, so within a few days Ill post more about how this works with hv lasers,
Ill have to issue an update as I just added scaling for lasers that dont turn on till they hit a
minimum limit..  Dan has his working so perhaps he can kick in on how he wired his as well.

Art

User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4591
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: Realtime PWM mode added.

Post by ArtF »

Joakim:

  Update:

Dont change any script, I have added selection of PWMPeriod, channel and axis into the main planner config. Ill update tomorrow..

Thx
Art
Joakim
Old Timer
Posts: 56
Joined: Mon Sep 17, 2012 5:48 am

Re: Realtime PWM mode added.

Post by Joakim »

Great, I will wait with script changes.

My power supply is a real Chinese Style, open and have few markings on it. Earlier I did some measurements and wire following to get a schematics of the inner working (hand draft attached).

With Mach3 I had the laser fire working, attached to Z direction signal and it fires when pulled low.
The laser activation (Laser On) can be a relay simulating the switch I have today.
Laser power (mA) can be a PWM signal simulation a voltage between 0.9V and 3.5V - now it is a potentiometer 1k 2W.
Test switch will be in software (Auggie).

First test will be the real time PWM and get it working.
Laser On switch and mA control can follow when laser fire is working.
Attachments
P1060899 - Forum.jpg
P1060896 - Forum.jpg
Post Reply

Who is online

Users browsing this forum: No registered users and 85 guests