I've just modded two gerneric SG9X servos for continuous rotation. It's mod I've done numerous times before, but this time I'm having trouble.
The electronic aspect of this mod involves replacing the internal 5k pot with two 2k2R resistors.
I'm testing the servos functionality two ways: Firstly using a nano and the "sweep" example sketch; and secondly by writing values of 700 or 2300 MicroSec to them. Both of these methods work fine on previously modded servos.
Servo 1 - "Chirps" when connected to the Arduino but will rotate only in one direction at varying speeds - I've checked the resistors with my meter and they are at 2k17R and 1k84R
Is that discrepancy in the resistance enough to "throw" the controller?
Servo 2 - "Chirps" when connected to the Arduino but does nothing else. The resistors read 2k17R and 2k17R on my meter. There is continuity in the PWM signal wire.
Am I missing somethign obvious, or shall I change the resitsors in servo 1 and junk servo 2?
Your first divider has a center point value of 46 (or 54) %, probably enough error to throw the servo out of whack, try this test sketch. Use microseconds and start at 1500.
/*
Try this test sketch with the Servo library to see how your
servo responds to different settings, type a position
(0 to 180) or if you type a number greater than 200 it will be
interpreted as microseconds(544 to 2400), in the top of serial
monitor and hit [ENTER], start at 90 (or 1472) and work your
way toward zero (544) 5 degrees (or 50 micros) at a time, then
toward 180 (2400).
*/
#include <Servo.h>
Servo servo;
void setup() {
// initialize serial:
Serial.begin(9600); //set serial monitor baud rate to match
servo.write(90);
servo.attach(9);
prntIt();
}
void loop() {
// if there's any serial available, read it:
while (Serial.available() > 0) {
// look for the next valid integer in the incoming serial stream:
int pos = Serial.parseInt();
pos = constrain(pos, 0, 2400);
servo.write(pos);
prntIt();
}
}
void prntIt()
{
Serial.print(" degrees = ");
Serial.print(servo.read());
Serial.print("\t");
Serial.print("microseconds = ");
Serial.println(servo.readMicroseconds());
}
Hi,
With Servo1, all that should do is shift your ZERO speed point.
The fact that on the other servo you can measure equal resistances, I assume you are doing this with the resistor "in circuit, Servo1 measurement seem to indicate a fault in the servo circuit.
With Servo2, check that the gearing has not seized.
This is with hindsight, when you successfully modify a servo you take some measurements.
Incircuit resistances
Voltage at each end of the potential divider and the resistor midpoint with respect to ground.
If you are doing quite a few it would be worthwhile making a small reference manual of measurements and servo control results after modding.
And don't try to run servos from the Arduino 5V pin, not enough current capability, if you're going to do much servo work, get yourself a 5 or 6 volt, 3 to 5 Amp regulated supply.
For servo 1, use microseconds (start at 1500) to find the standstill value, then in setup() you can write:
servo1.writeMicroseconds(1500); // or whatever
servo1.attach(whatever pin #);
This sketch might be better for what you're doing:
/*
Try this test sketch with the Servo library to see how your
ESC responds to different settings, type a speed (1000 - 2000)
in the top of serial monitor and hit [ENTER], start at 1500
and work your way toward 1000 50 micros at a time, then toward
2000.
*/
#include <Servo.h>
Servo esc;
void setup() {
// initialize serial:
Serial.begin(9600); //set serial monitor baud rate to match
esc.writeMicroseconds(1500);
esc.attach(9);
prntIt();
}
void loop() {
// if there's any serial available, read it:
while (Serial.available() > 0) {
// look for the next valid integer in the incoming serial stream:
int speed = Serial.parseInt();
speed = constrain(speed, 1000, 2000);
esc.writeMicroseconds(speed);
prntIt();
}
}
void prntIt()
{
Serial.print("microseconds = ");
Serial.println(esc.readMicroseconds());
}
Voltage from gnd to one end of resistor chain.
Voltage from gnd to other end of resistor chain.
Voltage from gnd to midpoint connection of resistor chain.