fastest sensor reaction.

If you have a question about the software please ask it here.

fastest sensor reaction.

Postby Battwell » Mon Jul 09, 2018 11:48 am

im trying to orient and stop a slowly rotating spindle. (no brake)
the spindle has 1 index pulse sensor only.
im ramping up the pwm until the spindle just turns and the index signal is seen.
ramping up a #var with analogue out attatched to it to drive the spindle.

my question- re coding. what would be the best way
would a while loop- looking for the spindle pulse work faster than
an if loop. (as the if loop will only trigger if the index pulse is active at the precise timing of the if being called)

i have also tried running a macroloop- just running an if - setting a #var to 1 as soon as the index pulse is seen. (so its latched on once seen)
checking this #var in my orient spindle code- and if 1 killing the pwm back to zero.
im still getting rotation way past the sensor.

suggestions as to fastest way please.
Uc300eth on router and mill
If they say it can't be done- I find a way!
Battwell
 
Posts: 407
Joined: Sun Sep 25, 2016 7:39 pm
Location: South Wales. Uk

Re: fastest sensor reaction.

Postby Battwell » Mon Jul 09, 2018 2:52 pm

its a dc servo with analogue only control (control techniques lynx drive)
ive left all original contactors etc intact that the original control used.
(so it was doing this using only whats still in the machine)- controlled by fanuc.
im using the original fwd run wires and analogue in. - the problem being that it requires to be at a certain pwm level before the motor starts spinning.
there is a tacho into the drive but no encoder.

this is the code that is giving best result so far- but its not fast enough.
i was wondering if using getled that its waiting for the actual led on the screen- instead of when the input toggles?- which would mean it cant update faster than the screen updates.?

int spinonport=3;
int spinonpin=2;

double p=2000;
bool pulse= (AS3.GetLED(35));

exec.Setvar (0,999); //set pwm to zero
exec.Setvar (0,998);
exec.Setoutpin (spinonport,spinonpin);
exec.Wait(100);




//wait for spindle sensor on = movement
do

{

p=(p+1);
exec.Setvar (p,998); //increment pwm analogue

Thread.Sleep(1);

if (exec.Ismacrostopped())
{
exec.Stopspin();
exec.Clroutpin (spinonport,spinonpin);
return;
}

}while (!AS3.GetLED(10));


exec.Setvar (0,998);

exec.Clroutpin (spinonport,spinonpin);
exec.Wait(10);
Uc300eth on router and mill
If they say it can't be done- I find a way!
Battwell
 
Posts: 407
Joined: Sun Sep 25, 2016 7:39 pm
Location: South Wales. Uk

Re: fastest sensor reaction.

Postby cncdrive » Mon Jul 09, 2018 3:02 pm

The LEDs states are updated quickly, not as fast as the screen drawing, but much faster.
The LEDs states are updated in a 10msec loop which is the speed of communication syncronisation data from the motion controller.
The screen is then drawn in another slower loop. When you query the state of the LED you not getting it from the screen, but from a variable array which is sent by the motion controller and that same array is read also by the drawing routine in another loop.
So, there is no faster way than querying the LED state.
cncdrive
Site Admin
 
Posts: 2371
Joined: Tue Aug 12, 2014 11:17 pm

Re: fastest sensor reaction.

Postby Battwell » Mon Jul 09, 2018 3:11 pm

ok. thank you.
thinking cap back on again!- ive already spent a lot of time with this.
i may have to end up putting in an ac servo with proper ab encoder and step/direction to achieve exactly what i want
the problem being finding a motor that will fit in the originals place.. drives are no problem i have loads here.
interesting this machine. ive already had to interface new drives to fanuc red cap motors- which everyone told me couldnt be done :-)
i love challenges!
Uc300eth on router and mill
If they say it can't be done- I find a way!
Battwell
 
Posts: 407
Joined: Sun Sep 25, 2016 7:39 pm
Location: South Wales. Uk

Re: fastest sensor reaction.

Postby cncdrive » Mon Jul 09, 2018 3:31 pm

What about using an arduino or something like that to make the index pulse longer?
cncdrive
Site Admin
 
Posts: 2371
Joined: Tue Aug 12, 2014 11:17 pm

Re: fastest sensor reaction.

Postby Battwell » Mon Jul 09, 2018 3:37 pm

it sees the pulse ok. but the motor is already rotating. im trying to stop it at the index pulse. it over runs
(trying to work out how fanuc did it)
Uc300eth on router and mill
If they say it can't be done- I find a way!
Battwell
 
Posts: 407
Joined: Sun Sep 25, 2016 7:39 pm
Location: South Wales. Uk

Re: fastest sensor reaction.

Postby Robertspark » Mon Jul 09, 2018 8:24 pm

Thinking outside of the box

Is there any way to use the THC up / down signals to apply a break when a pulse is detected. They will be very fast
Rob
Einstein ― “If you can't explain it to a six year old, you don't understand it yourself”
...working my way through the 1000+ ways things don't work to find the one that does
UC400eth, UC300eth, UCCNC v1.2106, Neuron Lite
UCCNC v1.2105 Macro Manual
Robertspark
 
Posts: 1103
Joined: Sat Sep 03, 2016 4:27 pm
Location: Nr Liverpool, England

Re: fastest sensor reaction.

Postby cncdrive » Mon Jul 09, 2018 8:52 pm

Rob,

The issue is that even if the signal is fast to get the information to the PC side software it still takes time.
For this reason time critical signals are handled directly on the motion controller, e.g. the THC control and because they are already handled it does not matter if the PC gets a feedback in 1msec or half second etc.
In a macro to read signals as LEDs the information must be sent to the computer side, because the macros run on the computer and so it takes at least 10msec for the info to get there.
And if a pulse is too short then it is possible that the sampling will be done before the short pulse and after the short pulse and the pulse itself will be not even sent to the PC.
cncdrive
Site Admin
 
Posts: 2371
Joined: Tue Aug 12, 2014 11:17 pm

Re: fastest sensor reaction.

Postby Battwell » Mon Jul 09, 2018 10:10 pm

I was thinking I may be able to latch on a darlington array (2803a) using the index signal. That should switch off and unlatch immediately. ( killing the run signal to the drive from one channel) and using another channel on the Darlington array as my input into uccnc.
Thoughts?
I’ve used 2803a before to drive step signals so I know they are very fast.
Uc300eth on router and mill
If they say it can't be done- I find a way!
Battwell
 
Posts: 407
Joined: Sun Sep 25, 2016 7:39 pm
Location: South Wales. Uk

Re: fastest sensor reaction.

Postby Battwell » Tue Jul 17, 2018 12:06 am

I decided on doing the hard way and swapping to ac servo
https://youtu.be/MGVGbKunn5Q
Uc300eth on router and mill
If they say it can't be done- I find a way!
Battwell
 
Posts: 407
Joined: Sun Sep 25, 2016 7:39 pm
Location: South Wales. Uk


Return to Ask a question from support here

Who is online

Users browsing this forum: No registered users and 2 guests