uStepper S-lite
Arduino library for the uStepper S-lite Board

This is the uStepper S-lite Arduino library, providing software functions for the different features of the uStepper S-lite board.

Features
The uStepper S-lite library contains the following features:
  • Second order acceleration profile, to provide smooth ramping of the speed and to avoid the motor stalling when demanding high speeds.
  • Closed loop PID position controller
  • Control of RC servo motors
  • Measure the current position of the shaft (absolute, multiple revolutions)
  • Measure the current speed of the motor
  • Stall detection for use in e.g. limit detection functionality

The library uses both timer one and timer three in order to function properly, meaning that unless the user of this library can accept the loss of some functionality, these two timers are unavailable and the registers associated with these timers should not be reconfigured.

Timer one is used for sampling the encoder in order to provide the ability to keep track of both the current speed and the angle moved since the board was reset (or a new home position was configured). Also the drop-in features missed step detection and correction is done in this timer.

Timer three is used to calculate the stepper acceleration algorithm.

Installation
To install the uStepper S-lite library into the Arduino IDE, perform the following steps:
  • Go to Sketch->Include Libraries->Manage Libraries... in the arduino IDE
  • Search for "uStepper S-lite", in the top right corner of the "Library Manager" window
  • Install uStepper S-lite library

The library is tested with Arduino IDE 1.8.12

Warning
MAC users should be aware, that OSX does NOT include FTDI VCP drivers, needed to upload sketches to the uStepper S-lite, by default. This driver should be downloaded and installed from FTDI's website:
http://www.ftdichip.com/Drivers/VCP.htm
The uStepper S-lite should NOT be connected to the USB port while installing this driver !
This is not (commonly) a problem for windows/linux users, as these drivers are most often already included in the OS
Theory

The acceleration profile implemented in this library is a second order profile, meaning that the stepper will accelerate with a constant acceleration, the velocity will follow a linear function and the position will look like an S-curve (it will follow a linear function at top speed and a second order function during acceleration and deceleration). As a result, the position of the stepper motor will have continous and differentiable first and second derivatives.

The second order acceleration profile can be illustrated as follows (Source):

From the above picture it can be seen how the motor moves with this second order acceleration profile. The postion is depicted as orange, velocity as red and the acceleration as green.

Copyright

(C) 2020 uStepper ApS

www.ustepper.com

admin.nosp@m.istr.nosp@m.ation.nosp@m.@ust.nosp@m.epper.nosp@m..com

Creative Commons License

The code contained in this file is released under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License

The code in this library is provided without warranty of any kind - use at own risk!
neither uStepper ApS nor the author, can be held responsible for any damage
caused by the use of the code contained in this library !

To do list
  • Clean out in unused variables
  • Update comments
Known Bugs
  • No known bugs
Author
Thomas Hørring Olsen (thoma.nosp@m.s@us.nosp@m.teppe.nosp@m.r.co.nosp@m.m)
Change Log
Version
1.1.0:
  • Fixed problem with deceleration not being used on stop and change of speed
  • Added functionality to choose between hard stop and soft stop (hardStop() and softStop())
1.0.0:
  • Fixed dropin and PID
  • Complete rewrite of step generation algorithm, to increase performance and accuracy
  • Added CLI interface to adjust dropin parameters and store to EEPROM
  • Added docs
  • ALOT of bugfixes
0.1.1:
0.1.0:
  • Initial release