Arduino Giga R1 WiFi Stepper Motor A4988 Driver

In this guide, we will learn how to build the drive of a small syringe pump with the Arduino Giga R1 WiFi. The Giga counts out pulses, an A4988 driver turns the pulses into motor current, and a NEMA 17 stepper motor turns a lead screw (a long threaded rod). The screw presses on the plunger of a syringe, and a measured dose comes out. In detail, we will learn:

Arduino Giga R1 WiFi drives a NEMA 17 syringe pump with an A4988 driver

Dosing is counting. A stepper motor answers each pulse with the same small turn, so 200 pulses move the plunger by the same distance today and tomorrow. The Giga only has to remember how many pulses it has sent. A DC motor makes no such promise, and it would need a position sensor for this job.

One warning before we start: this is a bench toy for colored water, plant food or glue. A home-made pump must never give medicine to people or animals.

Hardware Preparation

1×Arduino Giga R1 WiFi
1×USB Cable Type-A to Type-C (for USB-A PC)
1×USB Cable Type-C to Type-C (for USB-C PC)
1×Stepper Motor Nema 17
1×A4988 Stepper Motor Driver
1×Expansion Board for A4988
1×12V Power Adapter
1×DC Power Jack
1×Jumper Wires
1×Recommended: Screw Terminal Block Shield for Arduino Uno/Mega/Giga
1×Recommended: Sensors/Servo Expansion Shield for Arduino Mega/Giga
1×Recommended: Breadboard Shield for Arduino Mega/Giga
1×Recommended: Enclosure for Arduino Giga
1×Recommended: Power Splitter for Arduino Giga

Or you can buy the following kits:

1×DIYables Sensor Kit (18 sensors/displays)
Disclosure: Some of the links provided in this section are Amazon affiliate links. We may receive a commission for any purchases made through these links at no additional cost to you.
Additionally, some of these links are for products from our own brand, DIYables .

No expansion board at home? It is an extra, not a must. The second wiring diagram connects the bare A4988. You also need no screw and no syringe today: a paper flag on the motor shaft tells you whether a move was right.

Overview of A4988 Stepper Motor Driver

Sixteen pins, one chip and one trimmer: the DIYables A4988 module holds little more than that. It is red, has the common StepStick shape, and covers just 20 x 15 mm or so. The pins come soldered. The package also holds a small stick-on heat sink, and its place is on the black chip.

A4988 Driver Module
It drives a single bipolar stepper (a 6-wire motor works as a 4-wire one)
Motor power on VMOT 8V to 35V DC; this guide uses 12V
Logic power on VDD 3V to 5.5V; this guide uses 3.3V
Coil current near 1A with a bare chip; 2A at most, with the heat sink and good cooling
Smallest move 1/16 of a full step (1/8, 1/4, 1/2 and full are possible too)
Inputs it needs two, called STEP and DIR
It protects itself from overheating, too low supply voltage, crossover current
Error output no FAULT pin

Your code has an easy life with this chip. Which coil gets current now, and which way round? A block inside the A4988, the translator, knows the whole pattern. The Giga only says "go" and "that way". "Go" is a rising edge on STEP, the jump from LOW to HIGH. "That way" is the level on DIR.

The A4988 also looks after the coils. It watches their current and cuts the supply for a moment whenever your limit is reached. This fast on and off has a name, chopping. Thanks to it, 12V is no danger for a motor that is rated for 2 to 4V.

Pinout

A4988 module pinout - control pins on the left side, power and coil pins on the right side

Let's sort the pins by the work they make for you.

Four pins meet the Giga:

  • STEP pin: connect to D4. It receives the pulses.
  • DIR pin: connect to D3. HIGH is one direction, LOW is the other.
  • VDD pin: connect to 3.3V. It feeds the logic of the chip.
  • GND pin below VDD: connect to GND.

Six pins meet the power jack and the motor:

  • VMOT pin: connect to the plus terminal of the power jack.
  • GND pin below VMOT: connect to the minus terminal. Inside the module, this pin and the GND below VDD are one.
  • 2A and 2B pins: connect to the two ends of one coil (coil 2 in the picture).
  • 1A and 1B pins: connect to the two ends of the other coil (coil 1).

Two pins meet each other:

  • RST and SLP pins (reset and sleep): a LOW on either one stops the driver. The module holds SLP at HIGH, but RST floats, which means it has no fixed level. A short link shares the HIGH of SLP with RST.

Four pins stay empty:

  • EN pin: the module keeps it LOW, which means "outputs on". A HIGH here would release the shaft.
  • MS1, MS2 and MS3 pins: an empty one reads LOW, and LOW on all three means full steps.

Your board may say B2, A2, A1, B1 instead of 2B, 2A, 1A, 1B. The first spelling is on its top side, the second one underneath. The pins are the same.

Why VDD Gets 3.3V

A DRV8825 makes its logic voltage by itself. The A4988 does not, so a wire has to bring it to VDD. With the Giga, this wire starts at a 3.3V pin and never at 5V.

The reason is a simple border line. The driver compares STEP and DIR with VDD: only a signal of more than 70% of VDD is surely HIGH. Give VDD 5V, and the border lies at 3.5V. A Giga pin reaches 3.3V and no more, so pulses could go missing, and each missing pulse makes the dose smaller. Give VDD 3.3V, and the border falls to 2.31V. Now the pulses of the Giga are well above it.

5V would put the Giga itself at risk too, because its pins do not tolerate more than 3.3V. Look at the header of the expansion board: the V column and the S column are neighbors. If you push a jumper into the wrong column, the Giga pin gets the voltage of V.

The Motor: Four Wires, Two Coils

Count the wires of the motor. A bipolar NEMA 17 has four of them, the ends of two coils. The shaft turns 1.8 degrees at every full step, so it is back at the start after 200 of them. Each coil gets its own pair of driver pins:

Wire pairs of a NEMA 17 - A with C (black, green) is one coil, B with D (red, blue) is the other
Coil Wire Our Motor Other Name A4988 Pin
coil 2 A black A+ 2B
coil 2 C green A- 2A
coil 1 B red B+ 1A
coil 1 D blue B- 1B

In some datasheets, the plus ends are plain A and B, and the minus ends are the same letters with a bar on top.

Check these colors against your own motor, since every factory has its own habit. Lost the paper? Let the multimeter find the pairs: a few ohms between two wires says "same coil". It works by hand as well, with the motor unplugged: hold two bare wire ends against each other and twist the shaft. When it suddenly gets hard to turn, these two belong together.

A mix-up inside one pair does no harm, the motor just runs the other way round. A mix-up between the pairs is different: the motor buzzes and shakes without turning.

Step Size

A full step can be too coarse for a slow, even flow, so MS1 to MS3 can divide it. On the expansion board, you do that with the DIP block, one switch per MS pin. The ON side makes the pin HIGH. Mind the numbers: switch 1 belongs to MS3, switch 2 to MS2 and switch 3 to MS1.

Step Pulses per Turn Switch 1 (MS3) Switch 2 (MS2) Switch 3 (MS1) Plunger Moves per Pulse
full 200 off off off 0.01 mm
1/2 400 off off ON 0.005 mm
1/4 800 off ON off 0.0025 mm
1/8 1600 off ON ON 0.00125 mm
1/16 3200 ON ON ON 0.000625 mm

The last column belongs to our example screw, which moves the plunger 2 mm in one turn. As the steps get finer, the motor gets quieter and the liquid flows more evenly, but a dose then takes more pulses. The code has to know about it. Whenever you flip a switch, change MICROSTEPS as well. For this guide, leave all three off.

Wiring Diagram

There are two ways to build the drive, and both use the same Giga pins. So the same code runs on both.

Build 1: A4988 on the Expansion Board

This 42 x 42 mm board takes over the boring part of the work. It has sockets for the module, screws for 12V, a plug for the motor and the DIP block. It also carries a 100uF / 35V capacitor, and it links RST with SLP. Four jumper wires to the Giga are all that is left.

The wiring diagram between Arduino Giga R1 WiFi A4988 stepper motor driver  with expansion board and NEMA 17

This image is created using Fritzing. Click to enlarge image

※ NOTE THAT:

  • The sockets accept the module both ways round, but only one way is right. Its EN-to-DIR row sits next to the G V S header, and its VMOT pin sits at the little arrow marked "VIN". Turned around, the module can be destroyed.
  • An A4988 gets no logic power without the V wire. (On the same board, a DRV8825 does not need it.)
  • Unplug 12V before you plug in or pull out the motor. Under power, this makes a voltage spike that the A4988 may not survive.
From To the Expansion Board
Giga D4 STEP row, S column
Giga D3 DIR row, S column
Giga 3V3 V column, any row
Giga GND G column, any row
nothing EN row, S column (empty = driver on)
power jack, plus VIN screw
power jack, minus GND screw
coil 2, wires A and C motor plug, 2B and 2A
coil 1, wires B and D motor plug, 1A and 1B

Some hints for the picture:

  • It puts both V and G into the EN row. Any other row is just as good, because each of these two columns is one line on the board.
  • Its 3V3 comes from the small header close to the USB ports, and its GND lies between pin 13 and AREF. Each 3.3V pin and each GND pin of the Giga does the same job.
  • Brown, yellow, pink and purple are only there to tell the motor wires apart on paper. For your motor, the coil table decides.
  • The VIN screw is the one and only entrance for 12V (its label says 12-24V). Keep 12V away from all Giga pins. Giga, driver and adapter share one ground, and the board joins them.

Build 2: The Bare A4988

Now every pin is wired by hand. Two things from the expansion board are missing, so you bring them yourself:

  • The link from RST to SLP. The picture shows it in orange. If you forget it, the pump stays silent.
  • A capacitor of 100uF (35V or more is the best choice) right beside the module: plus leg on VMOT, minus leg on the GND below it. It is not drawn, but please add it, because it catches the voltage spikes on the 12V wires.
The wiring diagram between Arduino Giga R1 WiFi bare A4988 module  with NEMA 17 and 12V adapter

This image is created using Fritzing. Click to enlarge image

A4988 Goes To
STEP Giga D4
DIR Giga D3
VDD Giga 3.3V
GND, below VDD Giga GND
VMOT power jack, plus (12V)
GND, below VMOT power jack, minus
2B and 2A coil 2 (wires A, C)
1A and 1B coil 1 (wires B, D)
RST and SLP each other
EN, MS1, MS2, MS3 stay empty

In this picture, 3.3V is taken from the header that also has RESET and 5V. The 5V hole follows directly after the 3.3V hole, so look twice. The GND is the last hole of the long double header, after 52 and 53. The pins of the module are male, so use wires with a female end there, or put the module on a breadboard. Do you want microsteps? Then run a wire from 3.3V to the MS pins that must be HIGH.

Whichever build you choose, 12V comes last: the adapter goes in after all the other wires have been checked.

Set the Current Limit

Do this once before the first run. The adapter is still out, and the USB cable alone powers the Giga and VDD.

The trimmer with the cross slot decides how many amps a coil may get, and a small voltage called VREF shows its setting. The A4988 works with this rule: current limit = VREF / (8 x Rs). On the DIYables module, the sense resistor Rs has 0.1 ohm (there are two of them, printed R100). Turn the rule around and you get VREF = 0.8 x current. So 0.36V stands for 0.45A, 0.52V for 0.65A and 0.76V for 0.95A. If the print on another brand says R050, multiply by 0.4 instead.

  1. Look for "current per phase" in the papers of your motor. Stay below that number, and below 1A while the heat sink is off.
  2. Set the multimeter to DC volts. Black probe: any GND. Red probe: the metal head of the trimmer.
  3. Turn the trimmer only a little with a fine screwdriver, then read again. The blade must not touch the parts next to it.
  4. Choose a low value for the first run, for example 0.36V. Raise it later if the syringe needs more force.

A pump rests a lot, but its motor does not. Between two doses it holds the plunger with current, so driver and motor warm up although nothing moves.

How To Program For A4988 Stepper Motor Driver

Plain digitalWrite() is enough to turn the motor:

  • Name the pins and let the code work out how many pulses one turn takes:
const int A4988_STEP = 4; const int A4988_DIR = 3; const int MICROSTEPS = 1; const int STEPS_PER_TURN = 200 * MICROSTEPS;
  • In setup(), make them outputs:
pinMode(A4988_STEP, OUTPUT); pinMode(A4988_DIR, OUTPUT);
  • Decide the direction, and give the driver a few microseconds to see it:
digitalWrite(A4988_DIR, HIGH); delayMicroseconds(5);
  • Send one step. The Giga is fast, and the A4988 wants each level for at least 1 microsecond. We stay at each level for 2000 microseconds, because this waiting time is also the speed control:
digitalWrite(A4988_STEP, HIGH); delayMicroseconds(2000); digitalWrite(A4988_STEP, LOW); delayMicroseconds(2000);
  • Put these four lines into a for loop that counts to STEPS_PER_TURN. That is one full turn.

Every step lasts 4 ms, which makes 250 steps per second, or 75 turns per minute. A NEMA 17 can jump to this speed from a standstill. For more speed, or for a gentle dose, it needs a ramp. The AccelStepper library calculates this ramp for you:

  • Describe the hardware. The word DRIVER tells the library that a STEP / DIR chip does the coil work:
#include <AccelStepper.h> AccelStepper plunger(AccelStepper::DRIVER, A4988_STEP, A4988_DIR);
  • Fix the limits of the movement in setup(). The three numbers are microseconds, steps per second, and steps per second gained in each second:
plunger.setMinPulseWidth(3); plunger.setMaxSpeed(640); plunger.setAcceleration(450);
  • Name a target, then keep calling run() until the distance is 0. A call sends one pulse or none, and it must come often. That is why no delay() is allowed in this loop:
plunger.moveTo(200); while (plunger.distanceToGo() != 0) { plunger.run(); }

Arduino Giga R1 WiFi Code - A4988 Stepper Motor Driver

Before any liquid is involved, test the drive. This sketch makes strokes: one turn in the push direction, a 1.5 second break, one turn in the pull direction, another break, and so on.

/* * This Arduino Giga R1 WiFi code was developed by newbiely.com * * This Arduino Giga R1 WiFi code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/arduino-giga/arduino-giga-r1-wifi-stepper-motor-a4988-driver */ // Arduino Giga R1 WiFi + A4988 stepper motor driver, no library // Drive test for a syringe pump: one turn pushes the plunger, one turn pulls it back. // The logic supply of the A4988 (V or VDD) is 3.3V, the same level as the Giga pins. const int A4988_STEP = 4; // Giga pin D4 -> STEP (each LOW to HIGH edge = one step) const int A4988_DIR = 3; // Giga pin D3 -> DIR (the level picks the direction) const int MICROSTEPS = 1; // 1, 2, 4, 8 or 16: same as the DIP switches const int STEPS_PER_TURN = 200 * MICROSTEPS; // a 1.8 degree motor has 200 full steps const int HALF_PULSE_US = 2000; // us at HIGH, then us at LOW: 250 steps per second const int REST_MS = 1500; // pause between two strokes int strokeNumber = 0; // counts the push and pull pairs // Pick the direction, then send one pulse per step void movePlunger(bool push, int steps) { digitalWrite(A4988_DIR, push ? HIGH : LOW); delayMicroseconds(5); // DIR must be steady before STEP rises for (int i = 0; i < steps; i++) { digitalWrite(A4988_STEP, HIGH); // the rising edge moves the motor one step delayMicroseconds(HALF_PULSE_US); digitalWrite(A4988_STEP, LOW); // get ready for the next edge delayMicroseconds(HALF_PULSE_US); } } void setup() { Serial.begin(9600); pinMode(A4988_STEP, OUTPUT); pinMode(A4988_DIR, OUTPUT); digitalWrite(A4988_STEP, LOW); Serial.print("Plunger drive test, pulses per turn: "); Serial.println(STEPS_PER_TURN); } void loop() { strokeNumber++; Serial.print("Stroke "); Serial.print(strokeNumber); Serial.println(": push, DIR HIGH, 1 turn"); movePlunger(true, STEPS_PER_TURN); delay(REST_MS); Serial.print("Stroke "); Serial.print(strokeNumber); Serial.println(": pull, DIR LOW, 1 turn"); movePlunger(false, STEPS_PER_TURN); delay(REST_MS); }

Detailed Instructions

Follow these instructions step by step:

  • New Giga on the desk? Its board package must be in the IDE first, see Arduino Giga R1 WiFi getting started.
  • Wire the components according to the provided diagram. DIP switches: all off. Adapter: unplugged.
  • Make a flag of paper tape on the motor shaft. Screw and syringe are not mounted yet.
  • Connect the Giga R1 WiFi to the computer by USB Type-C, and adjust VREF now.
  • Launch the Arduino IDE on your computer.
  • Select the appropriate Arduino Giga R1 WiFi board (e.g., Arduino Giga R1 WiFi) and COM port.
  • Paste the sketch and press Upload.
  • Now the 12V adapter may go in, and the flag starts to turn.
  • Open the Serial Monitor (9600 baud) to see which stroke is running.
∞
Newbiely | Arduino IDE 2.3.8
──
☐
✕
File
Edit
Sketch
Tools
Help
Arduino Giga R1
Newbiely.ino
···
8 Serial.println("Hello World!");
Output
Serial Monitor
Message (Enter to send message to 'Arduino Giga R1' on 'COM15')
New Line
9600 baud
Plunger drive test, pulses per turn: 200 Stroke 1: push, DIR HIGH, 1 turn Stroke 1: pull, DIR LOW, 1 turn Stroke 2: push, DIR HIGH, 1 turn Stroke 2: pull, DIR LOW, 1 turn Stroke 3: push, DIR HIGH, 1 turn Stroke 3: pull, DIR LOW, 1 turn
Ln 11, Col 1
Arduino Giga R1 on COM15
2

Make a pencil mark behind the flag while it rests. A stroke takes 0.8 seconds, and at its end the flag must cover the mark again. A flag that stops at the half or the quarter of a circle means that a DIP switch is on while MICROSTEPS is still 1.

"Push" is only a word in the code. If it pulls on your machine, change the two levels in movePlunger(), or turn around the pair on 2A and 2B (12V out first).

Do not worry if the first line is missing. The USB port of the Giga reconnects after an upload, and the Serial Monitor may open a moment too late for it.

Arduino Giga R1 WiFi Code - Syringe Pump with AccelStepper

A jerk is bad for a pump: the nozzle drips, the tube shakes, or the motor skips a step. So here the plunger gains speed slowly and loses it slowly. The cycle goes like this:

  1. The plunger pushes out five doses. One dose equals one turn of the screw.
  2. It rests for 2.5 seconds after each of them.
  3. It travels back to step 0 in one piece.
  4. After 6 seconds, the next cycle begins.

The library comes from the Library Manager:

  1. Open the Libraries panel of the Arduino IDE.
  2. Look up "AccelStepper" and pick the entry by Mike McCauley.
  3. Press Install.
  • Search for AccelStepper created by Mike McCauley and click the Install button.
∞
Newbiely | Arduino IDE 2.3.8
──
☐
✕
File
Edit
Sketch
Tools
Help
Arduino Giga R1
Library Manager
Type:
All
Topic:
All
AccelStepper by Mike McCauley
Provides an object-oriented interface for 2, 3 or 4 pin stepper motors and motor drivers. More info
1.64
INSTALL
Newbiely.ino
···
1 void setup() {
Output
Serial Monitor
Ln 1, Col 1
Arduino Giga R1 on COM15
1
/* * This Arduino Giga R1 WiFi code was developed by newbiely.com * * This Arduino Giga R1 WiFi code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/arduino-giga/arduino-giga-r1-wifi-stepper-motor-a4988-driver */ // Arduino Giga R1 WiFi + A4988 driver + AccelStepper library by Mike McCauley // Small syringe pump: five equal doses, each with a soft start and a soft stop. // After the last dose, the plunger goes back to the place where it began. #include <AccelStepper.h> const int A4988_STEP = 4; // Giga pin D4 -> STEP const int A4988_DIR = 3; // Giga pin D3 -> DIR const int MICROSTEPS = 1; // 1, 2, 4, 8 or 16: same as the DIP switches const long STEPS_PER_TURN = 200L * MICROSTEPS; // a 1.8 degree motor has 200 full steps const int DOSE_COUNT = 5; // doses in one cycle const long DOSE_STEPS = STEPS_PER_TURN; // one dose = one turn of the lead screw const int DOSE_REST_MS = 2500; // wait after each dose const int CYCLE_REST_MS = 6000; // wait after the plunger is back const float TOP_SPEED = 640.0 * MICROSTEPS; // steps per second const float ACCELERATION = 450.0 * MICROSTEPS; // speed change: steps per second, every second AccelStepper plunger(AccelStepper::DRIVER, A4988_STEP, A4988_DIR); // Move to a position, counted in steps from the start position. // run() sends a pulse only when one is due, so it is called again and again. void goToStep(long target) { plunger.moveTo(target); while (plunger.distanceToGo() != 0) { plunger.run(); // no delay() in this loop } } void setup() { Serial.begin(9600); plunger.setMinPulseWidth(3); // hold STEP HIGH for 3 us (the A4988 needs at least 1 us) plunger.setMaxSpeed(TOP_SPEED); plunger.setAcceleration(ACCELERATION); plunger.setCurrentPosition(0); // the plunger is at step 0 now Serial.print("Syringe pump ready, steps per dose: "); Serial.println(DOSE_STEPS); } void loop() { // 1. Push the doses out one by one for (int dose = 1; dose <= DOSE_COUNT; dose++) { goToStep(dose * DOSE_STEPS); Serial.print("Dose "); Serial.print(dose); Serial.print("/"); Serial.print(DOSE_COUNT); Serial.print(" is out, plunger at step "); Serial.println(plunger.currentPosition()); delay(DOSE_REST_MS); // safe here: the motor stands still } // 2. Pull the plunger back in one long move Serial.println("Retracting..."); goToStep(0); Serial.print("Retracted, plunger at step "); Serial.println(plunger.currentPosition()); delay(CYCLE_REST_MS); }

Detailed Instructions

  • The wires stay where they are. Take the 12V plug out for the upload.
  • Upload the sketch and keep the Serial Monitor at 9600 baud.
  • Move the flag back to the pencil mark by hand, then plug in 12V.
  • Tap the RST button of the Giga one time. Without motor power, the sketch was already counting doses that nobody saw. After the reset, it starts again at step 0.
∞
Newbiely | Arduino IDE 2.3.8
──
☐
✕
File
Edit
Sketch
Tools
Help
Arduino Giga R1
Newbiely.ino
···
8 Serial.println("Hello World!");
Output
Serial Monitor
Message (Enter to send message to 'Arduino Giga R1' on 'COM15')
New Line
9600 baud
Syringe pump ready, steps per dose: 200 Dose 1/5 is out, plunger at step 200 Dose 2/5 is out, plunger at step 400 Dose 3/5 is out, plunger at step 600 Dose 4/5 is out, plunger at step 800 Dose 5/5 is out, plunger at step 1000 Retracting... Retracted, plunger at step 0 Dose 1/5 is out, plunger at step 200
Ln 11, Col 1
Arduino Giga R1 on COM15
2

Listen to the motor. Each dose takes about 1.3 seconds and never gets fast: after 100 steps, at about 300 steps per second, it is already time to brake. The 1000 steps of the way back leave more room. There the pitch climbs, stays at 640 steps per second for a short moment and sinks again, all in about 3 seconds.

How Much Liquid Is One Dose?

The screw and the syringe decide:

mL per turn = travel per turn (mm) x plunger area (square mm) / 1000

An example: a screw with 2 mm per turn, and a syringe that is 16 mm wide inside. The area is 3.14 x 8 x 8, so about 201 square mm. Two millimeters of it are 402 cubic mm, or 0.4 mL. Five doses give about 2 mL. For doses of 0.1 mL, write STEPS_PER_TURN / 4 as the value of DOSE_STEPS. A kitchen scale checks your result, since 1 mL of water weighs 1 gram.

※ NOTE THAT:

For the sketch, step 0 is simply the spot where the plunger is at power-on. It cannot feel the end of the syringe. Turn the screw back by hand (12V unplugged) until all five doses fit in, and only then start a real run.

Troubleshooting

What the Pump Does What to Look At
No dose at all, the shaft turns freely by hand 12V plug, V or VDD wire, and (bare A4988) the RST-SLP link
Buzzes and shakes on the spot coil pairs mixed up, VREF too low, or TOP_SPEED / ACCELERATION too high; take 12V out before you touch the motor wires
Pulls when it should push one coil pair is reversed; exchange its two wires
Pauses by itself, driver very hot overheating shutdown; lower VREF, add the heat sink, give it air
Doses are 2, 4, 8 or 16 times too small DIP switches and MICROSTEPS disagree
Does not come back to the mark steps get lost; lower ACCELERATION, reduce the load, or raise VREF within the motor rating

Where the pump can go from here:

  • A rear stop: let a limit switch tell the Giga where step 0 is, so nobody has to set the plunger by hand.
  • One press, one dose: the button debounce guide keeps a bouncing button from giving two.
  • A dose knob: read a potentiometer and turn its value into DOSE_STEPS.
  • A cool-down: put EN on a free Giga pin and make it HIGH after the last dose. The shaft is loose then, so test first whether the plunger stays in its place.

Is the A4988 the right driver? For a 12V pump with less than 1A per coil, yes. The DRV8825 is its bigger brother: 8.2 to 45V, about 1.5A (2.2A when cooled), steps down to 1/32, and no wire for logic power. It listens to the same STEP and DIR and fits the same expansion board. And when a motor only has to spin, like a stirrer beside the pump, take a DC motor and the Arduino Giga R1 WiFi - BTS7960 Motor Driver guide.

Video Tutorial

Learn More

※ OUR MESSAGES

  • As freelancers, We are AVAILABLE for HIRE. See how to outsource your project to us
  • Please feel free to share the link of this tutorial. However, Please do not use our content on any other websites. We invested a lot of effort and time to create the content, please respect our work!