KeyPad-controlled Servo

145

1

Posted in TechnologyArduino

Introduction: KeyPad-controlled Servo

The main objectives of this project are:

- Receive 3 inputs from a membrane keypad

- Write data from 3 inputs as a single number servo position to the servo

Requirements:

- Ignore non-number inputs

- Servo position cannot exceed 180 degrees (unless servo supports full 360 degree rotation)

Materials:

- 4x4 membrane keypad

- servo

- Arduino UNO

- 11 wires

Step 1: Connect Servo

Connect the servo as follows:

- V+ on servo to 5v pin on Arduino

- Ground on servo to gnd on Arduino

- Pulse on servo to pin 11 on Arduino

Step 2: Connect the Key Pad

Connect the pins of the key pad starting from the right most pin to pins 2 through 9 on the Arduino.

Step 3: Upload Code

Using an Arduino IDE, upload the given code to the Arduino. Enjoy!

Step 4: Common Issues

Issue: (int)char will return the ASCII code, not the integer

Solution: Create method using a list of chars and a for-loop to convert chars

Issue: servo continues rotation at numbers below 5 degrees

Solution: Covert any inputs below 5 degrees to 5 degrees

Share

    Recommendations

    • Microcontroller Contest

      Microcontroller Contest
    • Casting Contest

      Casting Contest
    • Make it Move Contest

      Make it Move Contest
    user

    We have a be nice policy.
    Please be positive and constructive.

    Tips

    Questions

    Comments