Giter VIP home page Giter VIP logo

accelstepperencoder's Introduction

AccelStepperEncoder

A subclass of Mike McCauley's excellent AccelStepper library (http://www.airspayce.com/mikem/arduino/AccelStepper) that uses an encoder to record and correct motion.

This is intended to be used where an encoder (such as http://www.coolcomponents.co.uk/rotary-encoder-200-p-r-quadrature.html) is coupled to the output of a stepper motor. In my case, as part of my Polargraph drawing machine project, I have a stepper motor that is pulling a length of beaded cord using a sprocket. This cord also passes over an idler sprocket attached to the encoder.

From time to time (such as if a toddler begins to devour the cords), a motor step does not result in the cord moving, either because the motor is held still (dropping steps), or when the motor still manages to move, but the cord jumps through the teeth of the sprocket.

This subclass of AccelStepper rolls the encoder object into it, and will allow AccelStepper to spot failed steps and retry. At first, it will be as simple as that, because that's about as clever as I am, but I think a smarter guy might be able to do some PIDdy stuff to make it work a bit less naively.

The use case for this is:

Polargraph machine is half way through a 20 minute drawing, when a baby with preturnaturally long arms reaches out from its papoose, and grasps the shiny wriggling pen. Normally this means game over, and the rest of the drawing is painfully offset and distorted. With AccelStepperEncoder the machine spots that an instruction to move 1 step has resulted in a 10,000 step change in actual position, and concludes that there has been a "drawing exception", lifts the pen off the paper and works to return it to it's proper place, picking up where it left off.

Second use case:

I've just set off a portrait, but forgotten to put a new sheet of paper up, or it's fallen off as soon as I started, or something like that. Normally, pausing the machine locks the motors so that the position is not lost. This causes the motors to heat up, and means the pen is fixed right in the way of the paper. With AccelStepperEncoder, a pause will halt the command queue AND turn off the motors, so the pen can be moved safely out of the way.

Third use case:

The machine is set up to draw a small feature once an hour (a la Matt Venn's Cursive Data energy monitor https://github.com/mattvenn/cursivedata). Currently, to stay calibrated, the motors must never be turned off, and that leads to all kinds of problems (heat mostly), as well as being a waste of lecky. Matt's solution to this is to turn the power of the motors down so that they are still just locked enough to stay in place, but there seem to be no off-the-shelf motor drivers that facilitate this kind of programmatic power control. This encoder approach is a completely over-engineered solution (as well as being MUCH more expensive). But, with AccelStepperEncoder, the motors can simply be turned off after each feature, and re-enabled before the next one, and it will pick up where it left off.

At least, that's the theory. Have to actually write it now.

I would be surprised if this problem is not already extremely well-solved in industrial contexts, with a proper hardware feedback loop.

accelstepperencoder's People

Contributors

euphy avatar

Watchers

 avatar  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.