Hello friends, I hope you all are doing great. Today, I am going to share the new NEMA 17 Stepper Motor Library for Proteus V1.0. The NEMA 17 is the black square stepper that moves almost every hobby 3D printer, laser engraver, CNC router and camera slider. It turns in exact 1.8 degree steps, holds its position with real force and, with a modern driver, moves in microsteps so fine that it glides.
NEMA 17 Stepper Motor Library for Proteus
Latest version: V1.0 (October 2026, this tutorial)
Other motors: SG90 Servo · TT Gear Motor · 28BYJ-48 Stepper · MG996R Servo · N20 Encoder Motor · JGA25-370 Encoder Motor · FS90R 360 Servo · 130 DC Motor · A2212 Brushless · X27.168 Gauge · Analog Panel Meter · DC Tachogenerator · LM393 Speed Sensor · MG90S Servo · DS3218 Servo · L12 Linear Servo · JGB37-520 Motor · RS-775 Motor · JGY-370 Worm Motor · 12V Linear Actuator · Coin Vibration Motor · Mini Submersible Water Pump · 12V Peristaltic Pump · 4-Pin PC Fan · 12V Push-Pull Solenoid · NEMA 23 Stepper Motor · Micro Linear Stepper · TYJ50 Synchronous Motor · Quartz Clock Movement · Air-Core Gauge · Electromechanical Counter · Split-Flap Display · Electric Bell · Wind Turbine · 8520 Coreless Motor · Car Wiper Motor · Car Door Lock Actuator · 12V Solenoid Water Valve · 12V Holding Electromagnet
Motor drivers: L298 · L9110S · TB6612FNG · BTS7960 · A4988 / DRV8825 · 28BYJ-48 + ULN2003 · PCA9685 Servo · Relay Module · 30A Brushless ESC · TB6600 Stepper Driver
Helping Tools
- Serial Monitor Advance: a serial terminal window for the UART of your board
- Serial Monitor Expert: the serial monitor with extra debugging tools
- LCD Library for Proteus V3.0: 16x2, 20x4 and I2C LCDs to show your readings
This library gives the NEMA 17 a part of its own in Proteus. Its two coils sit in your circuit with their resistance, inductance and back-EMF, so any driver runs it: a current-chopping A4988 or DRV8825, a voltage H-bridge like the L298N, L293D or TB6612, even plain transistors. The motor reads its own coil currents and tells you what the driver does - full steps, half steps or microsteps - and, like the real one, it cannot start at full speed and it loses steps when it is overloaded. A dial on the shaft turns on your schematic and a pop-up window draws the coil currents live. The demo runs on our Arduino UNO V4.0 with our A4988 driver.
NOTICE: a stepper motor is only half of a motion system; the other half is how it is driven. So we built a motor that does not care which driver you use, solves its coils together with the driver in the circuit and slips when it should. It took our team a lot of hard work. Your feedback is the fuel that keeps us going, so please tell us what you think in the comments below or in the Motor Driver board of our forum. And if our free libraries help you, you can buy us a coffee. So, let's get started with the NEMA 17 Stepper Motor Library for Proteus V1.0:
What is the NEMA 17 Stepper Motor?
NEMA 17 is not one motor but a frame size: NEMA, the US National Electrical Manufacturers Association, defines the mounting face, and size 17 means a 1.7 inch, 42.3 mm square flange with four M3 holes. Inside almost every NEMA 17 is the same kind of motor: a hybrid stepper with a toothed magnetic rotor and two coils, making 200 full steps per turn, 1.8 degrees each. The motors differ in length, current and torque; the one in most 3D printers is the 17HS4401, and that is the one our model follows.
| NEMA 17 (17HS4401 class, the model) | |
|---|---|
| Frame | 42.3 mm square flange, four screws |
| Type | hybrid stepper, bipolar, two phases (coils A and B) |
| Step angle | 1.8 degrees - 200 full steps per turn (50 rotor teeth) |
| Rated current | 1.7 A per coil |
| Coil | 1.5 ohm, 2.8 mH |
| Holding torque | about 40 N.cm with both coils at 1.7 A |
| Wires | A+ black, A- green, B+ red, B- blue (colours vary by maker) |
Bipolar Coils Need an H-Bridge
Unlike the small 28BYJ-48, a NEMA 17 has no common wire. It is bipolar: two separate coils, each with two ends, and to step the rotor the current in each coil must flow one way and then the other. That takes a full H-bridge per coil. An L298N or L293D does it with voltage; a dedicated stepper driver such as the A4988 or DRV8825 does it with current control and does the step sequence by itself, so the Arduino only sends STEP and DIR pulses.
Full Steps, Half Steps and Microsteps
In full steps both coils carry the same current, switched in turn from plus to minus: the currents are square waves 90 degrees apart, and the rotor jumps 1.8 degrees at a time with a small ring after each jump - the familiar stepper buzz. Half steps switch one coil off between full steps. Microsteps go further: the driver sets the two coil currents to the sine and cosine of an angle, so the magnetic field turns smoothly and the rotor follows it in 1/4, 1/8 or 1/16 of a step. At 1/16 a turn is 3200 steps, and the motor runs quietly.
Current Choppers and Voltage Bridges
A NEMA 17 coil has only 1.5 ohm, so 5 V across it would push over 3 A. A voltage H-bridge must therefore run at a low voltage, and then the coil's inductance makes the current rise slowly at speed: the torque falls away early. A current chopper like the A4988 uses a high supply, 12 V or more, and switches it on and off to hold the current at the limit you set. The current rises fast and the torque holds to higher speeds. The model shows both behaviours, because its coils are solved together with whatever drives them.
What's New in NEMA 17 Stepper Motor Library for Proteus V1.0
- A part of its own: wire it to any driver - our A4988 or DRV8825, an L298N, L293D or TB6612, transistors.
- Coils in the circuit: resistance, inductance and back-EMF of both coils, solved with the driver at every analog step.
- The physics of the rotor: 50 teeth, the torque of the two coils, the detent torque, inertia, friction and a load. It needs a ramp to reach speed and loses steps when it is driven too fast or loaded too much.
- It reads its driver: full step, half step, wave drive and 1/4 - 1/32 microsteps are recognised from the coil currents, with the step rate, the direction and the lost steps.
- A dial that turns on the schematic to the simulated shaft angle, and two coil LEDs that show the current's direction.
- A pop-up window with four pages - Motor, Graphs, Event log and Check - and the coil currents drawn live.
- An A4 demo on our Arduino UNO V4.0 with our A4988 driver and a potentiometer.
Our A4988 / DRV8825 Stepper Motor Driver Library for Proteus has a NEMA 17 of its own, but that motor only runs on our A4988 and DRV8825 parts. That library stays as it is; the new motor is a standalone part for any driver, with a pop-up of its own.
The NEMA 17 in Proteus
Search NEMA in Pick Devices; the device NEMA17STEPPERTEP is in TEPNEMA17.LIB (category Electromechanical, Stepper Motors) and its model is TEPNEMA17.DLL. It is drawn from the shaft end: the black 42.3 mm flange with its four screws, the round boss, and a white dial on the shaft over a degree scale. The four wires - B- blue, B+ red, A+ black and A- green - run to the pins on the left.
The red hand on the dial turns to the simulated shaft angle. The coil LEDs A and B light green while the coil's current flows from + to - and red when it flows the other way, so in full steps you see them swap colours in turn. Under the plate the strip shows the speed with its direction, the angle and the steps, and the OPEN PANEL button. The plate, the LEDs and the strip are TEP additions; the real motor has none of them.
The Pins and the Properties
| Pin | Wire | What the model does with it |
|---|---|---|
| A+ / A- | black / green | coil A: 1.5 ohm, 2.8 mH and its back-EMF in the circuit |
| B+ / B- | red / blue | coil B: the same |
| Property | Default | What it does |
|---|---|---|
| LOAD | 0 | a constant load on the shaft in N.cm (it holds about 40 N.cm with both coils at 1.7 A) |
| START | 0 | the dial's angle at the start, in degrees |
A Click on the Dial: the Brake
Click the dial while the simulation runs and you hold the shaft with a 50 N.cm brake - stronger than the motor. Any move you ask for now is lost, step by step. The demo uses it to show the one thing a stepper cannot tell you: that it slipped.
Download NEMA 17 Stepper Motor Library for Proteus
The download link of NEMA-17-Stepper-Motor-Library-for-Proteus-v1.0.zip (without the source code) will be added here soon. The zip file will contain:
- README.txt: installation, the demo, the wiring, the properties, real hardware, troubleshooting and the limits.
- Proteus Library Files:
TEPNEMA17.LIBandArduinoV4TEP.LIBfrom our Arduino Library for Proteus V4.0. - Proteus Model Files:
TEPNEMA17.DLLandTEPARDUINO.DLL. - Proteus Simulation:
NEMA17-Stepper-A4988-ArduinoUnoV4.pdsprj,NEMA17_Stepper_Demo.hexand copies of the two DLLs. - Arduino Code:
NEMA17_Stepper_Demo.ino(no library needed).
Important: the A4988 driver of the demo is not in this package. It is our separate A4988 / DRV8825 Stepper Motor Driver Library for Proteus: download it from its own article and install its TEPSTEPPER.LIB and TEPSTEPPER.DLL first, then this library.
No Proteus yet? Read How to Download and Install Proteus 7 and 8. New to libraries? Follow How to Install a New Library in Proteus.
How to Install NEMA 17 Stepper Motor Library for Proteus
- Close Proteus and extract the whole zip file, for example to your Desktop.
- Copy
TEPNEMA17.LIBandArduinoV4TEP.LIBfrom Proteus Library Files into the LIBRARY folder of Proteus (usuallyC:\Program Files (x86)\Labcenter Electronics\Proteus 8 Professional\LIBRARY). - Copy
TEPNEMA17.DLLandTEPARDUINO.DLLfrom Proteus Model Files into the MODELS folder. The two Arduino files are the ones of our Arduino Library V4.0; if you have it, they are the same. - For the demo, install our A4988 / DRV8825 library the same way:
TEPSTEPPER.LIBinto LIBRARY andTEPSTEPPER.DLLinto MODELS. - Delete
TEPNEMA17.IDXfrom the LIBRARY folder if it is there. - Start Proteus, press P and search for NEMA.
Tip: keep the Proteus Simulation folder together, because the project needs its .hex file and the DLLs beside it. The library is tested in Proteus 8.5; Proteus 7 is not supported.
The Demo Circuit
Open NEMA17-Stepper-A4988-ArduinoUnoV4.pdsprj. ARD1 is an Arduino UNO V4.0 from our Arduino UNO Library for Proteus V4.0, running NEMA17_Stepper_Demo.hex with its serial monitor built in. DRV1 is the A4988 from our separate A4988 / DRV8825 library, in its pop-up version, with VMOT on a +12V power terminal and its current limit at 0.99 A per coil. M1 is the NEMA 17, its coils straight on the driver's outputs. RV1 is a 10k potentiometer on A0: the dial follows it from 0 to 360 degrees. New to the A4988? Read our Introduction to A4988.
| A4988 | Arduino UNO / motor | Note |
|---|---|---|
| STEP | D3 | one pulse = one (micro)step |
| DIR | D4 | the direction |
| EN | D8 | LOW = the driver on |
| MS1 MS2 MS3 | D9 D10 D11 | all HIGH = 1/16 microsteps |
| RST, SLP | 5V | tied together |
| VDD, GND | 5V, GND | the logic supply |
| VMOT, GND | +12V, GND | the motor supply (a 100 uF capacitor on a real board) |
| 1A / 1B | A+ / A- | black / green |
| 2A / 2B | B+ / B- | red / blue |
In Proteus every control pin of the driver reaches the UNO through a net label, and the motor's wires go straight to the driver's outputs in neat rows. The A4988 opens its own pop-up at Run too; for it the motor is simply a load on its outputs.
The Arduino Code
The demo needs no library: it makes the STEP pulses itself, with an acceleration ramp. New to Arduino? Start with Arduino Tutorial for Beginners and Introduction to Arduino UNO; our older Stepper Motor Speed Control using Arduino tutorial explains stepper speed control too. The pins come first:
const byte STEP = 3, DIR = 4, EN = 8, MS1 = 9, MS2 = 10, MS3 = 11, POT = A0;
const int FULL_STEPS = 200; // per turn (1.8 deg)
Four small helpers turn the microstep setting into steps per turn, a top speed, an acceleration and an angle:
long perTurn() { return (long)FULL_STEPS * res; }
float maxSpeed() { return rpm * perTurn() / 60.0; }
float stepsPerS2() { return accel * perTurn(); }
float toDeg(long p) { return p * 360.0 / perTurn(); }
The microsteps are set with the three MS pins. The A4988's table is in the comment: all LOW for full steps, all HIGH for 1/16:
void setRes(int r) {
byte m1 = 0, m2 = 0, m3 = 0; // A4988: LLL full, HLL 1/2, LHL 1/4, HHL 1/8, HHH 1/16
if (r == 2) m1 = 1; else if (r == 4) m2 = 1; else if (r == 8) { m1 = 1; m2 = 1; } else if (r == 16) { m1 = 1; m2 = 1; m3 = 1; }
digitalWrite(MS1, m1); digitalWrite(MS2, m2); digitalWrite(MS3, m3);
void setup() {
pinMode(STEP, OUTPUT); pinMode(DIR, OUTPUT); pinMode(EN, OUTPUT);
pinMode(MS1, OUTPUT); pinMode(MS2, OUTPUT); pinMode(MS3, OUTPUT);
digitalWrite(EN, LOW);
setRes(16);
The heart of the sketch is the ramp. A NEMA 17 cannot jump to full speed - its rotor has inertia and would fall behind the field - so the speed grows step by step, and near the target it shrinks again just in time to stop on it:
// the ramp: speed up by accel, slow down in time to stop on the target
float a = stepsPerS2();
if (!moving) { moving = true; speed = 0; nextStep = now; }
float stopDist = speed * speed / (2 * a);
if (abs(togo) <= stopDist + 1) speed = max(sqrt(max(speed * speed - 2 * a, 0.0f)), sqrt(2 * a) * 0.5f);
else speed = min(sqrt(speed * speed + 2 * a), maxSpeed());
Then one step is one short pulse on STEP, with DIR set first. The time to the next step is one over the speed:
digitalWrite(DIR, togo > 0 ? HIGH : LOW);
digitalWrite(STEP, HIGH); delayMicroseconds(2); digitalWrite(STEP, LOW);
position += togo > 0 ? 1 : -1;
nextStep += (unsigned long)(1e6 / speed);
release and hold switch the driver off and on with EN. Off, no current flows and nothing holds the shaft:
if (!strcmp(s, "release")) { mode = FIXED; target = position; digitalWrite(EN, HIGH); enabled = false; Serial.println(F("Released: the driver is off (EN HIGH)")); return; }
if (!strcmp(s, "hold")) { digitalWrite(EN, LOW); enabled = true; Serial.println(F("Holding: the driver is on (EN LOW)")); return; }
The HEX file is in the package. To change the sketch, open it in the Arduino IDE and export the compiled binary, as in How to get the HEX file from Arduino. It needs 9,742 bytes of flash (30 % of the UNO) and 305 bytes of RAM. For bigger projects the AccelStepper library does the same ramp for you.
Running the Demo
Press Run. The UNO's serial monitor and the two pop-ups - the motor's and the A4988's - open over the schematic; move them aside. RV1 starts at 40 %:
NEMA 17 Stepper demo - The Engineering Projects
A4988: STEP D3, DIR D4, EN D8, MS1-MS3 D9-D11 (1/16: 3200 steps per turn). The dial follows the pot on A0.
Commands: a 90 | s 200 | rpm 60 | ms 16 | release | hold | knob | help
Pot 410 -> target 1282 steps (1/16) = 144.2 deg
At 144.2 deg - holding
The dial ramps up, glides to 144.1 degrees and holds there. The motor reads its driver from the coil currents: 1/16 MICROSTEP, 0.99 A - the current limit of the A4988 - and the coil LEDs are lit.
| Type | What it does | What the run showed |
|---|---|---|
| a 90 | go to that angle and stay | a 270: exactly 270.0 degrees |
| s 200 | 200 FULL steps from here (minus goes back); 200 = one turn | rpm 120 + s -200: one turn back to -90.0 degrees |
| rpm 60 | the top speed, 1 - 600 RPM | the move peaked at 81 RPM: one turn is too short to reach 120 with this ramp |
| ms 16 | the microsteps: 1, 2, 4, 8 or 16 | ms 1: FULL STEP, square currents |
| release / hold | the driver off (EN HIGH) / on again (EN LOW) | RELEASED, 0 A / COILS ON, 0.99 A |
| knob | follow the pot on A0 again | the dial follows - but see the lost steps below |
| help | the list of commands |
Note the line about the top speed. With rpm 120 and one turn to go, the ramp of two turns per second squared spends half the turn speeding up and half slowing down, so the shaft peaks at 81 RPM before it has to brake. Longer moves reach the full speed.
The Pop-Up Window
At Run the motor opens TEP NEMA 17 Stepper Motor, a window in the look of our TEP Serial Monitor Advance for Proteus. It has four tabs - Motor, Graphs, Event log and Check - plus Settings and Help behind the gear and question mark icons. If you close it, the OPEN PANEL button on the strip brings it back.
Motor
The banner gives the state: RUNNING with the direction, the speed, the step rate and the drive; HOLDING; RELEASED; or LOSING STEPS. The dial shows the shaft in red and where the coils ask it to be in orange. The live values are the angle, the position in full steps, the speed, the step rate, the drive, the direction, the lost steps and the two coil currents.
Look at the currents while it holds: coil A carries 0.55 A and coil B 0.82 A. Neither is the 0.99 A limit, yet together they are: the A4988 sets them to the cosine and sine of the microstep angle, and the square root of 0.55 squared plus 0.82 squared is 0.99. That is microstepping in one picture.
At the bottom of the page the two coil currents are drawn over the last 40 ms. During a 1/16 microstep move they are a smooth sine and cosine, a quarter of a cycle apart - the turning magnetic field that pulls the rotor round.
Type rpm 20, ms 1 and s 200 and the same page shows full steps: square waves, each coil switching between plus and minus 0.70 A. In full steps the A4988 drives both coils at 70.7 % of its limit. The shaft makes one turn of full steps to 270.0 degrees:
s 200
steps -> target 150 steps (1/1) = 270.0 deg
At 270.0 deg - holding
Graphs
Graphs draws the angle of the shaft against the position the coils ask for, the speed and the coil current over the last 2, 6 or 15 seconds. Each ramped move shows as a smooth S in the angle and a bell in the speed. The current graph shows the vector of both coils; at high speed it drops when the supply can no longer push the current against the back-EMF. Freeze holds the page.
Event Log
The Event log keeps the run: the coils on, the drive ("DRIVE 1/16 MICROSTEP (3200 steps per turn)"), every move and stop ("HOLDING at 150.0 full steps - the move peaked at 166 steps/s (50 RPM)"), the release, the load, the lost steps and the warnings - even a note that a held motor gets warm. Filter it by motion or warnings, pause it or clear it.
An Open-Loop Stepper Never Knows
A stepper motor has no sensor. The sketch counts the steps it sends and assumes the shaft followed. Click the dial (or the Brake chip on the pop-up), type ms 16, rpm 60 and a 0, and watch:
a 0
angle -> target 0 steps (1/16) = 0.0 deg
At 0.0 deg - holding
The sketch reports "At 0.0 deg - holding". The shaft never moved: it is still at 270 degrees. The model counts the slip in whole rotor teeth, 4 full steps at a time, and ends at 148 full steps lost of the 150 asked. The Check page puts it in red next to the coils, the current, the drive, the rate and the load - and its load row explains why: with 0.99 A in the coils the motor holds about 16 N.cm, far less than the brake.
Type release, hold and knob:
release
Released: the driver is off (EN HIGH)
hold
Holding: the driver is on (EN LOW)
knob
Following the pot on A0
Pot 410 -> target 1282 steps (1/16) = 144.2 deg
At 144.2 deg - holding
The sketch steps 1282 microsteps to the pot's 144.2 degrees and is happy. The shaft makes the same move - from where it really was - and stops 266 degrees off its target, as the Graphs page above shows. Nothing will fix that until the machine finds its zero again, which is why 3D printers and CNC machines drive every axis to a limit switch when they start: the homing run.
The A4988 Pop-Up
The A4988's own window shows the other side of the same moment: its translator at 1/16, the step count, the current limit of 0.99 A per coil (VREF 0.54 V) and the coil current vector it aims for. It says "no TEP motor on the outputs", because the NEMA 17 is a plain load for it, just as a real motor is for a real driver.
How the Model Works
Each coil is in the circuit as its backward-Euler companion over the analog step - a conductance and a source - so the driver and the coil are solved together: an A4988 chopping 12 V sees its current rise at about VMOT / L, an L298N sees the slow L / R rise. While the motor moves, the analog step is held to 100 us. The rotor follows the solved currents in 10 us slices: the torque of the two coils on 50 teeth, the detent torque, the inertia of the rotor with its dial, the friction and the load. When the rotor falls behind the field by more than a tooth it slips, and the step is lost.
We checked the model on a PC with 27 automatic tests: 3200 microsteps at 1/16 turn it exactly 360 degrees at 60 RPM, 200 full steps and 400 half steps do the same, the drive is read correctly, a brake while it moves loses 100 full steps, an L298N-style drive turns it and warns at 2 A, and at 600 RPM with no ramp it cannot start.
Troubleshooting
- The dial never moves and the pop-up says RELEASED: no coil current - the driver is off (EN HIGH, SLP or RST LOW), VMOT is missing or the current limit is 0.
- It only vibrates: the coils are mixed up - one coil's two wires belong on 1A / 1B and the other's on 2A / 2B. The Check page warns when one coil gets no current.
- It turns the wrong way: swap the two wires of ONE coil, or invert DIR in the sketch.
- It ends short of the target (LOSING STEPS): too fast, no ramp, too little current or too much load.
- No driver in Pick Devices: install our A4988 / DRV8825 library (
TEPSTEPPER.LIB/TEPSTEPPER.DLL). - No dial, no UNO or no monitor:
TEPNEMA17.DLLorTEPARDUINO.DLLis missing from MODELS and the project folder; a closed monitor opens again with a click on the UNO's USB port.
Things to Know Before Using a Real NEMA 17
- Set the current limit first: on most A4988 boards Itrip = VREF / (8 x 0.068 ohm), so VREF 0.54 V gives about 1 A per coil. Turn the trimpot before you connect the motor.
- Never connect or disconnect the motor while VMOT is on: the voltage spike destroys the driver.
- A capacitor on VMOT: put 100 uF across VMOT and GND, close to the driver.
- Heat: a held motor draws its current all the time and gets warm; EN HIGH lets it rest, but then nothing holds the shaft.
- Wire colours vary: find the two coils with a multimeter - about 1.5 ohm within a coil, open between them.
Limitations of the Simulation
- Not modelled: magnetic saturation, iron losses beyond a damping term, heating, the resonances of a real machine and the differences between real motors.
- The plate, the coil LEDs, the strip and the brake are TEP additions.
- The model is our own, written from the typical data of the 17HS4401-class NEMA 17; this library is not made or endorsed by Arduino or Labcenter.
- Licences: the demo HEX contains the Arduino AVR core 1.8.6 (LGPL); the sketch is included and the README gives the source link. The potentiometer is Proteus's own; the A4988 driver is our separate library.
- Tested in Proteus 8.5 in October 2026 with the demo as shipped: the knob, a 270, rpm 120 with s -200, full steps, the brake with a 0, release, hold, knob, all four pages of the pop-up and the A4988's pop-up. Proteus 7 is not supported.
So, that was all about the NEMA 17 Stepper Motor Library for Proteus V1.0. I hope it helps you see what a stepper and its driver really do together - the microsteps, the ramp, the current and the steps that slip away - before you build your printer, slider or CNC. If you have any questions, ask in the comments and I will help you out. Till the next tutorial, take care and have fun!