Pololu 8 Servo Serial Controller - communication problem

i’m programming an interface for a project using a pololu 8 serial servo controler. I’m using c# with the class probided by Colin Karpfinger. Using a timer at 100ms of interval, i want to be able to control at least 6 servo simutanously.

Presently i have no problem controlling one servo but when i tried to control two, i got an error from the controller ( red on, green flashing). Here is the part of code:

serialPort1.Pololu(comPort, baudRate, 7, servo, servoSpeed);
serialPort1.Pololu(comPort, baudRate, 6, servo, servoSpeed);

I also have modified the class from Karpfinger so a com port is not created each time a command is send so my test code(simplified but exact) is:

serialPort1.init(comPort, baudRate);
for(i=3000;i< 4000;i+=10)

serialPort1.Pololu( 7, i, 0);
serialPort1.Pololu( 6, i, 0);


If a have only one servo in the loop, it work…
And if i keep the original class, its terribly slow…

Can you tell me what i am doing wrong?

Is there a command to “reset” the controller between each different servo?

Thanks !


I believe the code you’re using opens and closes the serial port whenever you send a command. Is this the case? If so, try modifying it so that it opens the serial port before entering your update loop and closes it the update loop (or when the program is closed).

- Ben

no in fact, the port is open until i close the program. To simulate this in my "test"code, the init() create the port and open it and the close() …close the port. The function pololu(servo, position, speed) write to the port twice with port.Write(…) command. Once for speed command and the other for absolute position command, exactly like the original class.

At each iteration, the class write twice. For one servo it work but when comes two…error

Sorry, I somehow totally missed your pointing that out in your initial post! I must have gotten the idea so firmly in my head that I didn’t carefully read everything you wrote.

Do you still get an error if you run the program without any servos connected? Problems that appear when you add second motors/servos can be an indication of a power problem (e.g. you have enough power for one servo, but the second servo draws more than your supply can handle and causes the board to reset). How are you powering everything?

- Ben

I’ am currently powering my system with a dlink router adapter, 5v 1.2A. It is connected in both de controller boart and the servo power (I have made and Y).

What mean the light code i’m recieving? Power or commnuication speed error?

After the job, i will put the real commant i’m sending to the controller (port.write(…))

The LED behavior is an indication of a communication error (see the user’s guide for more detail), but power issues that cause the board to reset while you are in the middle of sending it serial data can trigger a communication error. The thing I asked you to try should only take a few seconds and it could tell you a lot: run your program once with both servos connected and again with both servos disconnected. If you only get the error when both servos are connected, you are almost certainly dealing with a power issue.

- Ben

Tested what you thold me…

no servos = OK (always)

first or second servo connected (both command sended) = error sometimes ( 1/2)

1.5a not enought ?

The amount of power you need ultimately depends on the specific servos you are using, but a good rule of thumb is to assume around an amp per standard servo while it’s is straining or accelerating. I recommend you find an adapter that can supply more power or switch to using a battery.

- Ben

It’s alive !

I kept my adapter for the controller and a old battery pack (4 AA cells) for the servos.

Everything is working as espected in my test and my real program.

It’s amazing that a small battery pack can deliver more amps than a 1.2 amp adapter…i’ll keep that in mind next time !

Thanks a lot !