Simple servo motor
Turning the engine is great fun, but when it comes to projects or motion control is needed, you'll be forced to ask for more. The answer? Servo hobby. They are mass-produced, widely available and cost anywhere from a couple of dollars to hundreds.
Inside is a small gearbox (to make the movement more powerful) and some electronics (to make it easier to operate).
A standard servo motor can range from 0 to 180 degrees. The positioning is controlled by a synchronized pulse - from 1.25 milliseconds (0 degrees) to 1.75 milliseconds (180 degrees) (1.5 milliseconds for 90 degrees). The duration varies by manufacturer. When sending a pulse every 25-50 milliseconds, the servo will run smoothly.
COMPONENTS
- Head for 3 spindles.
- Mini servo.
- Connecting wire.
CIRCUIT DIAGRAM
CIRCUIT INSTALLATION
Simple installation of amplifier by translator .
Note in the photo that the servo takes out the black, red, white cable in this order, but on its connecting sheet they are in the order of black, white, red (this servo engine comes from the Arduino Experimenter Kit).
That is why it is the middle wire (yellow wire) that is connected to the signal, contrary to the scheme above.
CODE
You can find this code in CIRC04-code-servo.js.
var five = require("johnny-five"), board, myServo;
board = new five.Board();
board.on("ready", function() {
myServo = new five.Servo(9);
board.repl.inject({
servo: myServo
});
myServo.sweep();
this.wait(5000, function(){
myServo.stop();
myServo.center();
});
});
EMERGENCY REPAIR
Servo is not
moves?Even with colored wires, it's scandalously easy to stick a servo upside down. So it can be .
Still not working
The mistake that they make from time to time is simply to forget to connect the current (red and black wires) to + 5 volts and to the ground.
Adapts and starts
If the servo starts to move, and then there is a shake, and if the light flashes on your Arduino card, then the power you use is not quite up to scratch. To solve this problem, connect an external power source (for example, a new stack) instead of USB.
CODE EXTENSION
Potentiometer check
We still need to experiment with inputs, but if you want to get ahead, Exercise 8 uses a potentiometer to control the LED. The Code Extension section provides an exercise in writing a code to use a potentiometer to control the speed of a servo motor.
Great ideas
Servos can be used to do all sorts of great things. Here are some of our favorites.
- Visitors counter.
- Open source robotic arm (uses servo in the same way as Arduino).
- Four-legged walking robot.