Page 1 of 1

fastest sensor reaction.

PostPosted: Mon Jul 09, 2018 11:48 am
by Battwell
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.

Re: fastest sensor reaction.

PostPosted: Mon Jul 09, 2018 2:52 pm
by Battwell
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);

//wait for spindle sensor on = movement


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


if (exec.Ismacrostopped())
exec.Clroutpin (spinonport,spinonpin);

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

exec.Setvar (0,998);

exec.Clroutpin (spinonport,spinonpin);

Re: fastest sensor reaction.

PostPosted: Mon Jul 09, 2018 3:02 pm
by cncdrive
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.

Re: fastest sensor reaction.

PostPosted: Mon Jul 09, 2018 3:11 pm
by Battwell
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!

Re: fastest sensor reaction.

PostPosted: Mon Jul 09, 2018 3:31 pm
by cncdrive
What about using an arduino or something like that to make the index pulse longer?

Re: fastest sensor reaction.

PostPosted: Mon Jul 09, 2018 3:37 pm
by Battwell
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)

Re: fastest sensor reaction.

PostPosted: Mon Jul 09, 2018 8:24 pm
by Robertspark
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

Re: fastest sensor reaction.

PostPosted: Mon Jul 09, 2018 8:52 pm
by cncdrive

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.

Re: fastest sensor reaction.

PostPosted: Mon Jul 09, 2018 10:10 pm
by Battwell
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.
I’ve used 2803a before to drive step signals so I know they are very fast.

Re: fastest sensor reaction.

PostPosted: Tue Jul 17, 2018 12:06 am
by Battwell
I decided on doing the hard way and swapping to ac servo