Servos, Motor Drivers and Outside Control Systems

First off, yes I realize answers to my questions are probably already on this forum but I have already tried searching them and have gotten no where due to the inefficiency of the search engine on the site.

I am currently using an Arduino Duemilanove provided by my school for an ROV or underwater robot for an upcoming MATE Robotics competition. I have never used Arduino before so am still learning all its different functions. I got past the connection issues that seem to be so common and have gotten the blink program to run just fine. But now I am having trouble running the "Sweep" sample Servo program provided with the software and servos are critical to the robot. I followed the instructions for connecting the servo with the power and ground pins hooked up to the power and ground on the board and the signal pin to digital 9 but when I uploaded the program I got 3 small ~50 turns in one direction and then nothing happened. Can anyone tell me what might be happening that is messing it up? I need to fix it so I can continue with learning how to program servos for the functions I need to accomplish.

Next I have 6 propulsion motors and 1 claw motor all hooked up to SyRen motor drivers. But I am confused as to how I would send a signal from the Arduino to these to tell the motors to go forwards or backwards. Is it just a simple power signal sent from a digital port to the driver? If so then how would I achieve a reverse function? If anyone has ever worked with Motor controllers/drivers with Arduino before and could tell me how to set it up and the basics of how a program for it would run that would be extremely helpful.

My final issue is real-time control of the board. This is for a competition so I can't just program in autonomous. I currently have a Logitech Dual Action USB Game Controller that I would like to use but have yet to see anything for about how to hook it up despite days of research. I did find one topic about hooking up a ps/2 keyboard to the Arduino and that would work if that was my only option but shouldn't it also work if I just line up the right pins between the usb and the ps/2 to figure out what goes into what on the board? I know the values received from the controller would be different but some more research should tell me the values and then I can simply modify the program for the keyboard with those new values.

Thanks in advance for any help anyone can provide. If worse comes to worse I do also have a Bot-Board I could try hooking up and learning the programming for.

Some links to the gear you're using, schematics and code listings would be useful.
It is possible the servo is drawing too much current - how is it powered?

Here are the links:
Board - http://arduino.cc/en/Main/arduinoBoardDuemilanove
Motor Drivers (5 Total) - SyRen 10A regenerative motor driver - analog, R/C, and serial motor control
Servos (2) - Traxxas 2056 Servo Specifications and Reviews
Controller - http://www.logitech.com/en-us/gaming/controllers/devices/7360

Not really sure how or in what format to create or present schematics for it. Right now nothing is hooked up to the board but in the past with the servo I've had it in the exact same setup as that specified here : arduino.cc/it/Tutorial/Sweep and then connected through the usb port.

The only code I've used for the servo is the Sweep sample program with modified servo range and port values in attempts to get it to work.

The servo is being powered directly from the board as shown in the link above.

The servo is being powered directly from the board as shown in the link above.

Can you supply the servo from four AA batteries ( don't forget to connect the grounds together), and post your code.

I tired supplying it with the four batteries and uploading the program but nothing happened. Here is the code :

// Sweep
// by BARRAGAN <http://barraganstudio.com> 
// This example code is in the public domain.


#include <Servo.h> 
 
Servo myservo;  // create servo object to control a servo 
                // a maximum of eight servo objects can be created 
 
int pos = 0;    // variable to store the servo position 
 
void setup() 
{ 
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object 
} 
 
 
void loop() 
{ 
  for(pos = 0; pos < 45; pos += 1)  // goes from 0 degrees to 180 degrees 
  {                                  // in steps of 1 degree 
    myservo.write(pos);              // tell servo to go to position in variable 'pos' 
    delay(15);                       // waits 15ms for the servo to reach the position 
  } 
  for(pos = 45; pos>=1; pos-=1)     // goes from 180 degrees to 0 degrees 
  {                                
    myservo.write(pos);              // tell servo to go to position in variable 'pos' 
    delay(15);                       // waits 15ms for the servo to reach the position 
  } 
}

What about trying zoomkat's servo test code?

I am still not getting any movement from the servo. I have checked all the batteries, all my wires, and all my connections as well. Is there anything else I can do?

mac55:
I am still not getting any movement from the servo. I have checked all the batteries, all my wires, and all my connections as well. Is there anything else I can do?

A common mistake is to forget to connect the grounds together as AWOL noted. The battery negative, servo ground and arduino ground must all be connected. If they are and that doesn't help, try another pin to control the servo. If you still get no joy, go back to run blink, to make sure the duemillanove is still working.

Still nothing more than a twitch on upload and blink still runs just fine. I've tried at least 3 ports and have it hooked up to a regulated power supply set to 6 volts. I've even tried another servo. Is there anything that I could possibly be doing wrong?

Sounds like a power issue still. Take a look at this thread: http://arduino.cc/forum/index.php/topic,78052.0.html. There's a ludicrously huge picture I took of a single servo wired to external power & Arduino. Maybe comparing it to your setup will shed some light on it. How many amps is your supply rated for?

Simple servo test code you can try with the serial monitor.

// zoomkat 10-22-11 serial servo test
// type servo position 0 to 180 in serial monitor
// or for writeMicroseconds, use a value like 1500
// for IDE 0022 and later
// Powering a servo from the arduino usually *DOES NOT WORK*.

String readString;
#include <Servo.h> 
Servo myservo;  // create servo object to control a servo 

void setup() {
  Serial.begin(9600);
  myservo.writeMicroseconds(1500); //set initial servo position if desired
  myservo.attach(7);  //the pin for the servo control 
  Serial.println("servo-test-22-dual-input"); // so I can keep track of what is loaded
}

void loop() {
  while (Serial.available()) {
    char c = Serial.read();  //gets one byte from serial buffer
    readString += c; //makes the string readString
    delay(2);  //slow looping to allow buffer to fill with next character
  }

  if (readString.length() >0) {
    Serial.println(readString);  //so you can see the captured string 
    int n = readString.toInt();  //convert readString into a number

    // auto select appropriate value, copied from someone elses code.
    if(n >= 500)
    {
      Serial.print("writing Microseconds: ");
      Serial.println(n);
      myservo.writeMicroseconds(n);
    }
    else
    {   
      Serial.print("writing Angle: ");
      Serial.println(n);
      myservo.write(n);
    }

    readString=""; //empty for next input
  } 
}

Big picture of arduino/servo/battery wiring.

One more thought: have you fallen foul of the notorious "My breadboard has two separate ground lines?" I recall a thread where someone was using such a breadboard and had assumed (actually hadn't even considered it - who would?) that any hole on the bottom line would do for ground. This became true when he connected the two segments together.

Simple servo test code you can try with the serial monitor.

I already tried this earlier today and got no response from the servo or anything displaying in the monitor.

One more thought: have you fallen foul of the notorious "My breadboard has two separate ground lines?"

Big picture of arduino/servo/battery wiring.

Sounds like a power issue still.

I already ran connection tests through everything. It's all connected right and all my wires are good. And my power supply is rated to 15 amps.

So not really sure where this leaves me in terms of what I'm even going to be able to get to work. I still get the initial twitches on upload but then nothing afterwards. I have already tried two servos which is all I currently have a available. I can try different types in another week but until then I'm stuck trying to get the Traxxas 2056 ones I have now to work.

One thing that might be worth noting, or might not, is that the servos I am using are only 600.

And also for zoomkat's code, I am getting the error:

sketch_apr02a:12: error: 'class Servo' has no member named 'writeMicroseconds'

when I try to verify or upload despite it uploading without errors earlier today.

And also for zoomkat's code, I am getting the error:
when I try to verify or upload despite it uploading without errors earlier today.

I copied the code I posted, pasted it into the 1.0 IDE and uploaded it to my arduino. The standard servo I have connected to pin 7 with an external power supply worked as expected. Your servos seem to be somewhat specialized digital servos, but I would think they would operate as a standard servo. You probably need to sort out the compiling error and recheck your wiring.

Your servos seem to be somewhat specialized digital servos,

The link said "analog".

At this point, I'd be reaching for my scope probes, and putting a print in "setup()" at least, just to see I'm not getting repeated resets.

MOVEMENT!! I went with an analog output and just uploaded the fade program and put the data pin into the pin where the light would normally go and now it is working. Exact control is going to be a little hard this way but I should be able to make it work. Thanks to everyone for helping with the servo issue. While I was doing that I also found out how to work the motor drivers. The only things now is some sort of real time control with a keyboard or game controller. Anyone have any ideas or suggestions for that?

I went with an analog output and just uploaded the fade program and put the data pin into the pin where the light would normally go and now it is working.

Are you saying you're using a PWM output ("analogWrite") to drive your servo?
Is it getting warm?

Well I still have the outside power supply hooked up, I'm just using the pwm for the data pin. I haven't noticed any change in temperature but I'll keep a close eye on it if you think it might be a problem.