Servo Creature (Lesson 1)
In this tutorial, you will build an animated mythical animal. You will use cardboard, pipe cleaners, a micro servo motor, and Arduino microcontroller to build your creature. The creature will have one body part that will be able to move, driven by the motor. You can extend the project by customizing the motion or adding a potentiometer to directly control the position of the creature.
Over the course of this project, you will get exposure to servo motors, Arduino microcontrollers, the Arduino IDE with code sketches, and potentiometers.
Supplies
Components Used:
Arduino Uno
Micro Servo Motor
Jumper Wires
Breadboard (Optional)
Alligator Clips/Wires (For Extension)
Potentiometer (For Extension)
Tools Used:
Phillips Head Screwdriver (Optional)
Hot Glue Gun
Software Used:
Arduino IDE
Introduction to Arduino
An Arduino is an open-source microcontroller that can be easily programmed to perform actions by a user. It is incredibly common in hobbyist and student technology projects due to its versatility and ease of use.
The board is programmed using the Arduino Programming Language through the Arduino IDE. If you have any experience in programming, this is effectively C++ with some specialized methods. If you do not have any prior experience, do not worry, it is easy to learn through these projects.
The board is made up of a number of components outlined in the diagram above. The Arduino primarily interacts with the outside world through pins. The Arduino pins we will mainly deal with are 5V, 3.3V, GND, Analog, and Digital.
5V & 3.3V: Supply 5 volts and 3.3 volts respectively
GND: Ground pin for circuit
Analog: Read inputs from an analog sensor. Values read by one of these pins will range from 0 to 1023. These are mapped from a range of 0 to 5 volts input on the pin.
Digital: Can be either input or output. They can only read or output HIGH and LOW, or 5 volts and 0 volts for the pin. Pins denoted with a ~ are Pulse Width Modulation (PWM) pins. These pins can vary the time the pin is set HIGH vs. LOW by quickly switching back and forth. For certain components, such as motors and LEDs, this can act like applying different voltages. In this project, the Arduino uses a PWM Digital pin to convey information to the servo on the position it should go to.
Learn more about Arduino on their website: https://www.arduino.cc/en/guide/introduction
Decide on Your Character
The first step in building your animated creature is deciding on a character. Your character should be a mythical animal, and I encourage you to be as creative as you can with it! When coming up with your character, you can give it a backstory covering (a) what it eats, (b) what environment it lives in and (c) its relationship with humans. You can also name your character!
I think dragons are pretty cool mythical animals, so I am going to make a dragon! My dragon is a nice dragon named Puffy who lives and works alongside humans and loves watermelon. Some servo creature examples are included above.
Design Your Character
Now that you have decided on a character you will need to make a design. An important thing to remember when designing your character is that you will be using a servo to move one body part of the creature.
There are a lot of different movements you could do, from waving their hand, shaking their head, or wagging your creature's tail. For my dragon, I am going to have the servo flap its wing.
Once you have decided on a design and what part will move, you will need to cut it out of cardboard. Before cutting, you should draw your design out with a pencil or marker so that you have lines to cut along. Notice how I cut the main piece, and the part that will move, separately.
You will also want your creature to stand up on its own, so you will need to cut out a base, and extra pieces to prop up the creature. Lastly, you will need to cut out a small piece to use to attach the servo to the moving part.
Decorate Your Character
Once the creature is cut out, it is time to decorate! You can use whatever you have available to decorate.
I used markers to draw Puffy, and then used colored pipe cleaners to give them a fuzzy stomach.
Build the Servo Arm
With the creature decorated, the next step is to build the part that the servo will move. Go ahead and pull out your micro servo motor. In the bag with the servo, you should have received a couple of attachments that fit onto the motor. You can use any of these, but it will probably be easiest to use the one that attaches to the servo and only extends in one direction.
Apply hot glue to the top of the plastic piece. Use this to attach the small extra cardboard piece you cut out earlier to the servo. Be careful NOT to cover the screw hole, in case you need to make adjustments in the future (this is important, you will need to make adjustments). Then use the hot glue to attach that piece to the back of the creature part you will move.
Attach this piece to the servo, it should slide onto the white plastic end with the grooves.
Test the Servo
You should now have a fully assembled servo attached to the creature part you will move. To test out the servo, pull out your Arduino Board, and open the Arduino IDE on your computer. In the Arduino IDE, hover your mouse over Tools > Board and ensure that “Arduino Uno” is selected. Then to open up the example sketch go to File > Examples > Servo and select Sweep.
Once the sketch is open, use a USB cable to connect your Arduino to your computer. Once plugged in, you will need to go to Tools > Port and select the COM port that corresponds to your Arduino. If there are multiple COM ports, one way to figure out which is yours is to unplug and plug the Arduino back in. See which port goes away and shows back up.
You can go ahead and press the circle with the right arrow in the top left corner to upload the Sweep sketch onto your board. This may take a few moments.
Once the code is uploaded, unplug your board from the computer, all of the lights should turn off.
Now we are going to connect the servo motor. We are going to use a breadboard for this so that it is easier to expand the project with more stuff in the future. Use the rails of the breadboard to connect the red wire of the servo to the 5 Volt, the Black Wire to Ground, and the yellow wire of the servo to the Digital 9 pin.
With these wires connected, you can plug the Arduino board back into the computer. Since the code is already loaded, once you plug it in, it should start to sweep the creature part back and forth right away. Depending upon how you placed the plastic part that secures to the servo, the part may start in an odd position. Try to change this by adjusting the piece.
Give It Some Character
Depending on your character, you may be constrained by the start position and end position the part needs to sweep. To customize this, open back up the Sweep sketch in the Arduino IDE.
Notice the void loop. All of this code will repeat over and over. As you can see, there are two for loops. The first for loop moves the servo from position 0 degrees to a position of 180 degrees, while the second loop moves the servo from position 180 to position 0.
As it increments from 0 to 180 or 180 to 0, the motor increments by 1 degree and waits for 15 milliseconds to let the servo move to the new position. How can you adjust these parameters to make the part sweep faster/slower, or start/end at a different position?
Each time you change the parameters, you will need to reupload the code to the board.
Try using these parameters to change the speed and position of the movement to your liking.
Assemble Your Character
You now have a moving part, and a fully decorated creature. Use hot glue to attach your servo to the main body of the creature so that the part will move as you intended.
Once in place, you can plug in the arduino to check that it moves correctly.
You can now also use the base, and extra cardboard you cut out, along with the hot glue to make your creature stand up on its own.
That is it for the basic creature! It should now stand up on its own and move one of its body parts back and forth. Keep on following the tutorial to make your creature more advanced.
Manually Control the Position of the Servo
The last extension to this project will manually control your creature with a potentiometer. A potentiometer is a resistor with a sliding contact that serves as a voltage divider. This can indicate its current rotational position.
For this, we will change the sketch running on the Arduino. Open the Arduino IDE, hover your mouse over File > Examples > Servo and select Knob. Upload this new code to your Arduino.
Now make sure you unplug your Arduino while we change the circuit.
Pull out one of the potentiometers. Use alligator clips to connect to the metal leads sticking out of the potentiometer. You will want to use the black and red wires on the ends, and a different color (I used green) in the middle.
We will once again use the breadboard to connect the potentiometer to the Arduino. Connect the red alligator clip and wire to the 5 Volt rail on the breadboard, and the black clip and wire to the Ground rail. You will use the breadboard to connect the green clip and wire to the Analog 0 pin.
Now plug your Arduino back in. The servo may quickly move to the position the potentiometer is currently at. After that, you should be able to turn the potentiometer and see the creature move as you turn the knob.
Done
Congrats, you have completed the full tutorial! Enjoy manipulating your articulated creature. You will use the skills you developed through building this project in your future modules.