Pololu Robotics & Electronics
Menu
My account Comments or questions? About Pololu Contact Ordering information Distributors

Pololu Forum

Mini maestro12 hang

I use mini Maestro 12 to control the servo motor.
Set up USB dual port and connect to raspberry with USB cable.

When I continue to control the motor, the mini masestro12 green LED is lit (not blinking but steady) for 10 to 30 seconds.
In the meantime, the motor does not move. (The order continues through Raspberry Pie.)
After 10 to 30 seconds, the green LED will blink and the motor will move.

I want to know why the green LED is on.

Hello.

The green LED’s behavior is described in the “Indicator LEDs” section of the user’s guide. What software are you using to control the Maestro?

What are the yellow and red LEDs doing when you try to use the Maestro? Could you post some pictures of your system with a description about how everything is connected and powered?

-Patrick

I run 10 servo using mini maestro12.
Mini maestro12 connected to Raspberrypi USB and powered from Li-ion 3S Battery(use regulated to 5v).

I use your code “https://www.pololu.com/docs/0J40/5.h.1” and
speed, accelerate, Set Multiple Targets ,100-200ms interval. ( 10 servo continuously use)
I use USB Dualport and ttyACM0.

I already know green LED role is USB connection.
I wonder why servos stop, condition below.

sample (sudocode)

setInterval(function(){ // 300ms interval run (javascript)

 I make servo runfile using your code.
 [servo run1]
 set speed 100 100 100 100 100 100 100 100 100 100
 set acceleration 100 100 100 100 100 100 100 100 100 100 100
 set Multi target  0 0 0 0 0 0 0 0 0 0

 setTimeout(funciton(){ //100ms interval run(javascript)
   [servo run2]
   set speed 10 10 10 10 10 10 10 10 10 10
   set acceleration 10 10 10 10 10 10 10 10 10 10 10
   set Multi target  50 50 50 50 50 50 50 50 50 50
}, 100);

}, 300);

servo run1 100ms servo run2 200ms servo run1 100ms …

greenLed blink , yellow blink - servo moving (30min ~ 5hour)
greenLed Turn on steadily, yellow blink - servo not moving (10-30s) - command continuosly
greenLed blink, yellow blink - servo moving (30min ~ 5hour)

We suspect that your code is not sending any commands to the Maestro during the times when the green LED is on and the motor is not moving. What steps have you taken to debug your code and verify that it is actually sending commands? Can you simplify your code down to the simplest thing that should work, but does not, and then post that code here?

-Patrick

I post some of my code. Commands continue to be delivered at fixed intervals.
When the green LED is blinking, the motor operates normally.
But, the greenLED stays on, the motor does not run. (command continue)
Again I say, I would like to know the difference between the blinking state and steady state of the greenLED.
If the motor is temporarily not running for 10-30 seconds while the greenLED stays on, the greenLED will return to blinking, then motor start running.
So I think the It is problem that greenLED stays on. I wonder If it result from timing or high load.

Also, When controlling the motor through the maestro center, there is a situation where the force is released to the motor if it is applied a weak force.
Please answer this too.
Answer whether there is a situation where the motion is released when the motor is moved to a position. This situation can be thought of as a different situation, but this also remains greenLED on. Check it.

// Main Source

setInterval(function(){
   console.log('one');
   exec('servo speed all 20 40 50 20 20 10 20 40 50 20');
    exec('servo accelerate all 10 10 10 10 10 10 10 10 10 10');
    exec('servo multitarget 0 0 0 0 0 0 0 0 0 0');

    setTimout(function(){
      console.log('two');
      exec('servo speed all 20 40 50 20 20 10 20 40 50 20');
      exec('servo accelerate all 10 10 10 10 10 10 10 10 10 10');
      exec('servo multitarget 50 0 200 100 200 100 50 0 200 100');
    }, 200);
}, 400);

//servo.c

int SetMultiTarget(int fd, int* pTarget)
{
  int idx = 0;
  int length = (3 + (20)) * sizeof(unsigned char);
  unsigned char* command = (unsigned char*) malloc(length);
  memset(command, 0, length);

  command[idx++] = 0x9F;
  command[idx++] = 10;
  command[idx++] = 0;

  for (int ch = 0;ch < 10;ch++) 
  { 
    unsigned short max = (1500 + motor_range[ch]) * 4;
    unsigned short min = (1500 - motor_range[ch]) * 4;
    unsigned short target = (unsigned short)((motor_pos[ch] + motor_offset[ch] + 1500)* 4); 

    if(target > max){
      target = max;
      printf("Warn > Target value change to [%d]:%d\n", ch, motor_range[ch]);
    }
    if(target < min){
      target = min;
      printf("Warn > Target value change to [%d]:%d\n", ch, 0 - motor_range[ch]);
    }

    command[idx++] = target & 0x7F;
    command[idx++] = target >> 7 & 0x7F;
  }

  if (write(fd, command, length) == -1)
  {
    printf("error writing");
    return -1;
  }
  free(command);
  command = NULL;
  return 0;
}

int SetSpeed(int fd, unsigned char channel, unsigned short speed)
{
  unsigned char command[] = {0x87, channel, (unsigned char)(speed & 0x7F), (unsigned char)(speed >> 7 & 0x7F)};
  if (write(fd, command, sizeof(command)) == -1)
  {
    printf("error writing");
    return -1;
  }
  return 0;
}

int SetAcceleration(int fd, unsigned char channel, unsigned short value)
{
  unsigned char command[] = {0x89, channel, (unsigned char)(value & 0x7F), (unsigned char)(value >> 7 & 0x7F)};
  if (write(fd, command, sizeof(command)) == -1)
  {
    printf("error writing");
    return -1;
  }
  return 0;
}

...
int main(){
int` `fd = open(device, O_RDWR | O_NOCTTY);
...
switch(argv[1][0])
  {
    case 'm':
    {
      int* pPos = (int *) malloc(sizeof(int)*10);
      memset(pPos, 0, sizeof(int)*10);
      for(i = 0; i < 10;i++)
      {
        pos = atoi(argv[i+2]);
        pPos[i] = pos;
      }
      
      SetMultiTarget(fd, pPos);
      free(pPos);
      pPos = NULL;
      break;
    }
    case 'a': // acceleration
    {
      if(!strncmp(argv[2], "a", 1)) // all
      {
        for (i = 0; i < 10; i++)
          SetAcceleration(fd, i, atoi(argv[i+3]));
      }
      else 
      {
        channel = atoi(argv[2]);
        SetAcceleration(fd, channel, atoi(argv[3]));
        usleep(5000);
      }
      break;
    }
    case 's': // speed
    {
      if(!strncmp(argv[2], "a", 1)) // all
      {
        for (i = 0; i < 10; i++)
          SetSpeed(fd, i, atoi(argv[i+3]));
      }
      else 
      {
        channel = atoi(argv[2]);
        SetSpeed(fd, channel, atoi(argv[3]));
        usleep(5000);
      }
      break;
    }


...
}

The green LED blinks when there is USB activity. It stays on when there is a USB connection but no USB activity which is why we think your code is not sending any commands to the Maestro. How have you verified that commands are being delivered at fixed intervals when the green LED stays on?

It would be very difficult (perhaps even impossible) to troubleshoot the code you posted since it is complicated and incomplete. If you want our help troubleshooting your code, then you should try to drastically simplify it until you have found the least complicated program where you experience the hanging issue.

I think we should focus on this hanging issue before trying to address other problems.

-Patrick