Running a servo motor on BBB with LinuxCNC?

1,159 views
Skip to first unread message

Eren Basturk

unread,
Apr 11, 2014, 10:56:31 AM4/11/14
to machi...@googlegroups.com
Hi All,

I would like to drive a servo motor on BBB with LinuxCNC but i don't know how can I create my confing and how can I use BBB io's with linuxCNC on Beagle Bone?

Obviously, I want to drive a motor to learn the system. Where can i start to do it?

Best Regards,
Eren

Charles Steinkuehler

unread,
Apr 11, 2014, 11:09:32 AM4/11/14
to Eren Basturk, machi...@googlegroups.com
What sort of motor? What kind of feedback?

I've got PRU code that will support encoder inputs, but it's not made it
into the mainline Machinekit yet, and as it's currently setup it won't
support really high encoder pulse rates.

For driving the motor, you can use software PWM at relatively low
frequencies, or hardware PWM with higher rates. But the code isn't
written to talk to the hardware PWM generators yet. Hooking the
BeagleBone PWM pin to your physical motor driver is left as an exercise
for the reader. :)

This also depends a lot on your motors. A single PWM channel is enough
to control a brushed DC motor, but if you're wanting 3-phase brushless
motors, the BeagleBone probably isn't the best choice for now.

--
Charles Steinkuehler
cha...@steinkuehler.net

signature.asc

Michael Haberler

unread,
Apr 11, 2014, 11:13:04 AM4/11/14
to machi...@googlegroups.com
Hi Eren,
machinekit uses the LinuxCNC code base, so most if not all the documentation here applies: http://www.linuxcnc.org/docs/devel/html/
you can find several servo configurations under the configs/ directory.

You will likely need an quadrature encoder component for the servo loop. Currently there is the software encoder component (see encoder.9 on the abovementioned link), however it will not reach very high rates with the Xenomai kernel on the beaglebone.

Work is underway for a PRU-based encoder: https://www.youtube.com/watch?v=XVpX7CBQRh0  which will remove this limitation and make the BB platform work well for high-speed servo configs too

- Michael

 

Best Regards,
Eren

Andy Pugh

unread,
Apr 11, 2014, 12:52:58 PM4/11/14
to Eren Basturk, machi...@googlegroups.com


> On 11 Apr 2014, at 15:56, Eren Basturk <bastu...@gmail.com> wrote:
>
> I would like to drive a servo motor on BBB with LinuxCNC

Just to clear ip a potential confusion. You don't by any chance mean a radio control model "servo"?

Eren Basturk

unread,
May 2, 2014, 3:20:23 AM5/2/14
to machi...@googlegroups.com
Hi All,

Sorry for late reply but I wanted to write a clear answer after earning experience on Machinekit. I am going to use the servo motor which exists below link.


At this point, I think that I have enough experience to start driving servo motor. Also I revised the links which you sent to me.

As I see, I need to use  PRU to drive not gpio, right?

As I know, encoder inputs not available yet for us , right?








11 Nisan 2014 Cuma 17:56:31 UTC+3 tarihinde Eren Basturk yazdı:

Charles Steinkuehler

unread,
May 2, 2014, 6:32:13 AM5/2/14
to Eren Basturk, machi...@googlegroups.com
On 5/2/2014 2:20 AM, Eren Basturk wrote:
> Hi All,
>
> Sorry for late reply but I wanted to write a clear answer after earning
> experience on Machinekit. I am going to use the servo motor which exists
> below link.
>
> http://www.anaheimautomation.com/products/servo/servo-motor-item.php?sID=218&serID=2&pt=i&tID=350&cID=27
>
> At this point, I think that I have enough experience to start driving servo
> motor. Also I revised the links which you sent to me.
>
> As I see, I need to use PRU to drive not gpio, right?

I would probably suggest using one of the hardware PWM channels to drive
the servo amp, that will give you the best resolution and update
frequency. There are no HAL bindings for this yet, but it shouldn't be
too difficult to update the PWM output value using direct register writes.

> As I know, encoder inputs not available yet for us , right?

There is encoder support in the latest builds, but it will be a bit slow
for a 2500 PPM encoder running at 4500 RPM. You need close to a 200 KHz
count frequency, and the current setup will only go to about 50.

You could get started using the existing code, just don't run your
motors too fast. I'll get the PRU based encoder logic reworked to
support rates into the 500 KHz and above range at some point. I just
need to find enough time to get all my projects done!

--
Charles Steinkuehler
cha...@steinkuehler.net

signature.asc

Charles Steinkuehler

unread,
May 2, 2014, 4:55:46 PM5/2/14
to Eren Basturk, Machinekit Mailing List
Mailing list added back to the cc: list

On 5/2/2014 7:54 AM, Eren Basturk wrote:
> thanks a lot ,Charles. I will focus on the encoder. I wonder that should I
> prepare my .ini file as individually. I mean I need to write it as
> manually, right?

There are currently no tools to automatically generate configuration
files for the BeagleBone, if that's what you're asking.

> As I see, If I configure your pru codes, Can I use it instead of GPIO?

For the encoder software as it is currently written you have to use
dedicated PRU inputs for the encoder pins. I am reviewing the option of
using one bank of GPIO pins (probably bank 0, as it has the most pins
available), but that will require a code change.

> I know , I ask many questions , it will be the first time which i will
> develop a cnc machine :D

Please keep questions on the mailing list so everyone can help out with
answers. Many folks know a lot more than I do about building an actual
machine.

--
Charles Steinkuehler
cha...@steinkuehler.net

signature.asc
Reply all
Reply to author
Forward
0 new messages