Ssc32UsbServoController

javadoc

Read the manual

Power it Up
This is the power related pins.  The servo pins are in two banks. You can isolate 3 power sources.
The power can be attached to :

  • VS1 - servos 0 through 15
  • VS2 - servos 16 trhough 31
  • VL - logic chips

Jumper allow you to combine the power sources - so that you only need one power source to power everything.  Sometimes with power isolation, you can protect or keep signals clean.  The pins and jumpers allow you flexability.

Since I'll just be doing diagnostics and software, I'll be shorting the VL jumper and running it all on a single PSU 5V line.

The original configuration did not have a jumper on VS VL - so I added one. In the picture below, its the jumper with the red square around it.

 

Connect USB

Connect the usb cable.  Its a FTDI chip at the core ... good old serial over usb.

Communication

It's all about communication.  The ssc-32u has an interesting way to set the baud rate.  

Baud
The SSC­32U is shipped with a default Baud rate of 9600. It also supports setting Baud rate
using the onboard push button. To set the Baud rate:
1. Press and hold the button. At first the LEDs will glow to indicate the current Baud rate.
a. 9600 (green)
b. 38400 (red)
c. 115200 (both green and red)
d. Non­standard Baud rate (no LEDs)
2. After 2 seconds the LEDs will start to alternate, indicating you can change the Baud rate.
3. Release the button.
4. Press the button to cycle through baud rates outlined in step 1.
5. Once you have selected the Baud rate you want, do nothing; after 5 seconds the LEDs
will return to normal mode and the new baud rate will be written to EEPROM.
 

#file : service/Ssc32UsbServoController.py edit raw
import org.myrobotlab.service.Serial as Serial

port = "COM12"

ssc = Runtime.start("ssc", "Ssc32UsbServoController")

# connect to port with "default" 9600
# ssc.connect(port)
# you can change baud rate with instructions here
# http://myrobotlab.org/service/ssc32usbservocontroller
# i changed my baud rate to 115200
ssc.connect(port, Serial.BAUD_115200)

#grab serial if you want
serial = ssc.getSerial()

# make a servo
servo = Runtime.start("servo", "Servo")

# set its pin
servo.setPin(27) 

# attach a servo !
ssc.attach(servo)

# servo.setVelocity(10)
# move it around
servo.moveTo(0)
sleep(1)
servo.moveTo(90)
sleep(1)
servo.moveTo(180)
sleep(1)
servo.moveTo(10)
sleep(1)
# disable it
servo.disable()
# try to move it - it wont move
servo.moveTo(180)
sleep(1)
# re-enable it - it should move now
servo.enable()
servo.moveTo(10)
sleep(1)
servo.moveTo(160)

# detach it
ssc.detach(servo)

For a 180 degree servo:

  • 500us long pulse (0.5ms) at 5V rotates the servo to -90 degrees
  • 1500us pulse (1.5ms) sets the servo at 0 degrees.
  • 2500us long pulse (2.5ms) at 5V rotates the servo to +90 degrees

Thank you Grog. An example for starting your servos on power up:

The below serial.write command will postion the servos on pins 0, 1, and 2 to the positions they should be to begin. This will initialise the servos and prep them for operation. Remember to change the position values to what your servos need to be set at.

serial = Runtime.start("serial","Serial")
serial.connect("/dev/ttyUSB0", 115200, 8, 1, 0)
serial.write("#0P800 #1P1500 #2P1100 \r")

Once the servos have been initialised and set to their starting positions, you can then give more detailed commands to the servo controller, such as speed or timing if commanding a group of servos on a single line.

This will help to prevent any major jumps in the servos that could possibly damage them.

# = pin/channel to which the servo is connected (0 - 31)

P = desired pulse width (position) (normally 500 to 2500) in microseconds

S = servo movement speed in microseconds per second

T = time in microseconds to travel from the current position to the desired position. This affects all servos in a group, so they all reach their desired positions at the same time. Handy for group movements such as walking.

\r = carriage return

PO = Position Offset - You have your servo attached and ready to go, but you find what should be center, e.g. 1500... is not exactly center... you can set the PO for that servo to center it at the beginning of your script and for the duration the controller is powered it will remember that to center that servo when the position 1500 is used, it should be offset be however many degrees, up to about 15 degrees.

References :

Examples:


#file : service/Ssc32UsbServoController.py edit raw
import org.myrobotlab.service.Serial as Serial

port = "COM12"

ssc = Runtime.start("ssc", "Ssc32UsbServoController")

# connect to port with "default" 9600
# ssc.connect(port)
# you can change baud rate with instructions here
# http://myrobotlab.org/service/ssc32usbservocontroller
# i changed my baud rate to 115200
ssc.connect(port, Serial.BAUD_115200)

#grab serial if you want
serial = ssc.getSerial()

# make a servo
servo = Runtime.start("servo", "Servo")

# set its pin
servo.setPin(27) 

# attach a servo !
ssc.attach(servo)

# servo.setVelocity(10)
# move it around
servo.moveTo(0)
sleep(1)
servo.moveTo(90)
sleep(1)
servo.moveTo(180)
sleep(1)
servo.moveTo(10)
sleep(1)
# disable it
servo.disable()
# try to move it - it wont move
servo.moveTo(180)
sleep(1)
# re-enable it - it should move now
servo.enable()
servo.moveTo(10)
sleep(1)
servo.moveTo(160)

# detach it
ssc.detach(servo)

dom14's picture

In the same

In the same idea...

http://www.robot-electronics.co.uk/htm/sd84tech.htm

GroG's picture

Do you have that one Dom ?

Do you have that one Dom ?

dom14's picture

No sorry. When i start

No sorry.

When i start InMoov, i would like use it. 

But after reflection arduino was easier because well integrated MRL.

Dom.

ShaunHolt's picture

Something else to order. 

Something else to order.  Thanks for sharing that link.

ShaunHolt's picture

#!/usr/bin/python # Import

#!/usr/bin/python
# Import the Serial module
import serial;

EOL = "\r";
command = "";

# Set the SSC-32 port - e.g. "COM1:" for Windows, "/dev/ttyS0" for Linux
SSC32_Port = "/dev/ttyUSB0";

ServoOne = 0;
ServoOneStop = 1520;

ServoTwo = 1;
ServoTwoStop = 1525;

ServoThree = 2;
ServoThreeCenter = 1530;
ServoThreeMin = 2150;
ServoThreeMax = 900;

ServoFour = 3;
ServoFourCenter = 1430;
ServoFourMin = 500;
ServoFourMax = 1550;

# Reads single characters until a CR is read
def Response (port):
   ich = "";
   resp = "";

   while (ich <> '\r'):
      ich = port.read(1);
      
      if (ich <> '\r'):
         resp = resp + ich;
   return resp;
      
# Wait for a servo move to be completed
def Wait_for_Servos (port):
   
   ich = "";
   
   while (ich <> "."):
      Send_Command (port, "Q", True);
      
      ich = port.read(1);
   
   return;

# Send EOL to the SSC-32 to start a command executing
def Send_EOL (port):

   result = port.write(EOL);
   
   return result;

# Send a command to the SSC-32 with or without an EOL
def Send_Command (port, cmd, sendeol):
   
   result = port.write (cmd);
   
   if (sendeol):
      Send_EOL (port);
   
   return result;
   
#   Open the port at configured Bps - defaults to 8N1
ssc32 = serial.Serial(SSC32_Port, 9600);

#   Motors All Stop - Left = Ch0, Right = Ch1
command = "#" + str(ServoOne) + " P" + str(ServoOneStop) + " #" + str(ServoTwo) + " P" + str(ServoTwoStop);
Send_Command (ssc32, command, True);

Wait_for_Servos (ssc32);

#   Home the PING Pan/Tilt Base
command = "#" + str(ServoThree) + " P" + str(ServoThreeCenter) + " #" + str(ServoFour) + " P" + str(ServoFourCenter);
Send_Command (ssc32, command, True);

Wait_for_Servos (ssc32);

#   Send the version command
command = "ver";
Send_Command (ssc32, command, False);
Send_EOL (ssc32);

#   Read the response
inp = Response(ssc32);

#   Show what we got back
print inp;

command = "#" + str(ServoThree) + "P1900" + "#" + str(ServoFour) + "P1300 T5000"
Send_Command (ssc32, command, True);

Wait_for_Servos (ssc32);

#   Close the port
ssc32.close();