using a modded(continuous) servo

Hey everyone! so i modded a couple servos a while back, and now I'm trying to use them in my arduino. So i understand you can't use the standard servo library, but instead you send analog signal to it(pwm). Is that correct? anyways its not working. Here's my schematic:


and my code

int servoOne = 9;
int servoTwo = 10;




void setup()
{
pinMode(servoOne, OUTPUT);
pinMode(servoTwo, OUTPUT);
}


void loop()
{
analogWrite(servoOne, 255);
analogWrite(servoTwo, 255);
}

what kind of servos? how are they modded? if they are regular RC servos you still use the servo library. pulse width 1.5mS is stop, 1.0 mS fast reverse and 2.0 mS forward fastest.

There hs-311's. I opened them up cut the stopper, and glued the pot. I also drilled the gear that the pot went into. So do I use the servo library for that?

I have never used one myself, but from reading posts of people who have, the servo library is the way to go. the servo still needs the servo pulse widths at the right frequency. AnalogWrite gives PWM but not at the right frequency. You may need to tune your servo a bit to get it to stop at 1.5mS pulse width. To do so you connect the servo and send it servo,write(90) and adjust the pot to stop the servo.

i understand that writing microseconds is the same thing as sending angles. so i can just send an angle of 180 right? and that will make it go full speed? anyways it did nothing. i also saw somewhere that sending straight analog can damage your servos. well thats what i did.. code:

#include <Servo.h>

Servo servo1;
Servo servo2;
int servo1Pin = 9;
int servo2Pin = 10;


void setup()
{
  servo1.attach(servo1Pin);
  servo2.attach(servo2Pin);
}
void loop()
{
servo1.write(180);
servo2.write(180);
}

To do so you connect the servo and send it servo,write(0) and adjust the pot to stop the servo.

Usually one would use the 90 deg or 1500us position for the servo pot calibration in a continuous rotation servo if bidirectional control is desired. Servo test 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, 500, 2500);  //the pin for the servo control, and range if desired
  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
  } 
}

I really need to proof read my posts better. I meant 90, honest.

see the problem is i didnt buy a continuous servo. i modded it. when you mod it, you put the pot at the zero position, and the glue it in place. so i cant change the pot. see here:

edit:

Then send PWM to the servo. You will notice that by telling the servo to go to a particular angle, instead it will rotate at a particular speed. Neat, huh?

i didnt see that on the website. all i saw was send it pwm. So now i know i need to send it angles, and your saying send it 90? also can you check my schematic to make sur ei hooked it up right? i just made that schematic on the fly.

Hey guys! So I got them working. I finally realized, my 9v battery to the servos was dead..... Don't know how that happened.... Anyways I plugged in a new one and voila! It worked! One problem though, it only worked for like 10-15 seconds. Then my board went wacko and all the lights started flickering on it. So I need someone to check my schematic. I have a feeling I missed a resistor or something. If you need me to redo the schematic let me know.

Also, I ran through some tests on my board to make sure I didn't fry it. It appears to be working fine.

is your regulator and servo gnd tied to arduino gnd.

Be careful with 9V! - Standard Servo's can only tolerate about 6 volts, and High-voltage version about 7,4V - no more or you will burn out the motor!

// Per.

Hello, so I am bringing this question back up. First:

Be careful with 9V! - Standard Servo's can only tolerate about 6 volts, and High-voltage version about 7,4V - no more or you will burn out the motor!

I'm using a regulator if you had of read previous posts you would of seen that.

is your regulator and servo gnd tied to arduino gnd.

Yes, you should of looked at the schematic I posted.

Anyways to update you on what I currently have:

#include <Servo.h>

// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 13;
Servo myservo;

// the setup routine runs once when you press reset:
void setup()
{
  pinMode(led, OUTPUT);
  digitalWrite(led, LOW);
  myservo.attach(9);
}

// the loop routine runs over and over again forever:
void loop()
{
//myservo.write(0);
}

First off, when I attach the servo without writing anything to it, it starts spinning. That's a problem. The next problem is i cannot stop the servo, probably because it starts spinning just by attaching it. The last problem is I cannot control the speed. I can control the direction.

After further testing, I have found that if I send it the angle 70 it will stop moving although there is still a clicking noise. If I send it values between 60 and 80 I can control the speed.

Before replying, please read previous posts about how I modded it and also see the schematic.

microzee:

Be careful with 9V! - Standard Servo's can only tolerate about 6 volts, and High-voltage version about 7,4V - no more or you will burn out the motor!

I'm using a regulator if you had of read previous posts you would of seen that.

is your regulator and servo gnd tied to arduino gnd.

Yes, you should of looked at the schematic I posted..

Suggestion:

Yes, I am using a regulator. I mentioned that in a previous post.

Yes, the regulator and servo gnd are tied to Arduino gnd. See schematic in previous post.

Remember, you are asking nice people to help you out. It pays to be nice to all of them.

I sometimes get so wrapped up in a problem I'm working on that I forgot to consider my words before hitting send. Fortunately, I usually read my posts after sending them. A quick edit often helps me avoid akward situations. Sometimes not.

Good luck with your project. It is a subject that interests me. I too have watched the videos and need to mod a couple of small servos.

John

when you mod it, you put the pot at the zero position, and the glue it in place. so i cant change the pot. see here:

Bad info. To calibrate the servo you should send it a control signal for 90 deg (1500us is more accurate), then adjust the pot to the point where the servo motor stops. Then glue the pot. Below is some servo test code that uses the keyboard keys and serial monitor to increase/decrease the control values sent to the servo.

// zoomkat 3-28-14 serial servo incremental test code
// using serial monitor type a character (a to increase or s 
// to decrease) and enter to change servo position 
// use strings like 90x or 1500x for new servo position 
// for IDE 1.0.5 and later
// Powering a servo from the arduino usually *DOES NOT WORK*.

#include<Servo.h>
String readString;
Servo myservo;
int pos=1500; //~neutral value for continous rotation servo
//int pos=90;

void setup()
{
  myservo.attach(7, 400, 2600); //servo control pin, and range if desired
  Serial.begin(9600);
  Serial.println("serial servo incremental test code");
  Serial.println("type a character (a to increase or s to decrease)");
  Serial.println("and enter to change servo position");
  Serial.println("use strings like 90x or 1500x for new servo position");
  Serial.println();
}

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) {
    if(readString.indexOf('x') >0) { 
      pos = readString.toInt();
    }

    if(readString =="a"){
      (pos=pos-1); //use larger numbers for larger increments
      if(pos<0) (pos=0); //prevent negative number
    }
    if (readString =="s"){
      (pos=pos+1);
    }

    if(pos >= 400) //determine servo write method
    {
      Serial.println(pos);
      myservo.writeMicroseconds(pos);
    }
    else
    {   
      Serial.println(pos);
      myservo.write(pos); 
    }
  }
  readString=""; //empty for next input
}

I figured it out. The whole problem was the pots weren't positioned right. I fixed them glued them in place and now everything works.