RB-150CS: Servo with 360 Degree freedom (Arduino Sample Code)

$16.99
Be the first to leave a review
SKU RB_150CS_M18
Weight 0.10 LBS
Stock
Wishlist

Create Wishlist

  1. Control System: +Pulse Width Control 1500usec Neutral
  2. Operating Voltage: 4.8-7.2 Volts
  3. Operating Temperature Range: 0 to +60 Degree
  4. Operating Speed (4.8V): 0.16sec/60° at no load
  5. Operating Speed (6V): 0.14sec/60° at no load
  6. Operating Speed (7.2V): 0.12sec/60° at no load
  7. Stall Torque:(4.8V): 3kg·cm ;(6.0V): 3.5kg·cm
  8. Dead Band Width: 10usecConnector Wire Length: 300mm
  9. Dimensions: 40.8mm X 20.1mm X 38mm
  10. Weight: 56g
  11. location of each pin: red (+),brown (-), yellow (signal)
 
Servo has three wires: Brown, Red and Orange.
Brown is GND, Red is VCC, and should be connected to +5V, Orange is the control signal, which is PWM signal.
 
Note: Don't power your servo from USB port as USB port cannot provide enough current.
 
 
 
Arduino Sample Code:
 
 

int servopin=7;//Define servo PWM control as digital 7
int myangle;//define variable angle
int pulsewidth;//define variable pulse width
int val;
void servopulse(int servopin,int myangle)//define a pulse function

{
pulsewidth=(myangle*11)+500;//translate angle to a pulse width value between 500-2480
digitalWrite(servopin,HIGH);//pull the interface signal level to high
delayMicroseconds(pulsewidth);//delay in microseconds
digitalWrite(servopin,LOW);//pull the interface signal level to low
delay(20-pulsewidth/1000);
}
void setup()
{
pinMode(servopin,OUTPUT);//set the interface pin as output
Serial.begin(9600);//
Serial.println("servu=o_seral_simple ready" ) ;
}
void loop()//translate the number 0-9 to angle between 0 degree to 180 degree, and let LED blink the same times
{
val=Serial.read();//

if(val>Ɔ'&&val<=Ə')
{
val=val-Ɔ';//
val=val*(180/9);//translate number to angle
Serial.print("moving servo to ");
Serial.print(val,DEC);
Serial.println();
for(int i=0;i<=50;i++)//wait enough time so that the servo can rotate to the specified angle
{
servopulse(servopin,val);//call the pulse function
}
}

}