Embedded SystemsAuthor:

Arduino Stepper Motor Positioning

A controller that positions a NEMA17 motor from a keypad-entered angle through an A4988 driver and reports status on an LCD.

ArduinoC++I2CA4988NEMA17
Arduino Stepper Motor Positioning

About the Project

This embedded controller converts a 0–360 degree target entered on a keypad into a NEMA17 stepper position. A 16×2 LCD reports target and current position, while two push buttons provide manual movement in both directions.

Goal

The project creates a standalone positioning interface that translates numeric user input into controlled motor motion.

How It Works

The 4×4 keypad is read over I2C through a PCF8574 expander. Digits are accumulated as the target angle; * clears the entry and # starts movement. Arduino maps the angle to a 0–3200 step range and calculates the difference from the current position. The sign selects the direction pin. For longer movements, pulse delays decrease and then increase in stages, forming a simple acceleration and deceleration profile.

Technologies

  • Arduino C++: input handling, position calculations, and pulse generation.
  • Keypad_I2C / PCF8574: keypad input over the shared bus.
  • LiquidCrystal_I2C: target and position feedback.
  • A4988 / NEMA17: STEP/DIR motor drive.

Project Structure

  • code/code.ino: keypad state, display output, manual movement, and automatic positioning.
  • libraries.rar: archive of the Arduino libraries used by the sketch.

Hardware

Arduino Uno/Mega/Nano, NEMA17, A4988, 12 V supply, 16×2 I2C LCD, 4×4 keypad, PCF8574, two buttons, and passive components.

Source Code

View the project on GitHub.