Micro SSC w/Arduino Power Up Issue

Recently received my Pololu micro serial servo controller. It is connected through TTL to Arduino UNO Rev3 to control 1 servo (9g micro) for now but plan on using 4 or more later. Reset line is connected.

After struggling with serial problems and learning how to send data to the micro SSC, the biggest issue turned out to be lack of power from the USB.

I was getting various combinations of LED’s lighting up depending on the method of power up. Best results were achieved by powering the Arduino and servo with the USB and waiting for 5 seconds before powering the Micro SSC.

I cobbled together this code that moves the servo up and down it’s usable range in adjustable steps and delays.

// Include the servo library to add servo-control functions:
#include <SoftwareSerial.h>
#define rxPin 11
#define txPin 12
// set up a new serial port
SoftwareSerial softSerial =  SoftwareSerial(rxPin, txPin);
// Arduino pin connected to Pololu Servo Controller
const int servoController = 1;  
// location of Servo plugged into Pololu Servo Controller (defaults 0-7)
const int servo0 = 0;  
int servo0Pos;

void setup() 
{
  pinMode(rxPin, INPUT);
  digitalWrite(txPin, HIGH); // keeps pololu board from getting spurious signal
  pinMode(txPin, OUTPUT);

  Serial.begin(9600); // data rate Serial monitor PC
  delay (1000);
  softSerial.begin(9600); //data rate Micro Servo controller
/*   Set Servo Speed using Pololu Servo Controller
*    servo = servo number (default 0-7)
*    speed = (1-127) (slowest - fastest) 0 to disable speed control
*/
servoSetSpeed(servo0,120);
}

void loop()                     
{
  int servoposition;   // Output value to the servo.
  for (int servoposition=1500; servoposition<4000;servoposition=servoposition+50) {  // Servopos 0 to 255
    servoMoveUp(servo0,servoposition);
    servo0Pos = servoposition;
    delay(500);
    serialPrint();
  }
  for (int servoposition=4000; servoposition>1500;servoposition=servoposition-50) {  // Servopos 0 to 255
    servoMoveDn(servo0,servoposition);
    servo0Pos = servoposition;
    delay(500);
    serialPrint();
  } 
}
    
void servoMoveUp(int servo, int pos) 
{
  if( pos > 4500 || pos < 500 ) return;   
  // Build a Pololu Protocol Command Sequence
  char cmd[6];
  cmd[0] = 0x80;  // start byte
  cmd[1] = 0x01;  // device id
  cmd[2] = 0x04;  // command number
  cmd[3] = servo; //servo number
  cmd[4] = lowByte(pos >> 7);   // lower byte
  cmd[5] = lowByte(pos & 0x7f); // upper byte
  // Send the command to the Pololu Servo Controller
  for ( int i = 0; i < 6; i++ ){
    softSerial.print(cmd[i]);
  }
}

void servoMoveDn(int servo, int pos)    
{
  if( pos > 4500 || pos < 500 ) return;   
  // Build a Pololu Protocol Command Sequence
  char cmd[6];
  cmd[0] = 0x80;  // start byte
  cmd[1] = 0x01;  // device id
  cmd[2] = 0x04;  // command number
  cmd[3] = servo; //servo number
  cmd[4] = lowByte(pos >> 7);   // lower byte
  cmd[5] = lowByte(pos & 0x7f); // upper byte
  // Send the command to the Pololu Servo Controller
  for ( int i = 0; i < 6; i++ ){
    softSerial.print(cmd[i]);
  }
}

void servoSetSpeed(int servo, int speed)
{
   // Build a Pololu Protocol Command Sequence
   char cmd[5];
   cmd[0] = 0x80;     // start byte
   cmd[1] = 0x01;     // device id
   cmd[2] = 0x01;     // command number
   cmd[3] = lowByte(servo);    // servo number
   cmd[4] = lowByte(speed);    // speed
  // Send the command to the Pololu Servo Controller
  for ( int i = 0; i < 5; i++ ){
      softSerial.print(cmd[i]);
   }
}
void serialPrint()
{  
  Serial.print("  servo: ");
  Serial.println(servo0Pos);
} 

What I noticed that tipped my off to a power problem is that while the controller was working, the Yellow LED was flashing brightly, the Green LED was flashing at the same frequency but a shorter duration and the Red LED was barely flickering. The LED’s were blinking at the same rate as the TTL softSerial.print.

Every once in a while it would just freeze and the Red LED would come on solid.

I connected a 5V 5Amp regulated power supply that I picked up at the surplus store yesterday to power everything. Works great. I just get the Green LED flashing. It’s been sitting here for over an hour moving the servo up/dn with no issues. MORE POWER!!!

The power up issue that I am having is that if I power up everything at the same time (no USB cable attached) the micro will have the Red LED on and the Green will flash @ 9600 baud. Cycling power to the micro will make it work fine.

@ 2400 and 4800 baud the Yellow LED is on and the Red LED flashes. Power cycle works.

Doesn’t seem to like anything > 9600 baud. Yellow LED on.

Removing the delay has no affect.

I could connect a relay to a digital pin that will interrupt the micro power for a few seconds after power up, but my design is short on digital pins.

OK, just figured it out. Apparently softSerial is the problem. I switched everything back to the standard serial and it starts up normally. Works 99% from 2400-36000 baud on the Serial.

So, next step is to troubleshoot the softSerial…

Attempted a fix that was suggested in another post:
https://forum.pololu.com/t/ussc-doesnt-work-after-reset/851/1&hilit=softwareserial

  pinMode(rxPin, INPUT);
  Serial.begin(9600); // data rate Serial monitor PC  
  delay (500);
  softSerial.begin(9600); //data rate Micro Servo controller
  digitalWrite(txPin, HIGH); // keeps pololu board from getting spurious signal
  pinMode(txPin, OUTPUT);

Did not help the problem.

Edited code to remove softSerial. Then I wake up at 3AM and start thinking why do I need a servoMoveUp and a servoMoveDn loop. They are doing the same thing. :blush:

// Arduino pin connected to Pololu Servo Controller
const int servoController = 1;  
// location of Servo plugged into Pololu Servo Controller (defaults 0-7)
const int servo0 = 0;  
int servo0Pos;

void setup() 
{

  Serial.begin(9600); // data rate Serial monitor PC  

/*   Set Servo Speed using Pololu Servo Controller
*    servo = servo number (default 0-7)
*    speed = (1-127) (slowest - fastest) 0 to disable speed control
*/
servoSetSpeed(servo0,120);
}

void loop()                     
{
  int servoposition;   // Output value to the servo.
  for (int servoposition=1500; servoposition<4000;servoposition=servoposition+50) {  // Servopos 0 to 255
    servoMove(servo0,servoposition);
    servo0Pos = servoposition;
    delay(500);
    serialPrint();
  }
  for (int servoposition=4000; servoposition>1500;servoposition=servoposition-50) {  // Servopos 0 to 255
    servoMove(servo0,servoposition);
    servo0Pos = servoposition;
    delay(500);
    serialPrint();
  } 
}
    
void servoMove(int servo, int pos) 
{
  if( pos > 4500 || pos < 500 ) return;   
  // Build a Pololu Protocol Command Sequence
  char cmd[6];
  cmd[0] = 0x80;  // start byte
  cmd[1] = 0x01;  // device id
  cmd[2] = 0x04;  // command number
  cmd[3] = servo; //servo number
  cmd[4] = lowByte(pos >> 7);   // lower byte
  cmd[5] = lowByte(pos & 0x7f); // upper byte
  // Send the command to the Pololu Servo Controller
  for ( int i = 0; i < 6; i++ ){
    Serial.print(cmd[i]);
  }
}

void servoSetSpeed(int servo, int speed)
{
   // Build a Pololu Protocol Command Sequence
   char cmd[5];
   cmd[0] = 0x80;     // start byte
   cmd[1] = 0x01;     // device id
   cmd[2] = 0x01;     // command number
   cmd[3] = lowByte(servo);    // servo number
   cmd[4] = lowByte(speed);    // speed
  // Send the command to the Pololu Servo Controller
  for ( int i = 0; i < 5; i++ ){
      Serial.print(cmd[i]);
   }
}
void serialPrint()
{  
//  Serial.print("  servo: ");
//  Serial.println(servo0Pos);
} 

Apparently this has been covered before. It just took me 3 weeks of searching to find the answer.

The Pololu Micro Serial Servo requires a reset (LOW) when using softwareSerial. I have the Micro reset pin connected to digital pin 3 on the Arduino.

I was hoping to avoid using this method since I did not have any available digital pins due to the LCD I was using. I have ordered a serial backpack for my LCD to free up 4 pins.

#include <SoftwareSerial.h>
#define rxPin 12
#define txPin 13
// set up a new serial port
SoftwareSerial softSerial =  SoftwareSerial(rxPin, txPin);
const int rstPin = 3; // Reset Pololu

void setup()
{
 // Initialize SoftSerial 
  pinMode(rxPin, INPUT);
  digitalWrite(txPin, HIGH); // keeps pololu board from getting spurious signal
  pinMode(txPin, OUTPUT);
  // start serial port
  Serial.begin(9600);
  Serial.println("The Midway Zone Heat Control");
  delay(1000);
  softSerial.begin(28800); //data rate Micro Servo controller
  pinMode(rstPin, OUTPUT); // it is a LOW impedance so it sinks the reset line
  delay(10);
  pinMode(rstPin, INPUT); // it is pulled HIGH by this digitalWrite(txPin, HIGH); 
  delay(10);
}

The second problem that I encountered was that softwareSerial will not use non-standard baud rates. Its’ supported baud rates are 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 31250, 38400, 57600, and 115200.

Works perfectly after code changes, power up and resets. Call it [RESOLVED]

Hello. I am glad you were able to solve your problem, and thanks for posting the solution. For future designs, you might consider one of our Maestro servo controllers, which should not need to be reset in this situation: pololu.com/catalog/product/1351

–David