Controlling 4 servos - Serial 8-Servo controller

Hi, I have a problem with Serial 8- Servo controller. I am trying to send a postion to 4 servos, which is connected to same servo controller.

I got example codes from your web site. it is working great if I control one servo. But If I control 4 servo, servo controller does not send position to servos at the same time. It is so slow for me. Because I am going to control a helicopter. so I needed to send positions faster…

And then I changed your codes. I open a serial port, and then I dont close it until I get out from program. Now, servo controller sends positions to 4 servos at the same time, it is what I want. But the problem is positions are not correct. Also, servos does not turn full way. let s say current position is 0, and I want to make the positioin 250. When I send the data, servos just turns half-way and stop. Here is my codes, .

//Note : myPort, speedGlobal, baudGlobal are glocal variables…
/* public void connect(string port, int baud)

        myPort = new SerialPort(port, baud, Parity.None, 8, StopBits.One);

    private void sendBtn_Click_1(object sender, EventArgs e)
        send(speedGlobal, 0, portGlobal, baudGlobal); //speed, pin number
        send(speedGlobal, 1, portGlobal, baudGlobal); //speed, pin number
        send(speedGlobal, 2, portGlobal, baudGlobal); //speed, pin number
        send(speedGlobal, 3, portGlobal, baudGlobal); //speed, pin number


    public void send(int speed, int pin, string port, int baud) // Mini SSC II mode...
        const int MIN_ANGLE = 0
                 , MAX_ANGLE = 255;

         if (speed < MIN_ANGLE)
            speed = 0;
        else if (speed > MAX_ANGLE)
            speed = 254;
        //convert speed into hex string
        string speedHex = speed.ToString("X");
        //convert speed into single byte
        byte speedByte = byte.Parse(speedHex, System.Globalization.NumberStyles.HexNumber);
        //convert pin number into hex string
        string pinHex = pin.ToString("X");
        //convert pin number into single byte
        byte pinByte = byte.Parse(pinHex, System.Globalization.NumberStyles.HexNumber);

        //start byte, servo number, position
        myPort.Write(new byte[] { 0xFF, pinByte, speedByte }, 0, 3);

Thank you so much…


When you say the servos turn half as far as you expect and then stop, is the servo controller resetting? There are two tests you can try that might help us figure out what’s going on:

  1. Run your code exactly as it is (i.e. with commands being sent to move four servos) with only one servo connected to your servo controller. See if that single servo behaves normally when connected to each of the four servo ports you intend to use.

  2. Delete from your code the last two send() commands and disconnect from your servo controller two of your four servos. See if trying to control two servos works any better than trying to control four.

Also, you seem to be generating your bytes in a rather roundabout way. Is there a reason why you don’t just cast them from integers into bytes?

e.g. myPort.Write(new byte[] { 0xFF, (byte)pin, (byte)speed }, 0, 3);

- Ben

Hello Ben;

thanks a lot for answer… I did try what you told…

  1. Everything is working great when I connect one servo. I tried every pin I used. and there is no problem.
  2. I did connect two servos. Everything is fine…

but when I connect 4 servos. It does not work correct. the same problem I told at the first message.

also, I changed my conversion codes like as you told me…

Also, when I send too much data packet, servo controller stop. the red led is turned on. Is there any way to avoid it? This is my fisrt experience with this kind of programming. Sorry about it. Thank you so much for helping.

I will be waiting for your answer…

take care

Can you tell me more about how you have everything connected? How are you powering your servo controller and servos? If things work fine for one or two servos but fail with four, it makes me think your power supply cannot supply enough current for four servos.

I don’t understand what you mean when you say “send too much data packet”. Can you clarify or give me an example of what you mean? The red LED indicates a fatal error, such as bad serial input.

And there’s no need to apologize for asking questions; one of the reasons this forum exists to help people get the most from our products.

- Ben

I have a DC Power Supply. (BK Precision - DC power supply 1635)
I set the voltage 5V, and the current maximum.

I tried to increase the current by using a capasitor. I had the same problem again.

send too much data packet means If I changed the positions too fast, the red led is turned on. I mean I send 10 different positions while servo controller is processing the first position…

Hi again,

4 Servos are working great right now, but when I tell the servo controller move from 0 to 222 position, I have problem… Probably, it is because of current. I will try to increase current on monday when I go to lab… Thanks a lot. I will let you now…

But I still need to find out a way to avoid the red led problem. Is there any way to learn if servo is moving or not?

What did you change that caused things to start working fine for four servos?

Unfortunately, standard hobby servos provide no feedback about their positions, so the servo controller has no way of knowing if they’re moving or where they are. The servo controller is designed to be able to handle serial input as quickly as you can send it (assuming your baud rate is within the acceptable range), so, at least in theory, you shouldn’t be experiencing problems when you send positional commands too fast. However, by changing servo positions rapidly, you are probably introducing noise into your system. This noise could be corrupting your serial input, which in turn could cause the servo controller to experience a fatal error (i.e. on goes the red LED).

If you have access to an oscilloscope, I suggest you use it to monitor two things while your servos are stressing the system:

  1. Your board’s Vcc (5 V) line
  2. Your serial input line

If everything is fine, you should see the 5 V line remain steady as the servos go through their paces. If instead you see glitches appear on Vcc, or if you see Vcc dip below 5 V for an extended period of time, you know you’re experiencing power supply issues that could also be corrupting your serial input. Look for glitches on the serial input line as well.

One possible solution would be for you to power your servos with one power supply and your servo controller with a second supply.

- Ben

Do you know the maximum current this can supply? I tried to do a bit of googling and one source rates this supply at 1.5 A while another lists it at 3 A. Either way, many servos straining simultaneously can pull close to 10 A. Does your power supply have the ability to display current, and if so, is the current ever maxing out?

- Ben

I think all my problem was the current. I used two DC power supplies which are connected parallel to each other. I dont have any problem at all. When I move too fast, there is no problem too. everything is fine…

This project is going to be really big auto-pilot helicopter. we are using 5 engines, which are gas hybrid. Actually I am not going to use c# to control engines. I am going to use a rabbit proccessor, which is connected to a gyro. I am writing all project in dynamic C… this was just a test program to control engines and other stuffs in lab environtment…

Now, actually I want to handle every kind of situation, which is possible. If when I flyed it, everything has to work perfect. So just in case, if servo controller is failed, I want to reset servo controller as fast as I can. Can you suggest me anything to make it done…

thank you


While the servo controller is functioning normally, it echoes back the commands you send it. If it ever gets a bad serial input and shuts down (it does this as a safety precaution in case the corrupted serial input was a command to stop), it will stop echoing back commands. I suggest you connect one of your microcontroller’s I/O lines to the servo controller’s reset line. Have your microcontroller monitor the bytes the servo controller echoes back; any time you fail to get an echo when you know to expect it, reset the servo controller. Does this make sense?

- Ben