Summary of PIC Stepper Motor Controller using PIC16F84A with Proteus Simulation
This project uses a PIC16F84A microcontroller and ULN2003A driver to control a stepper motor bidirectionally via two push buttons (RA0 clockwise, RA1 counter-clockwise). The PIC generates four-bit stepping patterns on RB0–RB3, with a software delay controlling speed. Implemented and tested in Proteus, the design demonstrates bit-rotation step sequencing, driver interfacing for higher currents, and is suitable for learning embedded motor-control fundamentals without physical hardware.Parts used in the PIC Stepper Motor Controller using PIC16F84A with Proteus Simulation:
- PIC16F84A Microcontroller
- ULN2003A Darlington Driver IC
- Stepper Motor
- Push Buttons (2)
- Crystal Oscillator (1 MHz)
- Capacitors (1 nF ×2)
- Resistors (4.7kΩ ×2)
- Power Supply (+12V for motor)
Introduction
Stepper motors are widely used in embedded systems and DIY electronics projects where precise position control is required. This PIC Stepper Motor Controller microcontroller project uses a PIC microcontroller to control the direction of a stepper motor through simple push-button inputs. The project demonstrates how a PIC16F84A microcontroller can generate the required stepping sequence to rotate the motor clockwise or anticlockwise.
The system is implemented and tested using Proteus simulation, making it ideal for learning practical electronics and motor control fundamentals without needing physical hardware. The design also illustrates how driver circuits are used to interface microcontrollers with higher-current devices such as motors.
How the Project Works (Overview)
The project uses a PIC16F84A microcontroller to control a stepper motor through a ULN2003A Darlington driver array.
Two push buttons connected to the microcontroller determine the motor direction:
Button 1 (RA0) → rotates the motor clockwise
Button 2 (RA1) → rotates the motor counter-clockwise
The PIC generates a stepping sequence on four output pins (RB0–RB3). These signals are sent to the ULN2003A driver which amplifies the current and drives the stepper motor coils.
A delay routine controls the stepping speed, allowing the motor to rotate smoothly. Each time a button is pressed, the microcontroller shifts the output pattern to move the motor one step at a time.
Workflow Explanation
The project follows a simple embedded control workflow.
User Input
Two push buttons provide direction commands.
RA0 → clockwise
RA1 → counter-clockwise
Microcontroller Processing
PIC16F84A reads button states.
A stepping pattern is generated in software.
The pattern is rotated left or right depending on the selected direction.
Motor Driver Stage
ULN2003A driver receives the signals from PORTB.
It amplifies current to safely drive the stepper motor.
Stepper Motor Operation
Motor coils are energized sequentially.
This creates controlled rotation in either direction.
Key Features
Stepper motor control using PIC16F84A microcontroller
Bidirectional motor rotation using push buttons
ULN2003A driver interface for safe motor control
Software-based step sequence generation
Adjustable motor speed through delay routine
Demonstrates bit rotation logic for motor stepping
Fully testable in Proteus simulation
Components Used
PIC16F84A Microcontroller
ULN2003A Darlington Driver IC
Stepper Motor
Push Buttons (2)
Crystal Oscillator (1 MHz)
Capacitors (1 nF ×2)
Resistors (4.7kΩ ×2)
Power Supply (+12V for motor)
Applications
Projects like this are commonly used in many embedded systems and automation applications, including:
CNC machines
3D printers
Robotics movement systems
Automated positioning systems
Camera slider mechanisms
Industrial control systems
Educational microcontroller learning platforms
Explanation of Code
The firmware is written in PIC assembly language using MPASM.
The program performs the following tasks:
Port Initialization
The code configures PORTB pins RB0–RB3 as outputs to drive the stepper motor through the ULN2003 driver.
Motor Position Tracking
A variable called pos stores the current stepping pattern representing the energized motor coil.
Direction Control
The program continuously monitors PORTA inputs:
RA0 triggers clockwise rotation
RA1 triggers counter-clockwise rotation
Step Generation
Two routines manage motor movement:
stepcw – rotates the bit pattern left for clockwise motion
stepccw – rotates the bit pattern right for counter-clockwise motion
These bit rotations generate the sequence required for stepper motor coil activation.
Speed Control
A delay routine determines the stepping interval, which directly affects motor speed.
Source Code
LIST p=16F84 ; PIC16F844 is the target processor
#include "P16F84.INC" ; Include header file
CBLOCK 0x10 ; Temporary storage
pos
dc1
dc2
ENDC
LIST p=16F84 ; PIC16F844 is the target processor
#include "P16F84.INC" ; Include header file
CBLOCK 0x10 ; Temporary storage
ENDC
Complete Source Code
Proteus Simulation
Simulation behavior:
Pressing the clockwise button rotates the motor step-by-step in the forward direction.
Pressing the anticlockwise button rotates the motor in reverse.
The stepping pattern generated on PORTB pins energizes the motor coils sequentially.
The delay routine determines the speed of rotation.
This simulation demonstrates how a microcontroller project can be verified in Proteus before building real hardware.
Conclusion
This PIC stepper motor controller project demonstrates the fundamentals of motor control using embedded systems and Proteus simulation. By combining a PIC16F84A microcontroller with a ULN2003A driver, the system generates accurate stepping sequences that rotate the motor in both directions.
The project is simple enough for beginners yet practical for understanding real-world microcontroller interfacing techniques. It also serves as a great learning platform for exploring motion control, firmware development, and Proteus-based circuit simulation.
Complete File
PIC Stepper Motor Controller using PIC16F84A with Proteus Simulation
Quick Solutions to Questions related to PIC Stepper Motor Controller using PIC16F84A with Proteus Simulation:
- How does the project control motor direction?
Two push buttons on RA0 and RA1 select clockwise and counter-clockwise; the PIC shifts the output pattern left or right accordingly. - What microcontroller is used?
The project uses a PIC16F84A microcontroller. - How are the motor coils driven safely?
The ULN2003A Darlington driver amplifies current from PORTB before driving the stepper motor coils. - Which pins produce the stepping sequence?
PORTB pins RB0–RB3 output the stepping pattern. - How is motor speed adjusted?
Speed is controlled by a delay routine in software that sets the stepping interval. - Can this project be tested without physical hardware?
Yes, it is implemented and tested using Proteus simulation. - What language is the firmware written in?
The firmware is written in PIC assembly language using MPASM. - What does the pos variable do in the code?
pos stores the current stepping pattern representing the energized motor coil. - Which button rotates the motor clockwise?
Button on RA0 rotates the motor clockwise. - Which button rotates the motor counter-clockwise?
Button on RA1 rotates the motor counter-clockwise.
Related projects
PIC Musical Doorbell using PIC16F84A with Proteus Simulation
IntroductionThis microcontroller project demonstrates a musical doorbell built around a PIC16F84A and a simple piezo sounder.Using two push buttons, the system allows...
Beginner Tutorials · PIC16C84Exploring the World of PIC Microcontrollers: An Architectural Overview
A Peripheral Interface Microcontroller (PIC), developed by General Instruments Microcontrollers in 1993, operates under software control and is programmed to execute various...
Clocks & Timers · PIC16F84AIN-8 single nixie tube clock using PIC16F84
After receiving one IN-8 tube from a friend (thanks), I decided to build myself a clock. This clock is more an ornament...
Beginner Tutorials · PIC16F877APIC16F877 Driving LCD in 4-Bit Mode using PIC16F877 with Proteus Simulation
Introduction This microcontroller project shows how a PIC16F877 can drive an LCD display using 4-bit mode inside a Proteus simulation.The project demonstrates...
Beginner Tutorials · PIC18F4550PICDEM FS USB CDC Evaluation Board using PIC18F4550 with Proteus Simulation
Introduction The PICDEM FS USB CDC Evaluation Board is a practical microcontroller project built around the PIC18F4550, designed to demonstrate USB communication...
Beginner TutorialsPIC12CE518 I2C EEPROM using PIC12CE518 with Proteus Simulation
Introduction This microcontroller project demonstrates how to write and read data using the internal I2C EEPROM of the PIC12CE518 and visualize the...