Close

Second Chance

A project log for Servo Controller

Drive a dozen or more servos over serial or I²C, on the cheap

Radomir Dopieralski 02/12/2016 at 15:320 Comments

So, after some thinking I decided to actually use this, after all. I have the boards, and although they are not perfect, the problems with them can be worked around. And I have one robot that is particularly tight for space, and uses 18 servos, that I want to control with OpenMV. So it will be useful.

The first problem is that the holes for the pin headers are too tight. That is easily solved, like many things in life, with some unwarranted use of excessive force. I basically used a vice to force the pins in, and the soldered them on both sides, to make them safely secured in place. This required careful planning on the order in which I soldered them, but went well.

The second problem was the spacing between the Pro Mini and the servo board. I actually turned it into an advantage, by attaching the Pro Mini up-side-down, and hiding all the components on its surface in that gap.

Finally, the third problem -- the pins not sticking far enough to stick the servo plugs into them -- was simply solved by using longer pins, which I had lying around. This is not a good long-term solution, because most people won't have such pins, but it works for this single case.

I also wanted to write a library for Micropython for talking with this controller, but the code turned out to be so simple, that I don't think it makes sense to make a library:

import pyb
import struct

bus = pyb.I2C(2)
bus.init()

address = 0x09
servo = 4
position = 1500

bus.mem_write(struct.pack("<H", position), address, servo)
That's it.

You can also move several servos at once, of course:

bus.mem_write(struct.pack("<HHH", position1, position2, position3), address, servo)
Here's a shot of the PyBoard controlling it:

Discussions