The Enchanted Objects kit includes a TinkerKit Servo Module.
That servo motor is not your common 180° angle adjustable unit. It's something special.
Digital Continuous Rotation (360°) Servo
It's a SM-S430R continuous rotation type (http://www.farnell.com/datasheets/1581465.pdf)
The continuous servo doesn't work like the common one.
If you connect it to an Arduino and run the Servo examples, you'll be amazed (that is: if your workbench survives it - I tested it with a long iron beam attached to it and the thing started hacking into my function generator).
On a common servo, you can call Servo.write() with a value between 0 and 180. The servo will move to a fixed position for each value between 0 and 180 and stop.
But for a continuous servo, this value determines the speed.
Servo.write(0) the motor spins counterclockwise as fast as it can - and keeps running
Servo.write(90) the motor grinds to a halt
Servo.write(180) the motor spins clockwise as fast as it can - and keeps running
A safe way to test the servo is with this minimal sketch. It will start spinning the turn the motor clockwise at a low speed, and runs at that speed forever.
Pin 9 is the Arduino control pin.
#include <Servo.h> Servo myservo; // create servo object to control a servo void setup() { myservo.attach(9); // attaches the servo on pin 9 to the servo object myservo.write(100); } void loop() { // this space intentionally left blank }
I've also made a test bed that allows you to control the motor via the serial monitor. When you enter a value between 0 and 180, the motor will run with that for 5 seconds. Then it stops.
Load to your Arduino,
#include <Servo.h> Servo myservo; // create servo object to control a servo void setup() { Serial.begin(9600); myservo.attach(9); // attaches the servo on pin 9 to the servo object myservo.write(90); Serial.println("Enter speed (0 - 180, 0 is fast left, 180 is fast right, 90 = stop)"); } void loop() { // if there's any serial available, read it: while (Serial.available() > 0) { int iSpeed = Serial.parseInt(); iSpeed = constrain(iSpeed, 0, 180); myservo.write(iSpeed); delay(5000); myservo.write(90); Serial.println("Enter speed (0 - 180, 0 is fast left, 180 is fast right, 90 = stop)"); } }
I'm still thinking how I can use this motor in my project. Because of its peculiar behavior, I'll have to come up with something that matches with this servo.
Click here for Part 2.
Top Comments