Motor brake

Moderators: TomKerekes, dynomotion

User avatar
cnc_freak
Posts: 58
Joined: Fri Apr 20, 2018 5:36 am
Location: Greece
Contact:

Motor brake

Post by cnc_freak » Sat Sep 22, 2018 7:02 am

Hello everyone.
I want to implement an application using an electromagnetic brake on an axis motor.The motor rotate a big lathe chuck via a planetary gearbox and after positioning to the right angle i need to clamp the chuck with a brake, due to gearbox backlash issues.
I need help of how i write a c program probably, which will do something like that.
Every time the user wants to move the axis, the servo drive and the axis must be enabled, via an digital output and after some time, in example 500ms, the actual movement must start.
When the target is reached, the drive and the axis must be disabled again. My question is how can i trigger this action. What should i monitor in order to see that there is a demand of movement for the specified axis.
Any help will be appreciated.

User avatar
TomKerekes
Posts: 2676
Joined: Mon Dec 04, 2017 1:49 am

Re: Motor brake

Post by TomKerekes » Sat Sep 22, 2018 2:52 pm

Hi cnc_freak,

There isn't a general means of knowing a motion is to occur and to hold it off for something to happen beforehand. Would the axis only be moved via GCode? Or would it be Jogged and such also?

The most direct way would be to create explicit User buttons or MCodes to do the Unclamp/Enable and Clamp/Disable.

Note this can be difficult because there can be problems if the axis attempts to move before the Clamp is released, or if the axis is enabled while clamped, of if the axis is disabled and drifts before the clamp is applied.

For a somewhat more automatic approach you might use a "dummy" axis. The User or GCode would move the dummy axis. There would be no motor associated with the dummy axis (No Input/No Output modes). The dummy axis would be the axis included in the Coordinated Motion System. A C Program would then monitor the dummy axis. If motion was detected it could then unclamp, delay, and then command the "real" axis to follow the dummy axis. When the dummy axis stopped (and possibly still for some time period) it could command the "real" axis to the final position, wait for the axis to finish moving, clamp, and delay. Any GCode or anything that moves the dummy axis may need to know to wait some time after the dummy motion completes to be sure the real axis is in position and clamped.

Any of this sound reasonable?
Regards,

Tom Kerekes
Dynomotion, Inc.

User avatar
cnc_freak
Posts: 58
Joined: Fri Apr 20, 2018 5:36 am
Location: Greece
Contact:

Re: Motor brake

Post by cnc_freak » Sun Sep 23, 2018 6:53 am

Would the axis only be moved via GCode? Or would it be Jogged and such also?
Thank you Tom for the quick answer.
Well the axis would only be be Jogged, or moved via a button to a specified angle.
Also there could be another problem.
When the axis/chuck is locked via the brake, the chuck could slip, when the load is greater than the brake can handle.
Because of the axis being disabled, "the time the brake is active/locked" ,there would not be a following error alarm, in order to notify the user that the chuck position is not valid anymore. How can i implement that the user would be notified?

Thank you in advance.

User avatar
TomKerekes
Posts: 2676
Joined: Mon Dec 04, 2017 1:49 am

Re: Motor brake

Post by TomKerekes » Sun Sep 23, 2018 4:30 pm

Hi cnc_freak,
Well the axis would only be be Jogged, or moved via a button to a specified angle.
That should make it easy. Program the required sequence: unclamp, delay, enable, move, wait, clamp, disable, etc...
Also there could be another problem.
When the axis/chuck is locked via the brake, the chuck could slip, when the load is greater than the brake can handle.
Because of the axis being disabled, "the time the brake is active/locked" ,there would not be a following error alarm, in order to notify the user that the chuck position is not valid anymore. How can i implement that the user would be notified?
I Can think of 2 approaches:

#1 leave the axis enabled but set PID gains and Max Limit Output to zero so there would be no Output. Or disable the amplifier.

#2 Watch for an error yourself with a User C Program that continuously compares the last commanded Destination to the current Position ie:

if (fast_fabs(ch3->Position - ch3->Dest) > ALLOWED_ERROR) .....
Regards,

Tom Kerekes
Dynomotion, Inc.

User avatar
cnc_freak
Posts: 58
Joined: Fri Apr 20, 2018 5:36 am
Location: Greece
Contact:

Re: Motor brake

Post by cnc_freak » Mon Sep 24, 2018 8:47 pm

The two in question axis are jogged via Kmotion_CNC screen buttons with ID: IDC_Aplus2,IDC_Aminus2,IDC_Bplus2 and IDC_Bminus2.
How can i reprogram those? Or do i have to assign new buttons to do the jogs, which it don't have, because i already have use them all in my screen.
Please see attached file.
Attachments
POSITIONER_7_AXIS.scr
(48.92 KiB) Downloaded 114 times

User avatar
TomKerekes
Posts: 2676
Joined: Mon Dec 04, 2017 1:49 am

Re: Motor brake

Post by TomKerekes » Tue Sep 25, 2018 2:03 am

Hi cnc_freak,

No you can't re-program the existing Jog buttons with the Screen Editor. They have special dedicated functionality.

Hmmm I would have thought 50 custom buttons would be enough. Actually it seems you do have 4 left. I suppose we could add more.

You might be able to free up some Labels by using a background bitmap.

Or do multiple screens.

Regards
Regards,

Tom Kerekes
Dynomotion, Inc.

User avatar
cnc_freak
Posts: 58
Joined: Fri Apr 20, 2018 5:36 am
Location: Greece
Contact:

Re: Motor brake

Post by cnc_freak » Thu Sep 27, 2018 6:28 am

Hello again.
I try to do what you suggested above, and i came up with a problem.
In the case i want to jog the axis B, "ch4" i do it with the command jog (4,speed) or jog(4 -speed).
The sequence, is press a momentary button on Kmotion_CNC, enable the axis, set a IO bit to enable the servo drive, which the servo drive then disables the brake, wait some time, like 1sec and the apply the jog(4,...) command. The problem is that after the axis is enabled the jog command does not work. It looks like there is no speed programmed.... What do i do wrong? Please check the attached init7analog file in the line 603 where i check the BPLUS button.
Regards.
Attachments
positioner_7_axis.scr
(48.94 KiB) Downloaded 115 times
Init7Analog.c
(17.2 KiB) Downloaded 121 times

User avatar
TomKerekes
Posts: 2676
Joined: Mon Dec 04, 2017 1:49 am

Re: Motor brake

Post by TomKerekes » Thu Sep 27, 2018 4:47 pm

Hi cnc_freak,

I think the issue is that Enable is being continuously called while your button is depressed. Enable kills any motion and sets the Traget Destination to the current encoder Position. Also you only need one delay when the Axis is first Enabled. You might only call Enable() when the Axis is not already enabled.

For example change:

Code: Select all

            if (ReadBit(BPLUS))
            {
                //SetBit(154);
                EnableAxis(4);
                Delay_sec(2.0);
                Jog(4, 5000);
            }
to

Code: Select all

            if (ReadBit(BPLUS) && !ch4->Enable)
            {
                //SetBit(154);
                EnableAxis(4);
                Delay_sec(2.0);
                Jog(4, 5000);
            }
HTH
Regards,

Tom Kerekes
Dynomotion, Inc.

User avatar
cnc_freak
Posts: 58
Joined: Fri Apr 20, 2018 5:36 am
Location: Greece
Contact:

Re: Motor brake

Post by cnc_freak » Tue Oct 02, 2018 5:20 pm

Yes this was the problem.
Now another problem came up. I noticed that the "move to" button brings an error that the persist variables cannot be read???
This error came up after the command DisableAxis(4); If this command is disabled then everything works fine.
This problem is on every "move to" button for every axis.
Attachments
Init7Analog.c
(17.12 KiB) Downloaded 113 times

User avatar
TomKerekes
Posts: 2676
Joined: Mon Dec 04, 2017 1:49 am

Re: Motor brake

Post by TomKerekes » Tue Oct 02, 2018 9:06 pm

Hi cnc_freak,

I think one problem might be that the function InputBox is expecting an address of a float, but you are passing the address of a double.

Answer = InputBox("Enter Distance to go X",&value);

btw we are adding a Validation Tool based on splint to help flag errors like this.
Regards,

Tom Kerekes
Dynomotion, Inc.

Post Reply