GithubHelp home page GithubHelp logo

strandline / stepperdriver Goto Github PK

View Code? Open in Web Editor NEW

This project forked from laurb9/stepperdriver

0.0 2.0 0.0 42 KB

Arduino library for A4988, DRV8825, DRV8834 and generic two-pin (DIR/STEP) stepper motor drivers

License: MIT License

C++ 100.00%

stepperdriver's Introduction

StepperDriver

A4988, DRV8825 and generic two-pin stepper motor driver library. 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
  • any 2-pin stepper via DIR and STEP pins.

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

  • Arduino to driver board:

    • DIR - A8
    • STEP - A9
    • M0 - A10
    • M1 - A11
    • SLEEP - 3.3V
    • GND - Arduino GND
    • GND - Motor power GND
    • VMOT - Motor power 2.5-10.8V (for DRV8834)
  • driver board to motor (this varies from motor to motor, check motor coils schematic). I just list the motor wires counter-clockwise

    • A1 - RED
    • A2 - GRN
    • B1 - YEL
    • B2 - BLU
  • 100uF capacitor between GND - VMOT

  • Set the max current on the driver board to the motor limit (see below).

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

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

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)
// pins used are DIR, STEP, MS1, MS2, MS3 in that order
A4988 stepper(200, 8, 9, 10, 11, 12);

void setup() {
    // Set target motor RPM to 1RPM
    stepper.setRPM(1);
    // Set full speed mode (microstepping also works for smoother hand movement
    stepper.setMicrostep(1);
}

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

Hardware

Notes

For DRV8834, if 1:4 and 1:32 microstepping modes do not work, add a 470K resistor from M0 to GND.

stepperdriver's People

Contributors

laurb9 avatar

Watchers

Víðópnir avatar James Cloos 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.