GithubHelp home page GithubHelp logo

rdworth / cheapstepper Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tyhenry/cheapstepper

0.0 1.0 0.0 213 KB

Arduino library for the cheap but decent 28BYJ-48 5v stepper motor with ULN2003 board

License: GNU General Public License v3.0

C++ 100.00%

cheapstepper's Introduction

CheapStepper v0.2

An Arduino library for the 28BYJ-48 stepper motor using ULN2003 driver board

created by Tyler Henry, 6/2016

You can read some more info on the cheap yet worthy 28BYJ-48 stepper motor here.

Wiring example

Library Info

Half-stepping

CheapStepper uses an 8 mini-step sequence to perform all moves
(a.k.a half-stepping): A-AB-B-BC-C-CD-D-DA

Gear Ratio

Depending on whom you ask, the 28BYJ-48 motor has an internal gear ratio of either:

  • 64:1 (per manufacturer specs) or
  • 63.68395:1 (measured... see this Arduino Forum topic for more info)

Total Steps

64:1 gear ratio * 64 steps (1 step = 8 mini-steps) per internal motor revolution =
4096 total mini-steps / revolution
or ~4076 (4075.7728) if the gear ratio is 63.68395:1

CheapStepper library defaults to 4096 mini-steps but you can call:
CheapStepper::set4076StepMode() to use 4076 steps or CheapStepper::setTotalSteps(int numSteps) to use a custom amount

Power

CheapStepper assumes a 5v power source for RPM calculations.
It's best to use an external power supply like this, wired directly to the ULN2003 driver board, rather than draw from the Arduino's onboard power, which may have insufficient amperage (>100mA needed).


Blocking Moves

The Arduino sketch "pauses" during move()

  • move (boolean clockwise, int numSteps);
  • moveTo (boolean clockwise, int toStep);
  • moveDegrees (boolean clockwise, int degrees);
  • moveToDegree (boolean clockwise, int toDegree);

Non-blocking Moves

The Arduino sketch will continue running during the move.
You must call run() on your stepper during loop()

  • newMove (boolean clockwise, int numSteps);
  • newMoveTo (boolean clockwise, int toStep);
  • newMoveDegrees (boolean clockwise, int degrees);
  • newMoveToDegree (boolean clockwise, int toDegree);

Note

  • must call run() during loop to continue move
  • call stop() to cancel/end move

Move a Single Mini-Step
(1/8 of 8 Step Sequence)

  • step (boolean clockwise);
  • or stepCW(); or stepCCW();

All move functions have ...CW() or ...CCW() variants:

e.g.

  • move 8 steps clockwise:
    move (true, 8); is the same as
    moveCW (8);
  • create new move of 90 degrees counter-clockwise
    newMoveDegrees (false, 90); is the same as
    newMoveDegreesCCW (90);

cheapstepper's People

Watchers

 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.