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: 346
Joined: Sun Sep 25, 2016 7:39 pm
Location: South Wales. Uk

Re: fastest sensor reaction.

Postby Vmax549 » Mon Jul 09, 2018 2:32 pm

without a way to brake teh motor you will not be able to be that consistant with stop position and the inputs are slow. But that is not teh big problem as long as they are consistant.

With a DC motor you could try a crowbar relay where when teh relay opens to stop it also shorts across teh motor with a resistor to act as a brake.

You may want to consider engaging a small stepper or servo to teh spindle then you have total control over teh spindle position for index. You of course would need a spindle encoder with index signal. You could then engage teh driver and refhome teh spindle to teh index signal then rotate teh spindle to teh desired position for the ATC.

IF it is a brushed DC motor you could make a simple servo out of it.

Just a thought, (;-) TP

(;-) TP
Vmax549
 
Posts: 1188
Joined: Sun Nov 22, 2015 3:25 am
Location: USA

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: 346
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: 2187
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: 346
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: 2187
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: 346
Joined: Sun Sep 25, 2016 7:39 pm
Location: South Wales. Uk

Re: fastest sensor reaction.

Postby Vmax549 » Mon Jul 09, 2018 3:40 pm

OK so it it is already servo drive for teh spindle so all you need to do is replace teh analog drive with a step/Dir drive and add an encoder with index signal.

To make teh carousel super simple I would change out teh geneva drive with a belt drive stepper motor. Fast and simple to implement to UCCNC.

Easy Peasy, (;-) TP
Vmax549
 
Posts: 1188
Joined: Sun Nov 22, 2015 3:25 am
Location: USA

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: 895
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: 2187
Joined: Tue Aug 12, 2014 11:17 pm

Next

Return to Ask a question from support here

Who is online

Users browsing this forum: No registered users and 5 guests