I need to stop servos in two positions and found out they are not really precise
if i just do it with the servo library (degrees from to).
Mounting endswitchs is impracticable so i took apart a old PS2 mouse and mounted
the encoder disc on the servo shaft.
Then i found this: Arduino Playground - Ps2mouse
The problem is it does not react to slow servo movements and i only get sometimes X=-1
Spinning the disc fast puts out more.
Also x/y go back to 0 after movement...
Is there a way to use the mouse PCB as is and look how far the servo moved?
I only have 15-20 decrees of movement.
if i just do it with the servo library (degrees from to).
For best servo control, use writeMicroseconds(). The below code can be used to see how the servo will respond.
// zoomkat 3-28-14 serial servo incremental test code
// using serial monitor type a character (s to increase or a
// to decrease) and enter to change servo position
// (two hands required, one for letter entry and one for enter key)
// 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 (s to increase or a 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
}
Cool that killed the servo.
It did move one time after uploading the sketch then i tried some numbers and nothing happened.
Then i touched the servo and burned my fingers.
EDIT:
Ok the servo is now touchable again and still working.
But i don't get it.
I went down to 850 (more did growl) and to the other side 2550 did work before terible noise.
But the next time i entered 850 it traveled to far and did jam so i had to move the arm to get it working again.
EDIT #2:
Ok looks like 15€ for a servo is not enough money to get something good.
If i enter 1000x the servo moves a half inch more then it should be to then go back to this position.
Ok i took an old analog Graupner from ~1990 out of one of my Tamiya cars.
This one works as it should be.
So this cheap MG946R digital servos go back to the seller. They are good for nothing.
I ordered some Hitec HS-485HB and hope the 67 oz/in are strong enough for what i need them.
o this cheap MG946R digital servos go back to the seller. They are good for nothing.
I ordered some Hitec HS-485HB and hope the 67 oz/in are strong enough for what i need them.
Well, it pays to know something about servos so you don't destroy them. How are you powering the servo? Trying to power large servos from the arduino will crash the arduino and cause it to reset. If "serial servo incremental test code" prints out in the serial monitor, the arduino has just reset. If you are powering the servo from an external power supply, the arduino ground and the servo ground need to be connected together. Failing to do so can caude erratic operation, overheating, and possible servo damage. Normal servos have internal hard stops (the command positions vary) and if the servo is driven hard against the stops, the servo can over heat and possibly strip gears if plastic.
Sure i did use a external power supply and grounds are connected.
As i wrote the old analog 1990 Graupner servo works.
I was only looking on the view German Amazon reviews before a bought this MG946R.
Normally i check English sites too because there are more reviews but this time i did not.
Now i did it and there are enough people who hat crashes on there flying RCs because
of this servos.
Yes there is a reason why you pay fivefold for Futaba or HiTec for a servo with that much strength.
I thought i have luck and they are good enough for my voice controlled toilet flushing.