Hi,
im new to servo use, and I was using a medium servo(http://www.abra-electronics.com/products/ROB%252d10333-Servo-%252d-Medium.html) of operating voltage of4.8-6v. However, it worked without an external power supply. After trying with and without an external power supply, the servo kept on making a buzzing sound after it had moved. BTW, I was using 4 AA batteries. So howcome it buzzes?
my sketch #include <Servo.h>
Servo servo1;
void setup(){
servo1.attach(9);
}
void loop(){
servo1.write(165); // I changed these numbers constantly from 0-180 deg.
delay(15);
}
Is the servo under load? Is the servo against an internal stop? Does a longer delay quiten the servo? Servo test code below.
//zoomkat 11-22-12 simple delimited ',' string parse
//from serial port input (via serial monitor)
//and print result out serial port
//multi servos added
String readString;
#include <Servo.h>
Servo myservoa, myservob, myservoc, myservod; // create servo object to control a servo
void setup() {
Serial.begin(9600);
//myservoa.writeMicroseconds(1500); //set initial servo position if desired
myservoa.attach(6); //the pin for the servoa control
myservob.attach(7); //the pin for the servob control
myservoc.attach(8); //the pin for the servoc control
myservod.attach(9); //the pin for the servod control
Serial.println("multi-servo-delimit-test-dual-input-11-22-12"); // so I can keep track of what is loaded
}
void loop() {
//expect single strings like 700a, or 1500c, or 2000d,
//or like 30c, or 90a, or 180d,
//or 30c,180b,70a,120d,
if (Serial.available()) {
char c = Serial.read(); //gets one byte from serial buffer
if (c == ',') {
if (readString.length() >1) {
Serial.println(readString); //prints string to serial port out
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);
if(readString.indexOf('a') >0) myservoa.writeMicroseconds(n);
if(readString.indexOf('b') >0) myservob.writeMicroseconds(n);
if(readString.indexOf('c') >0) myservoc.writeMicroseconds(n);
if(readString.indexOf('d') >0) myservod.writeMicroseconds(n);
}
else
{
Serial.print("writing Angle: ");
Serial.println(n);
if(readString.indexOf('a') >0) myservoa.write(n);
if(readString.indexOf('b') >0) myservob.write(n);
if(readString.indexOf('c') >0) myservoc.write(n);
if(readString.indexOf('d') >0) myservod.write(n);
}
readString=""; //clears variable for new input
}
}
else {
readString += c; //makes the string readString
}
}
}
I have two servos, one without anything, and the other is hooked to a robotic claw. Both of them make noise, but when I increase the delay on 170 degrees to 20, its good. However, at 90 degrees, it does not make a buzzing sound at the delay of 15.
Any suggestions?