Page 1 of 3 123 LastLast
Results 1 to 10 of 26

Thread: baby steps with the pololu servo controller

  1. #1

    baby steps with the pololu servo controller

    Hello all,

    So I finally had time to start playing with the pololu servo controller.

    I hooked it up to a Linux box (both on a serial port, and a serial port via USB), but I don't get much response. (none actually)

    I see the orange light go out when I send something (and come back on) when connected via a USB emulated serial port (so it is getting something).

    what is the command set? (Is there a "hello, is there anybody out there?" command? that prints a version number or so?

    any examples? (preferably in C?)

  2. #2

    Re: baby steps with the pololu servo controller

    The command set is in the pololu servo controller manual
    http://www.pololu.com/file/0J38/ssc04a_guide.pdf

  3. #3

    Re: baby steps with the pololu servo controller

    Quote Originally Posted by MikeG View Post
    The command set is in the pololu servo controller manual
    http://www.pololu.com/file/0J38/ssc04a_guide.pdf
    Right, I have the manual, but wondering if there was more.

    So I am doing this:

    cmd[0] = 0x80; // synchronization value (always 0x80 for pololu)
    cmd[1] = 0x01; // device type always 0x01
    cmd[2] = 0x04; // set position
    cmd[3] = 0x00; // first servo
    cmd[4] = 0x0B; // set to 3000, high = 0x0B
    cmd[5] = 0xB8; // low = 0xB8
    cmd[6] = 0x00;

    cmd being an unsigned char cmd[16];

    That should put the 1st servo in 'neutral' correct?

  4. #4
    Join Date
    May 2008
    Posts
    2,228
    Images
    155
    Rep Power
    123

    Re: baby steps with the pololu servo controller

    Just checking, you've got the jumpers correct, right?

    -Fergs

  5. #5
    Join Date
    Nov 2009
    Location
    Newfoundland, Canada (if anyone lives here, send me a messsage!)
    Posts
    4
    Rep Power
    0

    Re: baby steps with the pololu servo controller

    I'm not sure what the command structure for the Pololu mode is, so I'm not sure what the problem is there. But if you want to troubleshoot any connetion problems first, change the jumper to the Mini-SCII mode (I'm assuming you have an 8-channel version controller?) and enter the basic control mode, which for centered is;

    1st = 0x00 (initialize)
    2nd = 0x00 (device #) (device is 1st, therefore named zero)
    3rd = 0x80 (position)

    If you try this (if this is completely correct, check your manual, I'm not sure since I haven't used mine in a while ), and your still not getting anything out, then it's your connection, so maybe try another serial source? Different baud rate?

    If this works then it's just the Pololu mode code not receiving properly, if it receives properly it should flash the green light during transmission.

    Hope this helps, but it would be really useful to find out which controller your trying to send the commands to?
    "MACHINES SHALL RULE THIS WORLD! FEAR THE MECHANICALS, FLESH-CREATURE, FOR YOUR DOOM IS NIGH!" ~TheDemonToaster~

  6. #6

    Re: baby steps with the pololu servo controller

    Quote Originally Posted by lnxfergy View Post
    Just checking, you've got the jumpers correct, right?

    -Fergs
    Yes I have the jumpers correct. I hooked it up to a windows 7 box. I can "center" the servo, but not make it move anywhere else.

    On Linux I am still trying to figure if it isn't the port settings BUT I do see the orange light go on and off (off when I access the port)

  7. #7

    Re: baby steps with the pololu servo controller

    Quote Originally Posted by Formori View Post
    I'm not sure what the command structure for the Pololu mode is, so I'm not sure what the problem is there. But if you want to troubleshoot any connetion problems first, change the jumper to the Mini-SCII mode (I'm assuming you have an 8-channel version controller?) and enter the basic control mode, which for centered is;

    1st = 0x00 (initialize)
    2nd = 0x00 (device #) (device is 1st, therefore named zero)
    3rd = 0x80 (position)

    If you try this (if this is completely correct, check your manual, I'm not sure since I haven't used mine in a while ), and your still not getting anything out, then it's your connection, so maybe try another serial source? Different baud rate?

    If this works then it's just the Pololu mode code not receiving properly, if it receives properly it should flash the green light during transmission.

    Hope this helps, but it would be really useful to find out which controller your trying to send the commands to?

    I will try that, thanks. I do have the pololu 8 port servo controller. I'll try to set it in that other mode. and see what happens.

    thanks!

  8. #8

    Re: baby steps with the pololu servo controller

    I guess your USB to serial adapter is working since it works in Windows? Your using the Pololu Mode? The suggestion above was to use SSCII mode. Have you tried that? (Edit: late on the post)

    According to the manual the protocol is 8N1. Did you setup the serial port correctly? It's hard to help because you have not give much information. We are all just guessing. How about posting all your code.
    Last edited by MikeG; 01-17-2010 at 09:36 PM. Reason: late on the post

  9. #9

    Re: baby steps with the pololu servo controller

    here's the code:
    (I am still working on getting things in the other mode) (and I switched the DTR/RTS jumper to CTS

    Code:
    #include <sys/types.h>
    #include <sys/stat.h>
    #include <fcntl.h>
    #include <termios.h>
    #include <stdio.h>
    #include <stdlib.h>
    #include <strings.h>
     
    #define BAUDRATE        B38400
    #define DEVICE          "/dev/ttyUSB0"
    #define _POSIX_SOURCE   1               /* POSIX compliant source */
     
    main()
    {
    int fd,c, res;
    struct termios oldtio,newtio;
    unsigned char cmd[16]; 
     
    fd = open(DEVICE, O_RDWR | O_NOCTTY );      // avoid controll chars
     
    if (fd <0)
       {
       perror(DEVICE);
       exit(-1);
       }
     
    tcgetattr(fd,&oldtio);                          // save current port settings
    bzero(&newtio, sizeof(newtio));                 // clear struct for new port settings */
    //  these settings come from the pololu site
    newtio.c_iflag = 0;
    newtio.c_lflag = 0; 
    newtio.c_oflag = 0;
    newtio.c_cflag = BAUDRATE | CS8 | CLOCAL;
    newtio.c_cc[VTIME] = 0; 
    newtio.c_cc[VMIN]  = 1; 
     
    // flush and apply settings
    tcflush(fd, TCIFLUSH);
    tcsetattr(fd, TCSANOW, &newtio);
     
    cmd[0] = 0x80;  // synchronization value (always 0x80 for pololu)
    cmd[1] = 0x01;  // device type always 0x01
    cmd[2] = 0x04;  // set position
    cmd[3] = 0x00;  // first servo
    cmd[4] = 0x0b;  // set to 3000,  high = 0x0B
    cmd[5] = 0xb8;  //               low  = 0xB8
    cmd[6] = 0x00;
     
    res = write(fd, cmd, 6);
    if (res != 6)
       printf("Error writing to %s\n", DEVICE);
     
    sleep(3);
     
    /* restore the old port settings */
    tcsetattr(fd,TCSANOW,&oldtio);
    }

  10. #10
    Join Date
    May 2008
    Location
    TN
    Posts
    853
    Images
    99
    Rep Power
    69

    Re: baby steps with the pololu servo controller

    Code for an Arduino to talk to a Pololu serial controller via a software serial port:

    Code:
    
    void servoAbsolute(int servo, int angle)
    {//servo is the servo number (typically 0-7)
    //angle is the absoltue position from 500 to 5500
      digitalWrite(greenLED, HIGH);
    
       unsigned char buff[6];
    
       unsigned int temp;
       unsigned char pos_hi,pos_low;
       
       temp=angle&0x1f80;
       pos_hi=temp>>7;
       pos_low=angle & 0x7f;
    
       buff[0]=0x80;//start byte
       buff[1]=0x01;//device id
       buff[2]=0x04;//command number
       buff[3]=servo;//servo number
       buff[4]=pos_hi;//data1
       buff[5]=pos_low;//data2
    
       for(int i=0;i<6;i++){
          mySerial.print(buff[i],BYTE);
          //Serial.println((buff[i] + '0'), BYTE);    
       }
       digitalWrite(greenLED, LOW);
    }
    
    void servoSpeed(int servo, int value) {
       unsigned char buff[5]; 
       
       buff[0]=0x80;//start byte
       buff[1]=0x01;//device id
       buff[2]=0x01;//command number
       buff[3]=servo;//servo number
       buff[4]=value;//Servo Speed
       for(int i=0;i<5;i++){
          mySerial.print(buff[i],BYTE);
         // Serial.print(buff[i], BYTE);
       }
    }
       
    
    
    void servoSet8Bit(int servo, int angle)
    {//servo is the servo number (typically 0-7)
    //angle is the absoltue position from 500 to 5500
    
       unsigned char buff[6];
    
       unsigned int temp;
       unsigned char pos_hi,pos_low;
       
       temp=angle&0x1f80;
       pos_hi=temp>>7;
       pos_low=angle & 0x7f;
    
       buff[0]=0x80;//start byte
       buff[1]=0x01;//device id
       buff[2]=0x03;//command number
       buff[3]=servo;//servo number
       buff[4]=pos_hi;//data1
       buff[5]=pos_low;//data2
    
       for(int i=0;i<6;i++){
          mySerial.print(buff[i],BYTE);
             
       }
    }
    
     
    void setServoParam(int servo, int data) {
      unsigned char buff[5];
      buff[0]=0x80;//start byte
       buff[1]=0x01;//device id
       buff[2]=0x03;//command number
       buff[3]=servo;//servo number
      buff[4]=data;
      
      
      for(int i=0;i<5;i++){
          mySerial.print(buff[i],BYTE);
          //Serial.println((buff[i] + '0'), BYTE);  
          
      }
    }
    Edit: i don't know if that is useful to you but I have been meaning to post it for a while.
    Last edited by jes1510; 01-17-2010 at 10:39 PM.
    "If A is a success in life, then A equals x plus y plus z. Work is x; y is play; and z is keeping your mouth shut."
    -
    Einstein

    Don't be a HelpVampire

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. RC & Serial Servo Controller Kit
    By Al1970 in forum Garage Sale
    Replies: 0
    Last Post: 01-10-2009, 01:39 AM
  2. Question(s) Pololu 3A Motor Controller with Feedback
    By kankatee in forum Arbotix, Microcontrollers, Arduino
    Replies: 4
    Last Post: 12-22-2008, 08:53 PM
  3. Controlling Servos with a servo controller
    By bodhibuilder in forum Arbotix, Microcontrollers, Arduino
    Replies: 25
    Last Post: 09-29-2008, 12:07 PM
  4. Question(s) servo and motor controllers
    By csdude in forum Arbotix, Microcontrollers, Arduino
    Replies: 7
    Last Post: 06-15-2008, 09:23 PM
  5. Kondo web page translated.
    By Droid Works in forum Humanoids, Walkers & Crawlers
    Replies: 4
    Last Post: 10-06-2007, 06:49 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •