Arduino UNO Controlled Bipolar Stepper Motor with Half-Stepping Drive
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This circuit involves an Arduino UNO microcontroller controlling a Bipolar Stepper Motor (NEMA 17). The Arduino UNO is programmed to drive the stepper motor using a half-stepping technique. The connections between the Arduino and the stepper motor are established through digital pins D8, D9, D10, and D11.
Component List
Arduino UNO
- Description: A microcontroller board based on the ATmega328P.
- Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0, A1, A2, A3, A4, A5, SCL, SDA, AREF, D13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0
Bipolar Stepper Motor (NEMA 17)
- Description: A type of stepper motor with two coils (A and B) and four wires.
- Pins: A-, A+, B+, B-
Wiring Details
Arduino UNO
- D11: Connected to A- of Bipolar Stepper Motor (NEMA 17)
- D10: Connected to A+ of Bipolar Stepper Motor (NEMA 17)
- D9: Connected to B+ of Bipolar Stepper Motor (NEMA 17)
- D8: Connected to B- of Bipolar Stepper Motor (NEMA 17)
Bipolar Stepper Motor (NEMA 17)
- A-: Connected to D11 of Arduino UNO
- A+: Connected to D10 of Arduino UNO
- B+: Connected to D9 of Arduino UNO
- B-: Connected to D8 of Arduino UNO
Code Documentation
Arduino UNO Code
/*---------------------------------------*\
| Half-stepping drive of Bipolar Stepper |
\*---------------------------------------*/
// pins connected
#define Ap 10 // A+ line
#define Am 11 // A- line
#define Bp 9 // .
#define Bm 8 // .
void setup() {
// set output
pinMode(Ap, OUTPUT);
pinMode(Am, OUTPUT);
pinMode(Bp, OUTPUT);
pinMode(Bm, OUTPUT);
}
int I = 0;
void loop() {
// This is Half-step motion
if (I++ < 50) { // stop after 50*8 steps (=400) - one full turn with gearRatio "2:1"
delay(10);
digitalWrite(Bm, LOW); digitalWrite(Ap, HIGH); // Step 1
delay(10);
digitalWrite(Ap, HIGH); digitalWrite(Bp, HIGH); // Step 2
delay(10);
digitalWrite(Ap, LOW); digitalWrite(Bp, HIGH); // Step 3
delay(10);
digitalWrite(Bp, HIGH); digitalWrite(Am, HIGH); // Step 4
delay(10);
digitalWrite(Bp, LOW); digitalWrite(Am, HIGH); // Step 5
delay(10);
digitalWrite(Am, HIGH); digitalWrite(Bm, HIGH); // Step 6
delay(10);
digitalWrite(Am, LOW); digitalWrite(Bm, HIGH); // Step 7
delay(10);
digitalWrite(Bm, HIGH); digitalWrite(Ap, HIGH); // Step 8
} else while (1);
}
This code sets up the Arduino UNO to control the Bipolar Stepper Motor (NEMA 17) using a half-stepping technique. The motor will make one full turn with a gear ratio of 2:1, stopping after 400 steps.