eytan
Posts: 13
Joined: Mon Jan 26, 2015 1:01 am
Location: Ottawa Canada

Controlling SSC-32 servo controler board with RPi

Wed Feb 18, 2015 2:07 am

Hello. I have a Lynxmotion robotic arm with the SSC-32 servo controller board. I have previously written an Arduino program to control it with a PS3 controller. I would now like to have it controlled by the RPi. In my current RPi configuration , I have the RPi controlling an Arduino Uno via USB and NANPY. This works very well for me to control my 12V scooter motors and other sensors etc. on my "robot". My question is how do I get the SSC-32 and the Arduino both to work with the RPi ? Both the Arduino and the SSC-32 use serial communication. Won't this be a conflict ?

User avatar
joan
Posts: 14935
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Controlling SSC-32 servo controler board with RPi

Wed Feb 18, 2015 8:07 am

The Pi has one UART (gpio 14/15). However you can use serial USB dongles if you need another serial link.

Remember the Pi gpios (including the UART) are 3V3 and so won't cope with 5V as an input. Of course a USB serial dongle doesn't have this restriction.

eytan
Posts: 13
Joined: Mon Jan 26, 2015 1:01 am
Location: Ottawa Canada

Re: Controlling SSC-32 servo controler board with RPi

Wed Feb 18, 2015 3:38 pm

Thanks for the response Joan.
So I assume from your post, that I can in fact have 2 serial links simultaneously and output to each one separately.
One link to my arduino ( via USB ) and one to my SSC-32 ( via USB-Serial adapter ).

User avatar
joan
Posts: 14935
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Controlling SSC-32 servo controler board with RPi

Wed Feb 18, 2015 4:28 pm

eytan wrote:Thanks for the response Joan.
So I assume from your post, that I can in fact have 2 serial links simultaneously and output to each one separately.
One link to my arduino ( via USB ) and one to my SSC-32 ( via USB-Serial adapter ).
Yes, you can have as many USB serial dongles as you care to plug in to the Pi (or USB hubs) and one serial link connected to the Pi's UART pins.

eytan
Posts: 13
Joined: Mon Jan 26, 2015 1:01 am
Location: Ottawa Canada

Re: Controlling SSC-32 servo controler board with RPi

Thu Feb 19, 2015 6:38 pm

OK so I have my USB - Serial cable and I'm trying to communicate to the SSC-32.
when I type: ls - l /dev/ttyUSB*
the response is : rw-rw---T 1 root dialout 188, 0 Feb 19 13:20 /dev/ttyUSB0

do I have to set the port up ?
when I try a python program the SSC-32 is doing nothing at all.

I tried a simple prog like :

import serial
import sys
import time

ssc32 = serial.Serial('/dev/ttyUSB0, 115200, timeout=1.0);
print("start")
ssc32.write("#1 P1500")
time.sleep(2)
ssc32.write("#1 P1600 T2000")
print("end")
ssc32.close()



I get the text output but the ssc32 does nothing.
Thx

eytan
Posts: 13
Joined: Mon Jan 26, 2015 1:01 am
Location: Ottawa Canada

Re: Controlling SSC-32 servo controler board with RPi

Thu Feb 19, 2015 9:02 pm

Ok, so after a few hours of quality time with my Pi ( NOT ) I noticed that the green light on the SSC-32 would blink a two separate times at appropriate time separations. This was telling me that the SSC-32 was getting the commands.
I was getting no errors, just to movement.
Well after the 3rd or 4th time reading the pdf manual for the SSC-32 I noticed the reference to the requirement of a <cr> after the command.
I had assumed this was only if you were using a command promp.

Well I tried everything elso , so I decided to change my command lines to :
ssc32.write("#1 P1500 <cr>")
ssc32.write("#1 P1600 T2000 <cr>")


Guess what ? It worked ! :D
The wierd thing is that you don't need the <cr> if you are running from an Arduino, but apparently you do with a Pi !?
Anyway, hopefully this helps someone else from wasting precious time.

User avatar
joan
Posts: 14935
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Controlling SSC-32 servo controler board with RPi

Thu Feb 19, 2015 9:09 pm

Oh dear.

The Arduino write probably automatically adds a line feed.

eytan
Posts: 13
Joined: Mon Jan 26, 2015 1:01 am
Location: Ottawa Canada

Re: Controlling SSC-32 servo controler board with RPi

Thu Feb 19, 2015 11:34 pm

Yes, I just checked. On my Arduino code I used println on the last command. Duhhhh. So much to remember :oops:

Ok, so here's another update on the fix.

After I reported everything was working, it stopped working.
Then I had to figure out why.
I went to a previous program revision to compare.
While trying to get something to work orriginally, I had taken some code lines from this post :
http://www.robotshop.com/forum/ssc-32-u ... y-pi-t8678

so the line that I took out which caused the problem was :
ssc32.write("rev\r")
well I didnt know why this was required.
If I take out the <cr> servos fail to move even with the rev\r command.
well this was driving me a little crazy until I learned that \r is "return"
so now instead of <cr>, just use \r as per the following example line.

ssc32.write("#1 P1600 T2000 \r")

KubakA
Posts: 2
Joined: Wed Jun 24, 2015 7:07 pm

Re: Controlling SSC-32 servo controler board with RPi

Wed Jun 24, 2015 7:10 pm

OMG! Thank you so much, i registered just to thank you this \r addition to the command. Finally it works on Edison with a Veyron servo driver. :D Thanks again!

KubakA
Posts: 2
Joined: Wed Jun 24, 2015 7:07 pm

Re: Controlling SSC-32 servo controler board with RPi

Wed Jun 24, 2015 7:21 pm

eytan wrote:Yes, I just checked. On my Arduino code I used println on the last command. Duhhhh. So much to remember :oops:

Ok, so here's another update on the fix.

After I reported everything was working, it stopped working.
Then I had to figure out why.
I went to a previous program revision to compare.
While trying to get something to work orriginally, I had taken some code lines from this post :
http://www.robotshop.com/forum/ssc-32-u ... y-pi-t8678

so the line that I took out which caused the problem was :
ssc32.write("rev\r")
well I didnt know why this was required.
If I take out the <cr> servos fail to move even with the rev\r command.
well this was driving me a little crazy until I learned that \r is "return"
so now instead of <cr>, just use \r as per the following example line.

ssc32.write("#1 P1600 T2000 \r")
Maan I registered just to thank you, with \r on the end of the command the servos finally moved! I just make it with an Edison + a Veyron servo driver. Anyway thanks again!:)

eytan
Posts: 13
Joined: Mon Jan 26, 2015 1:01 am
Location: Ottawa Canada

Re: Controlling SSC-32 servo controler board with RPi

Thu Jun 25, 2015 12:22 pm

Very glad my post helped you. It's always great when you can save someone else a few hours of banging their head against a monitor :D

christophvde
Posts: 1
Joined: Tue Jan 30, 2018 10:45 am
Location: Belgium

Re: Controlling SSC-32 servo controler board with RPi

Tue Jan 30, 2018 10:52 am

Hi,

I registered in hopes of still getting an answer for the following problem after these couple of years.

My situation is as follows:

Setup works, I have communication between Pi and SSC-32 controller. The servo's are responding but....

They don't seem to move to the commanded position. They do move in that direction but it seems that the write sequence doesn't stick long enough. Instead they just jerk around a bit :oops:

Any suggestions on how to proceed with this?

Code: Select all

#!/usr/bin/python

import serial
import sys
import time

ssc32 = serial.Serial('/dev/ttyUSB0',115200,timeout=1.0);
print('start')
while True:
    ssc32.write("#1 P1500 \r")
    time.sleep(2)
    ssc32.write("#1 P2000 \r")
    time.sleep(2)

Return to “General discussion”