reading Pokeys pins

C Scripting questions and answers
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4648
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: reading Pokeys pins

Post by ArtF »

Gary:

So then your off by a factor of two, so changing the formula
to  duty  = (speed / 6680) * 100; sounds about right..

You command 3500 and the formula provides a duty of 50.0,
command 6680 and you'll get 100.0 , which is whats giving you 6680
right now. So in the script where you control the spindle speed,
just do a check and set the duty cycle..

if( speed > 6680 ) speed = 6680;
SetPwmDuty( channel, (speed / 6680) * 100.0 );

  This is only a first order appoximation but should
be accurate enough. You can get more complex with
tables of values or nonlinear formulas for any
nonlinear speed relationships, but typically a
first order is enough..

Art


Art


gburk
Old Timer
Posts: 324
Joined: Sun Nov 25, 2018 3:57 pm

Re: reading Pokeys pins

Post by gburk »

Art

I'm Not 100% sure you understood what I said, or i'm not getting what you saying

6680 is what the reading was from the hand held dig tach so there is no feedback going to auggie seeing that auggie can't read an index or rpm value.
so I don't think there is any way for me or auggie to test for speed > 6680... and that will change with all M3 S setting..

I think seeing that the speed is close to double form what I set in auggie M3 S3500 and spindle is running at 6680..
then most likely just divide the duty in half...

But do you think this will help at the low RPM's I can't get the spindle to turn at all till I send at least S700 so I have to send enough voltage to start the spindle and that's seems to be around 700 RPM and I forget but somewhere over 1volts

Not sure if this is correct thinking. or its messed up in my mind

Tested again S2200 is reaching max close to max voltage if 5v is max.. and a rpm reading of spindle at 4700 and 4.95v
the lowest speed is S500 and its voltage is 1.2 and 60 Rpm so it seems it does need at least 1,2 volts to get the spindle moving..

Gary
Last edited by gburk on Sun Aug 11, 2019 2:51 am, edited 1 time in total.
gburk
Old Timer
Posts: 324
Joined: Sun Nov 25, 2018 3:57 pm

Re: reading Pokeys pins

Post by gburk »

Art

Have Another script and panel for you to check out
Hoping the math is correct, its a start for auto calculating the motor steps per, for the entered distance and distance traveled and old steps..

Gary

Attachments
Pokeys57CNC.zip
(70.06 KiB) Downloaded 246 times
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4648
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: reading Pokeys pins

Post by ArtF »

Hi Gary:

  I'm leaving in a couple days for Alaska, and wont be back for a couple weeks, so Ill
check it out then.

  As to Spindle Speeds.. What I was describing is what you do when a S word is called
for it terms of setting the duty cycle..Ill elucidate... :)

Here is what I have for your spindle speed setting script.. Ill display just
the lines that set the Spindle speed when it see's a S word in the Gcode.



global SpindleSpeed = function( speed )
....
....
zerotohundred = (speed / 25000) * 100;
SpindleDevice.SetPWM( 2, zerotohundred );

  speed is whatever your Gcode called for S word..
It seems, like most of us you have a minimum speed..
so the easiest way to handle it is as in ..

zerotohundred = (speed / 25000) * 100;
SpindleDevice.SetPWM( 2, zerotohundred );

  The above assumes your max speed is at S25000 which then
translates to 100.0 as a PWM setting, if you change 25000
to your actual max speed call this will then be accurate.

To check for a minimum you simple do this..

if( speed < 700 ) speed = 700;
zerotohundred = (speed / 25000) * 100;
if( zerotohundred > 100) zerotohundred = 100;
SpindleDevice.SetPWM( 2, zerotohundred );

So if the user enter S400, it will be translated to S700
If he enters S56780 , the duty cycle will only be set
to 100, so max speed.

SO the only number you need to figure out to make the above work
is the 25000 number, its probably more like 6000 for you. Just change the
25000 up or down until your upper S word is accurate. If the max your
spindle can do at 5 volts is 6680 RPM, just keep raising or lowering
25000 in the script until a call of S6680 is correct.

As you say, Auggie doesnt read the speed so its all a matter of simply
scaling the users Sword to the proper duty cycle as above.. The 700
can be adjusted to whatever minimum speed actually makes the
spindle turn close to that speed.&nbsp; This isnt unusual at all, most
spindle have no low end and are not very linear in control.

Art






&nbsp;
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4648
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: reading Pokeys pins

Post by ArtF »

Gary:

I should have mentioned, I updated Auggie for 10 times the script length as
a maximum. I still havent found that starting bug, but will search for it when
Im testing out your panels. :)

Art
gburk
Old Timer
Posts: 324
Joined: Sun Nov 25, 2018 3:57 pm

Re: reading Pokeys pins

Post by gburk »

Art

Thanks and have a great trip, I'm jealous I have always wanted to do the train ride up there.. maybe someday..

most likely will have plenty of stuff I messed up to bug you about on your return..

Thanks gary
User avatar
Mooselake
Old Timer
Posts: 531
Joined: Sun Dec 26, 2010 12:21 pm
Location: Mooselake Manor

Re: reading Pokeys pins

Post by Mooselake »

Have a nice trip Art, and watch out for wild moose

Kirk
gburk
Old Timer
Posts: 324
Joined: Sun Nov 25, 2018 3:57 pm

Re: reading Pokeys pins

Post by gburk »

Art

Decided to give it a go in real life didn't go so good, the g code I am attaching doesn't seem to rewind, at first it was created with sheetcam..

I ran the g code many times but just testing and seemed ok, I don't think the problem is the g code.

Here's what is going on with it,
I run the g code it go's ok but when my dialog pops up for a tool change, looks ok now I jog the z up to change the tool jog down to the parts surface set z to 0 and use the single line window to sent the z back to 1 g0 z1 now I exit the tool change dialog to hit the run button and its seems the g code has re wound.
doe's this every time.
Not sure where the problem is maybe I can't exit the g code window to the single line window and back again to the g code window..
any thoughts on this ONE.

Thanks gary&nbsp;
Attachments
XballscrewmountFinal.zip
(6.03 KiB) Downloaded 231 times
BobL
Global Moderator
Global Moderator
Posts: 467
Joined: Sun Sep 05, 2010 7:18 am

Re: reading Pokeys pins

Post by BobL »

Gary;

I'm sure you already know Art is away on vacation, so I'm replying to say wish I could help with your code rewinding problem after a tool change, but this area of coding will definitely require Art's expertise when he gets back?&nbsp; I'll pass along the message when he gets back next week sometimes..

Cheers
Bob
Gearotic Motion
Bob
gburk
Old Timer
Posts: 324
Joined: Sun Nov 25, 2018 3:57 pm

Re: reading Pokeys pins

Post by gburk »

Bob

Yep knew he was gone but if I don't post things as I am testing and running into problems I seem to forget what was going on in a few days..

Thanks
Gary
BobL
Global Moderator
Global Moderator
Posts: 467
Joined: Sun Sep 05, 2010 7:18 am

Re: reading Pokeys pins

Post by BobL »

Gary, thanks for your patience.

Cheers
Bob
:)
Gearotic Motion
Bob
gburk
Old Timer
Posts: 324
Joined: Sun Nov 25, 2018 3:57 pm

Re: reading Pokeys pins

Post by gburk »

Art

Did a test run on wood getting close ran ok, I don't have the steps dialed in 100% yet but heres a pic..

I think most of my problems are with the m6 dialog, I removed all the functions except the close dialog and seems to run a lot better..
It seems to me the dialog when called it pops up but still keeps running past the calling call so still executes every thing after its called till the end of the m6 call..
also found if I put say any engine gcode in the dialog close function it doesn't seem to wait on a MotionStill so if I say jogged to change the tool then exit the dialog and call a close function that wants to return to the Z X Y positions before the tool change all axis's move together&nbsp; X Y and Z even with MotionStill after each g code move, I would like Z to move finish and then X Y move.. make sense?.
Also not sure what cause's the Z axis when jogging down to touch off top of part, it seems to jog ok but most of the time just before I near touching the part and tap mouse to jog it jogs and doesn't stop, it crashes the tool.. and I have to hit Estop..

But I haven't been getting the rewind problems now that i'm not doing to much with the toolchange dialog just closing it, and using sheetcam&nbsp; for the gcode
Gary
Attachments
auggieeun.zip
(23.77 KiB) Downloaded 277 times
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4648
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: reading Pokeys pins

Post by ArtF »

Gary:

&nbsp; It does sound like unexpected results of dialog operation. Never having been used
for the type of thing your doing I think your tests show they dont like running
in the context of a Gcode program.
&nbsp; Ill schedule some time to run your examples to see if I can separate out their
spaces better. Its a very complex interaction but it may be possible to add in
some sort of wait internally for dialog completion.

&nbsp; Internally, Auggie tags each 1ms waypoint with data as to what Gcode line
commanded it. As each executes, that data is checked to show what line is actually
running currently. (As you can imagine, the actual line running in the interpreter may be up to 500 lines ahead..).

&nbsp; Im thinking this may be the root of the problem. As you command a move in the dialog
it is tagged with whatever line the dialog was on, but the interpreter may be several
lines ahead. The m6 dialog may have seen the current line executing as line 0 but was
called on line 10 for example when the interpreter was 10 lines ahead.&nbsp; Ill take a close look in there to see what I can tag as special and to be ignored in setting the current operation line. Your experience is a good debugging indicator as to where the problem lies.

Art
gburk
Old Timer
Posts: 324
Joined: Sun Nov 25, 2018 3:57 pm

Re: reading Pokeys pins

Post by gburk »

Art

Thanks didn't think you would be back for a few days have a good trip?..

I have another question, it about jogging, is there a way to change jogging distance like micro steps maybe 0.001 0.010 for example
I have a hard time after I inset a new tool to jog down and touch off the part it always seems to move .1 or .200 when jogging and seems to do that always
when tool is just above the part and I hit the final jog button to touch off it jogs continuous&nbsp; till tool crashes and I have to hit estop or it will keep going

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

Re: reading Pokeys pins

Post by ArtF »

Gary:

&nbsp; Ill take a look and see what I had put in for that possibility.

Art
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest