Close

Introduction

A project log for rbServo

CAN controlled hobby servo

rasmusbRasmusB 03/22/2014 at 23:010 Comments

I have been thinking about this project for some time. It all began with a video on Youtube of a hexapod robot: 


I was really impressed with the fluidity of the motions, and started reading up on motion control. I experimented with Inverse Kinematics, and designed a crude simulation in Python of a hexapod of my own. This had 4DOF per leg, and I got it working to some extent. The image below shows my (ugly) model. It is as simple as can be, the red cylinders represents the joints while also visualizing the axis. The gray cylinders represents a stiff connection between the joints.

While this model does not take gravity, material stiffness or anything like that into account, it was a great tool to learn about the difficulties to calculate servo motion. I also started thinking about how to actually build it.

At this point (fed up with programming) I decided that I should look into improving the servo controller usually found in a standard RC servo. Not because it was entirely necessary, but because it seemed fun. I found a few open-source alternatives, but they all ended up being unsuitable in one way or another. So I set out to build my own.

I decided that the servo should communicate through a CAN bus. It is very robust, and handles multiple nodes in a very elegant way. It can be thought of as a real-time database of information that all nodes have access to - any node can send information at any time, and all nodes can see it. Messages are automatically prioritized, and collisions are handled according to message priority. It really is well thought out, check out the Wikipedia article!

After a lot of experimentation and frustration with Arduino and a few MCP2515-based CAN shields, I decided that I should go for a microcontroller with a built-in CAN controller instead. The size requirements also dictated this - if it was going to fit inside a RC servo, I won't have room for both a microcontoller and a CAN controller. The choice fell on the ATmega16M1 - basically an ATmega328P with CAN and a dedicated motor controller, but half the amount of flash/RAM. If necessary, I can easily upgrade to the pin compatible ATmega32M1, or its big brother ATmega64M1.

This is my first prototype (the purple board) compared to the original servo controller. The next revision will have shrunken my design down to an even smaller footprint than the original.

This prototype was build to to a basic concept test - especially of the CAN communication. After being completely fed up with trying to build some kind of USB - Arduino - MCP2515 - CAN adapter, I built CANPiThis proved to be a much better tool to get the CAN traffic running as it should, and finally I felt confident enough to start working on Rev B, which is what the next post will be about...

Stay tuned!

Discussions