interfacing arduino with Sc16a servo controller

hi all...

I have an arduino BT connected to a cytron sc16a servo controller and i am trying to use this to drive a servo motor. the end result is to drive the servo motor using commands being sent to the arduino BT from a gui on my pc. so basically, i click a button on my pc screen, a character is sent to the arduino where it is processed and then info is sent to the servo controller which in turn drives the motor. this is the plan.

sadly, nothing seems to be happening (i.e the servo is not turning). to trouble shoot, i eleminated the bluetooth element from my set up and am now using pushbuttons connected to the arduino in order trigger the serial communication (from arduino to servo controller). even this seems not be working as well...

next, with the same setup just mentioned, i used the arduino serial monitor to check the integrity of the data (4 bytes) i am sending....and it seems like it is correct. the servo controller seems to be receiving the pulses from the arduino (i checked with an oscilloscpe) but the its still not turning the servo.

I am running short of ideas here and hoping someone out there could help me out.....so, anybody out there???

so, anybody out there???

No. Nobody is here. Try again later...

I have an arduino BT connected to a cytron sc16a servo controller

Link?

i used the arduino serial monitor to check the integrity of the data (4 bytes) i am sending....and it seems like it is correct.

Code?

the servo controller seems to be receiving the pulses from the arduino (i checked with an oscilloscpe) but the its still not turning the servo.

Schematic?

Frustration is understandable. Lack of information makes it difficult to help you, though. We need to know what device you have, how it is connected to the Arduino and how the servo(s) are/is connected to it, and what code is running on the Arduino. Then, just maybe, we can help.

ok understood,

I have my arduino's TX (pin1) and RX(pin 0 ) connected to the cytron sc16a's servo controller's RX and TX pins repectively. I also have the Arduino's 5V and GND pins connected to the servo controller's %V and GND pins. the servo motor is connected to one of the ports of the servo controller. its power is obtained from an external 9v alkaline battery which is connected to the servo controller (as the sc16a provides a slot for this). that's basically my setup. here is the sample code I am currently trying to run:-

#define mainbodyLEFT_Button_9 10
#define mainbodyRIGHT_Button_10 11

int state1 = HIGH;
int position1 = 732;

void setup()
{
Serial.begin (9600); //Set USART Baud Rate to 9600

pinMode (mainbodyLEFT_Button_9, INPUT); //Set button pin to input
digitalWrite (mainbodyLEFT_Button_9, HIGH);/ENABLE INTERNAL PULL-UP RESISTORS ON THIS PIN/

pinMode (mainbodyRIGHT_Button_10, INPUT); //Set button pin to input
digitalWrite (mainbodyRIGHT_Button_10, HIGH);/ENABLE INTERNAL PULL-UP RESISTORS ON THIS PIN/

}

void loop()
{
delay(100); // debounces switches

int mainbodyLEFT_Button_9_value = digitalRead(mainbodyLEFT_Button_9);
int mainbodyRIGHT_Button_10_value = digitalRead(mainbodyRIGHT_Button_10);

if(mainbodyLEFT_Button_9_value != state1 ||mainbodyRIGHT_Button_10_value != state1||Stop_Button_13!= state1)
{

if (mainbodyLEFT_Button_9_value != state1)
{
if (position1 >1463) {
position1 =1463;
send_cmd(0X41, position1,0);
}
else{

position1+=100;
send_cmd(0X41, position1,0);
delay(10); //wait for message to transmit
}
}

else if (mainbodyRIGHT_Button_10_value != state1)
{

if (position1 <0) {
position1 =0;
send_cmd(0X41, position1,0);
}
else

position1--;
send_cmd(0X41, position1,0);
delay(10); //wait for message to transmit
}

}

}

void send_cmd(unsigned int num, unsigned int data, unsigned int ramp)
//UART transmit 4 bytes: servo number, higher byte position,
//lower byte position and speed

{
unsigned char higher_byte=0, lower_byte=0;

higher_byte=(data>>6)&0x003f;
lower_byte=data&0x003f;

Serial.print(num, HEX); //First byte is the servo channel 0x41-0x60
//delay(2000);
Serial.print(higher_byte,HEX); //second byte is the higher byte of position
//0b00xxxxxx
//delay(2000);
Serial.print(lower_byte, HEX); //third byte is the lower byte of position 0b00xxxxxx
//delay(2000);
Serial.println(ramp,HEX ); //fourth byte is the speed value from 0-63
//delay(2000);
}
thanx

Still don't see a link to the servo controller...

#define mainbodyLEFT_Button_9   10

Really? Pin 10 is assigned a name with 9 in it?

Please don't post code that won't even compile.

if(mainbodyLEFT_Button_9_value != state1 ||mainbodyRIGHT_Button_10_value != state1||Stop_Button_13!= state1)

Stop_Button_13 is not defined anywhere, so this code will not compile.

Your send_cmd function expects 3 unsigned ints. Why are you not calling it with 3 unsigned ints?

That function is sending the 3rd argument as a byte. Why is the third argument not defined as a byte?

All calls to send_cmd have the 3rd argument as a constant, 0. How fast are the servos supposed to turn with a value of 0 as the speed?

Stop_Button_13 is not defined anywhere, so this code will not compile.

Your send_cmd function expects 3 unsigned ints. Why are you not calling it with 3 unsigned ints?

my apologies for my carelessness.

All calls to send_cmd have the 3rd argument as a constant, 0. How fast are the servos supposed to turn with a value of 0 as the speed?

according to the Specification in the sc16a user manual. setting the that 3rd argument to 0 disables the Servo controller's speed control mechanism and makes the servo rotate with its own natural maximum speed.

well, just wanna let you know that everything is working properly now, fixed it a few days ago. It turns out the problem was with the data format the arduino was outputing to the serial port (using the Serial.print statement). I was using HEX all along, I changed it to BYTE and the servo started turning. Apparently, this is the only correct format that the Sc16A board understands.thanx alot for your help. cheers.