Flying Wings With 2 Servos
I developed a passion for doves and I have an idea that is insisting to come to life. Part of it is the dove moving her wing, so here's how to make wings flapping with Arduino Uno and 2 Servos.
I have made the wings before, but now they move automatically.
Supplies
Arduino Uno
2 servos
You also need:
glue, wire/wood sticks, zip ties, a breadboard, jumper wires.
whatever you make the wings of, for me it's rope
Scissors
Build the Wing
Take two wood sticks of 0.5 cm diameter and 5 cm length and two pieces of wire of 8 cm length.
Roll one edge of each wire (around 2 cm) to one edge of each wood stick and add hot glue over it so it won't fall off.
I covered the remainder of the wire with rope for aesthetics.
Bend the wire so to create the feel of a wing in movement.
The other edge of the wood stick will be fixed to the servo with zip ties. Add hot glue over the ties or else they will fall off when it's moving. I got the idea for it from this instructable.
To see how I nett the rope for the wings see this video.
However you can use anything for the actual wing.
Put the servos back to back and tie them with zip ties.
The Circuit
Gnd to Gnd
Vcc to 5V pin on Arduino
Out pin to pin 10/11 in Arduino
The Code
It can have several versions depending on what you want to achieve.
What is common is that the servos need to move in opposite directions. To achieve this they need to be included in the same for function - when a servo's argument is pos the other servo's argument is 90 - pos , for exemple.
The most simple version raises the wings in 10 steps increments (for each run pos = pos + 10) and then it goes down directly to the initial position. It can go down slower or the same as it goes up, but I feel like there should be a difference as it is obviously more difficult to raise a wing then to let it back down. Feels natural.
#include < Servo.h >
Servo servoL;
Servo servoR;
void setup() {
servoL.attach(10);
servoR.attach(11);
}
void loop() {
for (int pos = 90; pos <= 150; pos=pos+10) {
servoR.write(pos);
servoL.write(180 - pos);
delay(500);
}
}