FANDOM


BackgroundEdit

The Pololu micro serial servo controller is an RS232 to servo motor interface. It is in use by the team in 2010 for the first time. Generating PWM is hardware-intensive; Pololu will receive a serial command and take over from there, freeing micro-controller resources for other tasks.

How to useEdit

  1. Read the user manual, especially page 3 which explains what to plug in where.
  2. We are using the controller in Pololu interface mode (user manual p. 5), to allow full access to speed and other settings. Remove the blue jumper.
  3. Plug 5 to 16V into the VIN and GND connectors (bottom-left) to power the controller.
  4. RS232 signals are transmitted on pin 2 (TXD) and pin 5 (ground) of a DB9 RS232 cable. Plug this in.
    We have made a female DB9 to 2 pin header adapter for direct computer control; an adapter needs to be made to connect to the serial out of the microcontroller. Plug this into the RS232 serial input (top middle).
  5. Plug in 5V to the servo power (top right).
  6. Plug in a servo motor to any servo channel (servo 0).
  7. Test it by sending bytes out COM1... working on this :)
  • Use CuteCom to send data to test the Pololu in Hex. Settings:
    • device: /dev/ttyS0
    • Baud rate: 4800
    • Data bits: 8
    • Parity: none
    • Stop bits: 1
    • Handshake: Software only; also none
    • Open for: reading, writing
    • Apply settings when opening
    • Hex input
  • First, command 0 to setup the servo:

0x8001000148 (dataB=01001000 for servo on, forward, half range)

  • Then, command 2 to set position far forward:

0x8001100100

  • Far back:

0x80011001FF

With the RS232 signal connected to pin 2 of RS232, Whenever anything is sent, green light flashes fast and red light stays on (this means baud rate is too high).

  • Lowered baud right down to 600 bps

With the RS232 signal connected to pin 3 of RS232, red light flashes slowly when data is sent.

Sent FF0000 (servo 0 all the way left/right); red light flashes slowly when data is sent. This means the baud rate is too high.

Connected serial-out to the DB9 adapter (single pin) pin 2. Returning \0x00 repeatedly. Slower rate of \0x00 once when red light solid, green flashing quickly after a power-cycle.

Whats going on here?

To try

- switch pin 2 and 3

- different baud rates (already tried this)

- factory reset

Tried using TS7260 to communicate. The red light now flashes slowly, with the yellow light on, if the board is not reset. Tried to use the reset pin as suggested; the yellow light stays off always when reset is connected (perhaps I've got the wrong pin; DIO2 header, at the 0 end, inward side of the board). Using it an alligator cable to tap the rest pin from this board pin. Had command byte at 0x10; changed to 0x02; no difference.

Pololu and ArduinoEdit

SoftwareEdit

We had success using a slightly edited version of the code Dr. Simmons provided to us, which can be seen in the dropbox. The biggest issue was that the prompt saying the position value should be from 0-254, when in reality the code was expecting a value from 0-9 and then multiplied this value by 20 (which we later changed to 25) to get a value between 0 and 9*20 = 180 (9*25 = 225). There is code to convert the inputted char value to an int buy subtracting 0x30 from the ASCII value.


//Pololu servo board test in Mini SSC II mode
//(mode jumper innplace on Pololu board)
#include <SoftwareSerial.h>
int servo_num;
int resetPin = 8; //note pin change to make room for arduino! reset is the pin next to the jummper
int txPin = 9;
// set up a new serial port
SoftwareSerial servo_ser = SoftwareSerial(7, txPin);
void setup() 
{
 pinMode(txPin, OUTPUT);
 pinMode(resetPin, OUTPUT);
 
 Serial.begin(9600);
 Serial.println("Input servo number (0,1,2), and position (0-254)\n");
 servo_ser.begin(2400);
 //next NEED to explicitly reset the Pololu board using a separate pin
 //else it times out and reports baud rate is too slow (red LED)
 digitalWrite(resetPin, 0);
 delay(10);
 digitalWrite(resetPin, 1);  
}
void loop() 
{
 int c, pos;
 char ch;  
 if ((c = Serial.read()) != -1) 
 {
    ch = char(c);
    if(ch=='0' || ch=='1' || ch=='2')
    {
      servo_num = ch-0x30;
      Serial.print("Servo #"); 
      Serial.print(ch, BYTE); 
      Serial.print("  Position= ");  
      while((c = Serial.read()) == -1); //loop waiting
      ch = char(c);
      pos = (ch-0x30)*20;
      if(pos < 0) pos = 0; 
      if(pos > 254) pos = 254; 
      Serial.println(pos,DEC); //print position and move to next line
      servo_command(servo_num,pos);
      delay(10);
    } 
 }
}
void servo_command(int whichservo, int position)
{ 
 servo_ser.print(0xFF, BYTE); //servo control board sync
 //Plolou documentation is wrong on servo numbers in MiniSSCII
 servo_ser.print(whichservo+8, BYTE); //servo number, 180 mode
 servo_ser.print(position, BYTE); //servo position
}

Pololu seems to be losing power after it turns the motor with this code. Perhaps a power draw issue? Or perhaps there needs to be more delay? The power returns if the microcontroller is reset. * I believe this was caused by trying to control servo 1 wen there was no servo attached there.

Pololu will experience odd/ unexpected behaviour if the box is not fully assembled. It crashes and reports a communication error if arduino is plugged into usb, and the wind sensor is attached and sending data. When testing pololu while on usb do not start serial3(wind sensor data). If both need to be tested power the arduino with a battery and use hyperterminal and not the usb port. This avoids the floating grounds and reduces the amount of erratic behaviour from pololu.

HardwareEdit

We connected the pins as described in the code. The grounds should all be connected to eachother. The MiniSSCII mode jumper is on. Connect the pins shown here to 8 instead of 4 and 9 instead of 5 (interferes with zigbee)


Pololu Diagram

Rough wiring diagram of how the Arduno should be connected with Pololu













.

External LinksEdit

http://www.pololu.com/catalog/product/207 The manufacturers site. User manual, pics, specs

http://dmt195.wordpress.com/2009/01/19/python-to-interface-with-the-pololu-8-channel-servo-controller/ Python from linux to control Pololu

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.