Pages: [1] 2   Go Down
Author Topic: Servos, Motor Drivers and Outside Control Systems  (Read 2337 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 309
Posts: 26516
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here are the links:
Board - http://arduino.cc/en/Main/arduinoBoardDuemilanove
Motor Drivers (5 Total) - http://www.dimensionengineering.com/SyRen10.htm
Servos (2) - http://www.servodatabase.com/servo/traxxas/2056
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.
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 309
Posts: 26516
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I tired supplying it with the four batteries and uploading the program but nothing happened. Here is the code :
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
  }
}
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 309
Posts: 26516
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What about trying zoomkat's servo test code?
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

New Jersey
Offline Offline
Faraday Member
**
Karma: 70
Posts: 3741
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

New Jersey
Offline Offline
Faraday Member
**
Karma: 70
Posts: 3741
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

0
Offline Offline
Tesla Member
***
Karma: 145
Posts: 9698
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Code:
// 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
  }
}

Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

0
Offline Offline
Tesla Member
***
Karma: 145
Posts: 9698
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Big picture of arduino/servo/battery wiring.

Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

New Jersey
Offline Offline
Faraday Member
**
Karma: 70
Posts: 3741
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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.

Quote
One more thought: have you fallen foul of the notorious "My breadboard has two separate ground lines?"
Quote
Big picture of arduino/servo/battery wiring.
Quote
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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
Code:
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.
Logged

Pages: [1] 2   Go Up
Jump to: