Ks0209 keyestudio 9G Servo Motor Blue 90°: Difference between revisions

From Keyestudio Wiki
Jump to navigation Jump to search
No edit summary
Line 2: Line 2:
==keyestudio 9G Servo Motor Blue 90°==
==keyestudio 9G Servo Motor Blue 90°==
<br>[[File:ks0209.png|500px|frameless|thumb]]<br>
<br>[[File:ks0209.png|500px|frameless|thumb]]<br>


<br>
<br>
Line 11: Line 10:
The servo has three interfaces,distinguished by brown, red and orange line (different brand may have different color). Brown line is for GND, red one for power 5V, orange one for signal terminal (PWM signal).<br>
The servo has three interfaces,distinguished by brown, red and orange line (different brand may have different color). Brown line is for GND, red one for power 5V, orange one for signal terminal (PWM signal).<br>


The rotation angle of servo is controlled by regulating the duty cycle of the PWM(Pulse-Width Modulation) signal. The standard cycle of the PWM signal is fixed at 20ms (50 Hz), and the pulse width is distributed between 1ms-2ms. The pulse width corresponds to the rotation angle ( 0°~90°) of servo.<br>
The rotation angle of servo is controlled by regulating the duty cycle of the PWM(Pulse-Width Modulation) signal. The standard cycle of the PWM signal is fixed at 20ms (50 Hz), and the pulse width is distributed between 1ms-2ms. The pulse width corresponds to the rotation angle ( 0°~90°) of servo. <br>
<br>[[File:舵机90度.png|600px|frameless|thumb]]<br>
<br>[[File:舵机90度.png|600px|frameless|thumb]]<br>


<br>
== Parameters ==
*Operating voltage: DC 4.8V〜6V
*Angle range: about 90°(in 1000→2000μsec)
*Pulsewidth range: 1000→2000μsec
*No-load speed: 0.12±0.01 sec/60(DC 4.8V);  0.1±0.01 sec/60(DC 6V)
*No-load current: 200±20mA(DC 4.8V);  220±20mA(DC 6V)
*Stop torque: 1.1±0.01kg/cm(DC 4.8V);  1.3±0.1kg/cm(DC 6V)
*Stop current: 600±30mA(DC 4.8V);  750±30mA(DC 6V)
*Standby current: 4±1mA(DC 4.8V);  4±1mA(DC 6V)
*Operation temperature: -10℃〜50℃
*Save temperature: -20℃〜60℃
*Motor wire length: 250 ± 5 mm
*Dimensions: 22.7mm*12.12mm*25.7mm
*Weight: 12± 1 g (without servo mounts)
<br>
== Dimensions==
== Dimensions==
<br>[[File:KS0326 (4).jpg|500px|frameless|thumb]]<br>
<br>[[File:KS0326 (4).jpg|500px|frameless|thumb]]<br>


 
<br>
== Details Display ==
== Details Display ==
<br>[[File:Ks0326图片4.png|500px|frameless|thumb]]<br>
<br>[[File:Ks0326图片4.png|500px|frameless|thumb]]<br>
<br>[[File:KS0326 (6).jpg|500px|frameless|thumb]]<br>
<br>[[File:KS0326 (6).jpg|500px|frameless|thumb]]<br>


 
<br>
== Connection Diagram ==
== Connection Diagram ==
Connect the motor to digital pin 9.<br>
Connect the motor to digital pin 9.<br>
Line 28: Line 44:
===Connection for UNO R3:===
===Connection for UNO R3:===
<br>[[File:KS0209-2.png|500px|frameless|thumb]]<br>
<br>[[File:KS0209-2.png|500px|frameless|thumb]]<br>
 
<br>
===Connection for 2560 R3:===
===Connection for 2560 R3:===
<br>[[File:KS0209-3.png|500px|frameless|thumb]]<br>
<br>[[File:KS0209-3.png|500px|frameless|thumb]]<br>


<br>
==Sample Program==
==Sample Program==
There are two ways to control a servomotor with Arduino. One is to use a common digital sensor port of Arduino to produce square wave with different duty cycle to simulate PWM signal and use that signal to control the positioning of the motor. <br>
There are two ways to control a servomotor with Arduino. <br>
Another way is to directly use the Servo function of the Arduino to control the motor. In this way, the program will be easier but it can only control two-contact motor for the servo function, only digital pin 9 and 10 can be used. The Arduino drive capacity is limited. So if you need to control more than one motor, you will need external power.<br>
One is to use a common digital sensor port of Arduino to produce square wave with different duty cycle to simulate PWM signal and use that signal to control the positioning of the motor. <br>
 
Another way is to directly use the Servo function of the Arduino to control the motor. In this way, the program will be easier but it can only control two-contact motor for the servo function, only digital pin 9 and 10 can be used. <br>
The Arduino drive capacity is limited. So if you need to control more than one motor, you will need external power.<br>
<br>
===Method 1:===
===Method 1:===
====Sample program A====
====Sample program A====
Line 75: Line 94:
</pre>
</pre>


<br>
===Method 2:===
===Method 2:===
Let's first take a look at the Arduino built-in servo function and some common statements.<br>
Let's first take a look at the Arduino built-in servo function and some common statements.<br>
* 1. attach(interface)——select pin for servo, can only use pin 9 or 10.  
* 1. attach(interface)——select pin for servo, can only use pin 9 or 10.  
Line 84: Line 103:
* 5. detach()—— disconnect the servo and the pin, and the pin(digital pin 9 or 10) can be used for PWM port.  
* 5. detach()—— disconnect the servo and the pin, and the pin(digital pin 9 or 10) can be used for PWM port.  


'''Note:''' the written form of the above statements are " servo variable name. specific statement ()", e.g. myservo. Attach (9).
'''Note:''' the written form of the above statements are " servo variable name. specific statement ()", e.g. myservo. Attach (9). <br>
Still, connect the servo to pin 9.
Still, connect the servo to pin 9.
 
<br>
====Sample program B====
====Sample program B====
<pre>
<pre>
Line 102: Line 121:
</pre>
</pre>


==Example Result==
<br>
Above are the two methods to control the servo. You can choose either one according to your liking or actual need.
Above are the two methods to control the servo. You can choose either one according to your liking or actual need.


 
<br>
== Resources ==
== Resources ==
* [https://drive.google.com/open?id=1M2ZRIrq_AGMtGH08yjAgrHxCPmo4cCiE  You can click here to download the datasheet ]
* [https://drive.google.com/open?id=1M2ZRIrq_AGMtGH08yjAgrHxCPmo4cCiE  You can click here to download the datasheet ]


* [https://drive.google.com/open?id=1-LGO5tGmztWndiKoY5DlUIrucfhgBADh  Servo Libraries Download ]
* [https://drive.google.com/open?id=1-LGO5tGmztWndiKoY5DlUIrucfhgBADh  Servo Libraries Download ]


<br>
== Buy From ==
== Buy From ==
'''Official Website:'''
'''Official Website:'''
http://www.keyestudio.com/ks0209.html
http://www.keyestudio.com/ks0209.html


 
[https://www.aliexpress.com/store/product/1pcs-keyestudio-9G-MINI-SG90-90-degrees-Servo-Motor-Blue-with-PH2-54-Connector-For-Arduino/1452162_32916026470.html?spm=2114.12010615.8148356.12.42502b6bqPNSEz  Shop on aliexpress]


[[Category:Module]]
[[Category:Module]]

Revision as of 11:34, 19 September 2018

keyestudio 9G Servo Motor Blue 90°


thumb


Introduction

This kit mainly includes three micro servo motors with 90 degrees.
Included with your servo motor you will find a variety of white motor mounts that connect to the shaft of your servo. You may choose to attach any mount you wish for the circuit. It will serve as a visual aid, making it easier to see the servo spin.

The servo has three interfaces,distinguished by brown, red and orange line (different brand may have different color). Brown line is for GND, red one for power 5V, orange one for signal terminal (PWM signal).

The rotation angle of servo is controlled by regulating the duty cycle of the PWM(Pulse-Width Modulation) signal. The standard cycle of the PWM signal is fixed at 20ms (50 Hz), and the pulse width is distributed between 1ms-2ms. The pulse width corresponds to the rotation angle ( 0°~90°) of servo.

thumb


Parameters

  • Operating voltage: DC 4.8V〜6V
  • Angle range: about 90°(in 1000→2000μsec)
  • Pulsewidth range: 1000→2000μsec
  • No-load speed: 0.12±0.01 sec/60(DC 4.8V); 0.1±0.01 sec/60(DC 6V)
  • No-load current: 200±20mA(DC 4.8V); 220±20mA(DC 6V)
  • Stop torque: 1.1±0.01kg/cm(DC 4.8V); 1.3±0.1kg/cm(DC 6V)
  • Stop current: 600±30mA(DC 4.8V); 750±30mA(DC 6V)
  • Standby current: 4±1mA(DC 4.8V); 4±1mA(DC 6V)
  • Operation temperature: -10℃〜50℃
  • Save temperature: -20℃〜60℃
  • Motor wire length: 250 ± 5 mm
  • Dimensions: 22.7mm*12.12mm*25.7mm
  • Weight: 12± 1 g (without servo mounts)


Dimensions


thumb


Details Display


thumb

thumb


Connection Diagram

Connect the motor to digital pin 9.

Connection for UNO R3:


thumb

Connection for 2560 R3:


thumb


Sample Program

There are two ways to control a servomotor with Arduino.
One is to use a common digital sensor port of Arduino to produce square wave with different duty cycle to simulate PWM signal and use that signal to control the positioning of the motor.
Another way is to directly use the Servo function of the Arduino to control the motor. In this way, the program will be easier but it can only control two-contact motor for the servo function, only digital pin 9 and 10 can be used.
The Arduino drive capacity is limited. So if you need to control more than one motor, you will need external power.

Method 1:

Sample program A

int servopin=9;// select digital pin 9 for servomotor signal line
int myangle;// initialize angle variable
int pulsewidth;// initialize width variable
int val;
void servopulse(int servopin,int myangle)// define a servo pulse function
{
pulsewidth=(myangle*11)+500;// convert angle to 500-1490 pulse width
digitalWrite(servopin,HIGH);// set the level of servo pin as “high”
delayMicroseconds(pulsewidth);// delay microsecond of pulse width
digitalWrite(servopin,LOW);// set the level of servo pin as “low”
delay(20-pulsewidth/1000);
}
void setup()
{
pinMode(servopin,OUTPUT);// set servo pin as “output”
Serial.begin(9600);// connect to serial port, set baud rate at “9600”
Serial.println("servo=o_seral_simple ready" ) ;
}
void loop()// convert number 0 to 9 to corresponding 0-90 degree angle, LED blinks corresponding number of time
{
val=Serial.read();// read serial port value
if(val>='0'&&val<='9')
{
val=val-'0';// convert characteristic quantity to numerical variable
val=val*(90/9);// convert number to angle
Serial.print("moving servo to ");
Serial.print(val,DEC);
Serial.println();
for(int i=0;i<=50;i++) // giving the servo time to rotate to commanded position
{
servopulse(servopin,val);// use the pulse function
}
}
}


Method 2:

Let's first take a look at the Arduino built-in servo function and some common statements.

  • 1. attach(interface)——select pin for servo, can only use pin 9 or 10.
  • 2. write(angle)——used to control the rotate angle of the servo, can set the angle among 0 degree to 90 degree.
  • 3. read()——used to read the angle of the servo, consider it a function to read the value in the write() function.
  • 4. attached()——determine whether the parameter of the servo is sent to the servo pin.
  • 5. detach()—— disconnect the servo and the pin, and the pin(digital pin 9 or 10) can be used for PWM port.

Note: the written form of the above statements are " servo variable name. specific statement ()", e.g. myservo. Attach (9).
Still, connect the servo to pin 9.

Sample program B

#include <Servo.h>
/*define a header file. Special attention here, you can call the servo function directly from Arduino's software menu bar Sketch>Importlibrary>Servo, or input  #include <Servo.h>. Make sure there is a space between #include and  <Servo.h>. Otherwise, it will cause compile error. */
Servo myservo;// define servo variable name
void setup()
{
myservo.attach(9);// select servo pin(9 or 10)
}
void loop()
{
myservo.write(90);// set rotate angle of the motor
}


Above are the two methods to control the servo. You can choose either one according to your liking or actual need.


Resources


Buy From

Official Website: http://www.keyestudio.com/ks0209.html

Shop on aliexpress