Serial 8-Servo Controller Recvs data but no servo movement?

Hi,

I seem to be killing my servo controllers & need some help to understand why.

I have a simple perl/TK program that happily used to move servos no problem. I altered the program & seemed to instantly kill the controller. I changed my code back, the green light still flashes to show that commands are arriving, however there is now no servo movement ?

Is it possible to damage the controller by passing incorrect commands ? This is the second one I have brought & my robot is not even started yet :frowning:

Any info you can provide, much appreciated.

Many thanks,
Darren

You can’t damage your servo controller with bad serial commands alone, so that’s not the problem. Like all electronics, your servo controller can be physically or electrically damaged, but there is no serial packet that would cause it to self-destruct.

My guess would be that something is still different from when your servos were moving, either in your software or your physical setup. Can you think of anything else that could have changed? I tend to suspect software, since you were making software changes. Can you look at actual serial bytes you’re sending out now, either with a serial port monitoring program or by looping back to a second serial port? It may be something you didn’t realize you were changing, serial port settings for example.

If you aren’t able to track down the problem, the users of this forum can help with a little more information:

The code you’re using now (although I personally am not familiar with perl).
Which servo controller are you using?
Are you trying to use Pololu mode or MiniSSC-II mode?
What wiring connections are you making?
What is your power source/sources?
What sort of computer and serial interface are you using to communicate with the controller?
Did you revert to a previous saved version of your working code, or undo the change you made manually?
How many servos are you testing with and what are they doing (i.e. spinning free or working hard against a load)?

Good luck,

-Adam

P.S. You said this was the second servo controller you had purchased, what happened to the first one?

Hi, thanks nexisnet :slight_smile:

Ok, I reverted to previously saved code that I know works ( Will post here very soon ). I also checked the servo controller against the sample code ssc-tester from this site. The sample code worked with my controller, then it worked with my original code, then it went awry with my new code so I removed all power & re-tried with the sample code & my old code but the controller still does not work.

The controller is the Pololu 8-Servo controller (SSC04A), I brought my first one a few months ago, inflicted this weird behaviour on it last week & have since brought a new one which is now exhibiting exactly the same behaviour - Was initially ok with old code.

I am using just 1 servo under no load.
I have separate power running to the controller & the servo.
When I power on the controller I get a solid orange light until the baud is detected ( 9600 ) - I then get flashing green as commands are sent to the controller - but no servo movement ( This is same no matter if I use the pololu sample code or my own working code ).
Controller is in pololu mode.
I’m using a windows XP PC with cygwin when running the sample code & I use a Linux Redhat AS3 PC when running the perl code - I intend to install linux onto a laptop & use this in my robot tamiya clodbuster :slight_smile: - when I get the controller working :frowning:

Many thanks,
Darren Chambers

Hello,

You might have inadvertently set the servo numbers to a different value so that a servo controller that responded to number 0-7 might now respond to 8-15 or something else.

You can try setting the numbers back to 0-7, (send 0x80, 2, 0 in Pololu mode). Another thing you can try is to use Mini SSC II mode and send any command. All servos (other than the one you sent the command to) should go to their neutral positions (since there is no “off” option in that protocol).

- Jan

Hi Jan, I’ll try that in just a tick. Meanwhile here is exactly what happened:

I used this code successfully:

#!/usr/bin/perl
use Tk;
use vars qw( $OS_win $ob $file );

BEGIN {
        $OS_win = ($^O eq "MSWin32") ? 1 : 0;
        if ($OS_win) {
            eval "use Win32::SerialPort 0.11";
            die "$@\n" if ($@);
        }
        else {
            eval "use Device::SerialPort";
            die "$@\n" if ($@);
        }
} # End BEGIN

$file = 'tpj4.cfg';

if ($OS_win) {
    $ob = Win32::SerialPort->start ($file);
}
else {
    $ob = Device::SerialPort->start ($file);
}
die "Can't open serial port from $file: $^E\n" unless ($ob);

my $baud = $ob->baudrate;
print "baud from configuration: $baud\n";
# Centre servo & slider
servo(0,3000);


$MW = MainWindow->new;
$hello = $MW->Button (  -text => 'Reset',
                        -command => [\&servoReset,0,3000]);
$bar = $MW->Scale ( -orient => horizontal,
                        -width => 20,
                        -length => 200,
                        -from => 500,
                        -to => 5500,
                        -variable => \$variable,
                        -command => [ \&servo, $variable]
);

$hello->pack;
$bar->pack;

set $bar 3000;
MainLoop;

sub servo {
my $pos = $_[1];
my $position=sprintf ('%.0f', $pos/128);
my $pack = pack "CCCCCC", 128, 1, 4, 0, $position, 0;
print "Position: $position\n";
$ob->write($pack);
undef $pack;
return
}

sub servoReset {
my $pos = $_[1];
print "$pos\n";
set $bar $pos;
my $position=sprintf ('%.0f', $pos/128);
my $pack = pack "CCCCCC", 128, 1, 4, 0, $position, 0;
print "Position: $position\n";
$ob->write($pack);
undef $pack;
return
}
print "baud from configuration: $baud\n";

undef $ob;

==== End of Script ====

I then altered the sub routine ‘servo’:
my $pack = pack “CCCCCC”, 128, 1, 4, 0, $position, 0;
to
my $pack = pack “CCCCCC”, 128, $servonumber, 4, 0, $position, 0;

And passed a servo number so that I could use the same routine for more than one servo. The controller has not worked since :frowning:

I’ll go try your suggestion.

Many thanks,
Darren

Nice one,

That seems to have fixed it :smiley: :smiley: :smiley:
Now I have 2 working controllers !

Nose picking robo clodbuster here we come :wink:

Many many thanks,
Darren

Hello.

I can immediately see a problem with this change that could have caused the problem Jan suggested: the second byte of the command packet is the device ID, not the servo number. This second byte should always be 1 unless you are trying to change the servo numbers to which the device responds, in which case it should be 2. The servo-number byte is byte 4:

my $pack = pack “CCCCCC”, 128, 1, 4, $servonumber, $position;

Note that when using the 7-bit absolute position command, you do not need to send the second data byte.

- Ben

Thanks for all the help guys. Everything is working nicely now.

Cheers,
Darren