Control SSC-32 from Arduino

Hope this helps!

learnhub.com/lesson/7437-moving- … an-arduino

Nice Find!

I have source for driving an SSC-32 from an Arduino, the Arduino wireless over XBee to the remote SSC-32. It’s trivially easy, but I can post it if you like.

Every little bit helps.

Below is some of my arduino test code (for version 18) that can interface with the ssc-32. The ssc-32 TTL tx/rx/ground is connected to the arduino rx/tx/ground pins. The ssc-32 board probably can be powered from the arduino +5v if needed (but no servos!). The below code can take a control string entered in the arduino serial monitor and send it to the ssc-32. The bottom code is for use with the arduino/ethernet shield combo. HTTP request are sent from a web page to the arduino, which processes the request and sends the control strings to the ssc-32 via its serial output (and also to the serial monitor. This is part of my routerbot testing.

//zoomkat 9-9-10 simple delimited ',' string parce 
//from serial port input (via serial monitor)
//and print result out serial port
// CR/LF could also be a delimiter
// http://www.arduino.cc/en/Tutorial/TextString for WString.h

#include <WString.h> //provides easy string handling
String readString = String(100);

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

void loop() {

        //expect a string like wer,qwe rty,123 456,hyre kjhg,
        //or like hello world,who are you?,bye!,
        while (Serial.available()) {
        delay(10);  //small delay to allow input buffer to fill
    	if (Serial.available() >0) {
        char c = Serial.read();  //gets one byte from serial buffer
        if (c == ',') {break;}  //breaks out of capture loop to print readstring
        readString.append(c); } //makes the string readString
        }
      
      if (readString.length() >0) {
      Serial.println(readString); //prints string to serial port out
      
      readString=""; //clears variable for new input
      }
   }
//zoomkat 5-24-10
// http://www.arduino.cc/en/Tutorial/TextString for WString.h

#include <WString.h>
#include <Ethernet.h>

byte mac] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address
byte ip] = { 192, 168, 1, 102 }; // ip in lan
byte gateway] = { 192, 168, 1, 1 }; // internet access via router
byte subnet] = { 255, 255, 255, 0 }; //subnet mask
Server server(84); //server port

String readString = String(100); //string for fetching data from address

///////////////////////
 String teststring = String(100);
 String finalstring = String(100);
 String flag = String(2);
 int ind1 = 0;
 int ind2 = 0;
 int pos = 0;
 //////////////////////

void setup(){

//start Ethernet
Ethernet.begin(mac, ip, gateway, subnet);
server.begin();

//enable serial data print
Serial.begin(9600); }

void loop(){
// Create a client connection
Client client = server.available();
if (client) {
while (client.connected()) {
if (client.available()) {
char c = client.read();

//read char by char HTTP request
if (readString.length() < 100) {

//store characters to string
readString.append(c);
}

//if HTTP request has ended
if (c == '\n') {

///////////////
//Serial.println(readString);
//readString looks like "GET /?-0p1555-1p500t1000 HTTP/1.1"

  if(readString.contains("-")) { //test for servo control sring
  readString.replace('-', '#');
  pos = readString.length(); //capture string length
  //find start of servo command string (#)
  ind1 = readString.indexOf('#');
  //capture front part of command string
  teststring = readString.substring(ind1, pos);
  //locate the end of the command string
  ind2 = teststring.indexOf(' ');
  //capturing the servo command string from readString
  finalstring = readString.substring(ind1, ind2+ind1);
  //print "finalstring" to com port;
  Serial.println(finalstring); //print string with CR
    }
  ////////////////////////
  //GET /?Slidervalue0=1800&Submit=Sub+0 HTTP/1.1
  if(readString.contains("Slidervalue")) {
  ind1 = readString.indexOf('u');
  ind2 = readString.indexOf('&');
  finalstring = readString.substring(ind1+1, ind2);
  finalstring.replace('e', '#');
  finalstring.replace('=', 'p');
  Serial.println(finalstring);
  }
  ///////////////////
  
  //now output HTML data header
  client.println("HTTP/1.1 204 Zoomkat");
  client.println();
  client.println();
  delay(1);
  //stopping client
client.stop();

/////////////////////
//clearing string for next read
readString="";
teststring="";
finalstring="";
  
}}}}}

From the post,

13V? I see dead servos…

dj

Thanks for sharing.

I’m building a tetrapod using a SSC 32 board and Arduino Mega. Soon I will post a link to my blog.

Perhaps start a new thread? Looking forward to seeing it.

CBenson, I’ve taken your advice and I’ve started a post in the multi-leg forum.

Thanks for the support and interest.

From the documentation that is available for the ssc-32 I’ve understood you can just open a serial with the ssc-32 and use the following code:

   Serial.print("#0 P1500 T1000 <cr>");

And this will take the servo located at #0 to a value of 1500microseconds.
Am I taking my project too lightly or am I correct?

Almost! You will actually want to do:

     Serial.println("#0 P1500 T1000");

The SSC-32 needs to receive ASCII character 13 (carriage return) to find the end of the command. In the SSC-32 documentation, that character is represented by . In Arduino, you can either use “\r”, or you can just use println (instead of simply print) which automatically adds the carriage return character that’s needed.

Note that the third part (T1000) is optional and specifies the transition time in milliseconds.

We hope this helps.

1 Like

Awesome, this helps out great. Thank you for the fast response!

Hello. I would like to control my 10 DOF humanoid robot using ssc-32 and Botboarduino. I would like to control the ssc-32 from Botboarduino using the PS2 remote.

Thanks,
Iulian

That’s certainly possible. Do you have any specific questions?

Yes hello. I am new here and wish to attempt an ambitious humanoid robot. All I need to know is if I need any code in the Botboarduino to communicate to the SSC-32 using a ps2 controller.Please and thank you.

We don’t know of any code specifically for humanoid applications, but the SQ3 code does use a BotBoarduino to receive commands from a PS2 controller and send corresponding commands to the SSC-32 controller.

The code for the SQ3 is available here: