In this instructable, one will be able to press a button on the key pad and depending on what character was pressed, the servo motor will turn a certain degree. The program will continuously loop every time a button is pressed.
Step 1: Parts Needed.
This instructable is pretty straight forward in terms of components. items needed will include:
1. arduino micro controller
2. 1 bread board
3. 4x4 matrix keypad
4. 1 micro servo
5. lastly, an assortment of wires to connect everything
Step 2: Set Up the Keypad and Servo
The set up is straight forward also.
I could not find the 4x4 matrix keypad like i used in the project so this is the closest compnent i could find.
the layout is the exact same so as long as you connect the 8 pins in the correct order, the result will still be the same.
1. start by connecting wires from the keypad to the arduino. starting from the farthest pin to the left of the keypad, connect it to the number 2 pin of the arduino. You will do this for all pins untill you get to the number 9 pin of the arduino. be sure to observe the diagram for a better understanding.
2. connect a red wire from the 5v pin on the arduino to the positive rail on the breadboard.
3. connect a black wire from the GND pin on the arduino to the negative rail on the breadboard.
4. Lastly, connect the power and ground wires to the 5v and gnd rails of the arduino. The middle yellow wire will be ran to the number 10 pin of the arduino.
Step 3: Code!
After all components have been properly connected, download the code and run the program. Like mentioned before, each character of the keypad will turn the servo to a pre-determined position. This servo will not turn a full 360 degrees, it will only rotate to 180 degrees.