Actually a servo motor has feedback sensors that report the
position / angle of rotation when rotating. Well, departing from this sense
that initially made me 'cheated'. The DS04 name is 'servo' in the market. But
in reality, this kind of motor does not have a feedback sensor which can be
read to determine the current position. The feedback sensor can be a
potentiometer or encoder read with optocoupler. When I open DS04-NFC servo’s casing,
it did not have both. So the right term for this motor is 'continuous rotation'
motor, not a ‘servo’.
DS04-NFC Specifications
DS04-NFC continous rotation motor has the following
technical specifications:
- Torsion: 5.5 kg / cm (at 4.8 V)
- Speed: 0.22SEC / 60 (at 4.8 V)
- Working voltage: 4.8V-6V
- Working temperature: 00 C - 600 C
- Current: <1000 mA
- Weight: 38 gr
- Size: 7.4 x 1.7 cm
How to Control DS04-NFC ‘servo’ - Arduino
To control the motor with Arduino is easy enough. But
remember, the motor is not a servo, so it’s also different controlling
mechanism from the servo motor. If the servo, you simply issue an command ‘servo.write
(destination_angle) to drive the motor to the destination angle (example:
servo.write (90) to drive the motor to the angle 900). Well, for the
DS04-NFC 'servo' is different ways of control. You must issue a PWM pulse with
a certain pulse width. The rules are as follows:
2000: turn right (clockwise = CW)
1500: stop
1000: turn left (counter clockwise = CCW)
If you leave a PWM pulse with a nominal 1000, the DS04
motors will continue to rotate (continuous rotation) to the left. This motor
will continue to rotate until you issue a PWM pulse with a pulse width of 1500.
At this point it became clear what the difference is with the servo motor, isn’t
it?
DS04-NFC – Arduino Circuit
To start DS04-NFC ‘servo’ experiments with Arduino, simply
connect both of them with following configurations:
Arduino
|
Motor DS04-NFC
|
5V
|
red
|
Gnd
|
black
|
9
|
white
|
DS04-NFC ‘servo’ – Arduino Sketch
In terms of its software, to issue a PWM pulse with a
certain pulse width, you can use 'writeMicroseconds (pulse_width)' command.
Here is an example of DS04-NFC motor control with Arduino. If you upload the source
code below, your DS04 motor will rotate to the right (CW) for 5000 milliseconds
(5 seconds), turned to the left (CCW) for 3000 milliseconds and then stopped
/*
* DS04-NFC – Arduino sketch example
* ArduinoGeek.com
*/
#include <Servo.h>
Servo myservo;
int pos;
void setup()
{
myservo.attach(9);
myservo.writeMicroseconds(2000); // CW
delay(5000);
myservo.writeMicroseconds(1000);
// CCW
delay(3000);
myservo.writeMicroseconds(1500); // stop
delay(100);
}
void loop() {
}
You can develop source code / sketch above according to your
needs. The DS04-NFC ‘servo’ motor is fitting for applications requiring
continuous rotation (> 3600). An example is to move the robot or
smart car. This motor is not suitable for applications that require accurate positioning
motor based on the rotation angle. For such needs, you should use the actual
servo motors. In next tutorial, I will present how to modify the motor DS04-NFC
into the actual servo motors. Stay tuned
on this blog.
ConversionConversion EmoticonEmoticon