Let's Make Robots!

Arduino and a Chinese 32 channel servo controller

I bought a Chinese USC 32 channel servo controller on ebay a month ago. Last weekend I finally found some time to try it out. But I can not get it to work with my Arduino Mega, actually I thought there was something wrong with the board, unitl I downloaded the Chinese software for it, which lets you test the board. I connected 2 servos and the sliders in the program let the servos move. So the board works when using USB.

This is the link with the manual: http://www.torobot.co/usc32-manual

I tried the code at the bottom of this topic http://letsmakerobots.com/node/30349 but it did not work...

I connected TX/RX and ground to RX/TX and ground on my Arduino. I measured that the servos get power, I'm quite sure it's connected like it should. When I tested the following code the serial led on the servo controller blinks. I've tried different baud rates but to no avail. I've also tried using a different serial port on my Arduino Mega2560, but get the same result.

void setup() {
Serial.begin(9600);
}

void loop() {
move(1, 2000, 100);
move(1, 1000, 100);
}

void move(int servo, int position, int time) {
Serial.print("#");
Serial.print(servo);
Serial.print("P");
Serial.print(position);
Serial.print("S");
Serial.println(time);
Serial.print(0x0d); Serial.print(0x0a);

}

Any ideas?

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

I've got the same servo controller. Tried the code above which I would expect it to more the servo left then right and repeat.

It does seem to run the command once and my orange light flashes on the servo control board but it doesnt get any further. The supplied software works 100% so I'm a little stuck :-(

Ideally it would be nice to log what this PC software outputs so I could replicate it in the arduino.

Have you played any further ?

 

Steve

Played some more with the little controller:

void setup() {
Serial.begin(9600);
}

void loop() {
move(1, 2400, 500);
move(1, 750, 500);
}

void move(int servo, int position, int time) {
Serial.print("#");
Serial.print(servo);
Serial.print("P");
Serial.print(position);
Serial.print("T");
Serial.println(time);
delay(time);
}

This code lets 2 servos connected to pins S1 and S2 sweep:

void setup() {
Serial.begin(9600);
}

void loop() {
Serial.println("#1P700T500");
Serial.println("#2P700T500");
delay(1000);
Serial.println("#1P2000T500");
Serial.println("#2P2000T500");
delay(1000);

}

It works, 1000x thanks for getting me this far. I was about to give up on it.

When I input the #1P600T1000 command in the serial monitor and select the Newline option at the bottom (of the serial monitor) the servo moves to the correct position. Now I only have to figure out how to translate it to arduino code to use in a sketch :)

Tried the above code, I get this back on the serial monitor when I turn the servo controller on: 0Starting

Then I tried sending commands to it like in the manual: #1P600T1000\r\n

But still nothing :(


Ok, cool, something of the serial communication is actually working, great!

Did you actually type backslash r backslash n ?? Hope not.

  1. My Arduino IDE (0022) got an option where I can set how the line should end. I can select both NL and CR. Unfortunately I cannot see the order of the two characters. Anyway, try that, and then only type the actual command: #1P600T1000
  2. Try to install an other serial terminal program, eg putty. Then you can have full control of what you are sending. CTRL-J is linefeed and CTRL-M is carriage return. So type (without the spaces):  #1P600T1000 CTRL-M CTRL-J

 

 

Try

  1. to connect your Arduino serial monitor to the board via USB and then type the commands by hand
  2. the sketch below on your Arduino and them connect ping 4 and 5 to rx and tx on the board, and then connect your serial monitor to your Arduino. (eventually make a loop test by connecting pin 4 and 5 and see that you get back what you type)

#define rx_pin 0
#define tx_pin 1
#define bb_tx_pin 4
#define bb_rx_pin 5

void setup()
{
  pinMode(rx_pin, INPUT);
  pinMode(tx_pin, OUTPUT);

  pinMode(bb_rx_pin, INPUT);
  pinMode(bb_tx_pin, OUTPUT);
  }

void loop()
{
  digitalWrite(bb_tx_pin,digitalRead(rx_pin));
  digitalWrite(tx_pin,digitalRead(bb_rx_pin));
}

 

The serial led on the servo controller, there is only one led. I've just tried it with a delay(1000); between every line and the led blinks at the interval of the delays. I already tried that yesterday.

The connectors on the board all have labels. I've connected 2 servos to S1 and S2.

I've tried different wires, the serial headers on the servo controller have male and female pins, I've tried both headers. I think I've tried everything...

I've tried it without the ln but still nothing. I've tried different serial ports on my Mega. I don't connect the USB when I have my Arduino connected to it. I'm giving it power from my lab power supply. When I try the code the serial led on the controller blinks.

  1. "serial led" on which board? Arduino or servo controller?
  2. Which serial led, send or receive?
  3. please try to add a delay(1000) to bottom of the move function
  4. what are the connector on the servo controller called? does it say anything meaning full on the board?