For this exercise we will be using a numeric keypad to write angles to our servo motor. Specifically for this project you will need:
1 Arduino Micro Controller
1 Full Size Breadboard
1 Membrane/Numeric Keypad
1 Servo Motor
A Bundle of Copper Wires
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Connect the Keypad
To begin this process, we must add all of our respective pieces to the breadboard. Begin by running a copper wire from the 5V pin on the Arduino to the breadboard's power rail (+). Now run a copper wire from the GND pin to the ground rail on the breadboard (-). Once completed, we are ready to begin connecting our keypad. This can be done by starting with the leftmost pin on the keypad ribbon. From here, you should connect the keypad's ribbon to pins 5, 4, 3, and 2 respectively. Starting at pin 5 from the left side of the keypad ribbon, you should connect the ribbon to pins 9, 8, 7, and 6 respectively. See the provided image above for additional details.
Step 2: Connect the Servo Motor
At this point you should have your keypad set up and ready to go. We will now connect our servo motor to the Arduino and breadboard. This is done by connecting the middle red wire to the power rail (+), connecting the black/brown wire to the ground rail (-), and lastly connecting the last wire to pin 12 on the Arduino.
Step 3: Test the Application
Now that all pieces are in place, the project should now be functional. As mentioned, the keypad will be used to enter in digits. These 3 input digits will control the servo's angle. For example, entering "015" on the keypad will set the servo to approximately 15 degrees. If the input text is not a number the servo will reset back to 0. I have provided source code that will allow you to test this application.