Git Product home page Git Product logo

stepperdriver's Introduction

StepperDriver

A4988, DRV8825, DRV8834, DRV8880 and generic two-pin stepper motor driver library. Features:

  • Constant speed mode (low rpms)
  • Linear (accelerated) speed mode, with separate acceleration and deceleration settings.
  • Non-blocking mode (yields back to caller after each pulse)
  • Early brake / increase runtime in non-blocking mode

Hardware currently supported:

  • DRV8834 Low-Voltage Stepper Motor Driver up to 1:32
  • A4988 Stepper Motor Driver up to 1:16
  • DRV8825 up to 1:32
  • DRV8880 up to 1:16, with current/torque control
  • any other 2-pin stepper via DIR and STEP pins, microstepping up to 1:128 externally set

Motors

4-wire bipolar stepper motor or some 6-wire unipolar in 4-wire configuration (leaving centers out).

Connections

Minimal configuration from Pololu DRV8834 page:

Wiring

This is suggested wiring for running the examples unmodified. All the pins below can be changed.

  • Arduino to driver board:

    • DIR - D8
    • STEP - D9
    • SLEEP - HIGH (Vdd)
    • GND - Arduino GND
    • GND - Motor power GND
    • VMOT - Motor power (check driver-specific voltage range)
    • A4988/DRV8825 microstep control
      • MS1/MODE0 - D10
      • MS2/MODE1 - D11
      • MS3/MODE2 - D12
    • DRV8834/DRV8880 microstep control
      • M0 - D10
      • M1 - D11
    • ~ENABLE (optional) recommend D13 to see when coils are active
  • driver board to motor (this varies from motor to motor, check motor coils schematic).

  • 100uF capacitor between GND - VMOT

  • Make sure to set the max current on the driver board to the motor limit (see below).

  • Have a motor power supply that can deliver that current.

  • Make sure the motor power supply voltage is within the range supported by the driver board.

Set Max Current

The max current is set via the potentiometer on board. Turn it while measuring voltage at the passthrough next to it. The formula is V = I5R where I=max current, R=current sense resistor installed onboard

  • DRV8834 Pololu board, R=0.1 and V = 0.5 * max current(A). For example, for 1A you will set it to 0.5V.

  • DRV8825 low-current board, R=0.33 and V = 1.65 * max current(A). For example, for 0.5A the reference voltage should be 0.82V

For latest info, see the Pololu board information pages.

Code

See the BasicStepperDriver example for a generic driver that should work with any board supporting the DIR/STEP indexing mode.

The Microstepping example works with a DRV8834 board.

For example, to show what is possible, here is the ClockStepper example that moves a stepper motor like the seconds hand of a watch:

#include <Arduino.h>
#include "A4988.h"

// using a 200-step motor (most common)
#define MOTOR_STEPS 200
// configure the pins connected
#define DIR 8
#define STEP 9
#define MS1 10
#define MS2 11
#define MS3 12
A4988 stepper(MOTOR_STEPS, DIR, STEP, MS1, MS2, MS3);

void setup() {
    // Set target motor RPM to 1RPM and microstepping to 1 (full step mode)
    stepper.begin(1, 1);
}

void loop() {
    // Tell motor to rotate 360 degrees. That's it.
    stepper.rotate(360);
}

Hardware

stepperdriver's People

Contributors

laurb9 avatar 1sm1rk avatar per1234 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.