uStepper S
Arduino library for the uStepper S Board

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

Features
The uStepper S library contains the following features:
  • Dropin feature for applications like 3D printers
  • 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 timer 1 in order to function properly, meaning that unless the user of this library can accept the loss of some functionality, this timer is 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.

EEPROM Usage information
Warning
Please be aware that the uStepper uses the EEPROM to store settings related to the Dropin application.
If you are not using this, then this has no impact for your application, and you can ignore this section !
EEPROM address 0 to 15 contains the different settings for dropin. If your application uses the EEPROM,
Please use another location than these !
Installation
To install the uStepper S library into the Arduino IDE, perform the following steps:
  • Go to Sketch->Include Libraries->Manage Libraries... in the arduino IDE
  • Search for "uStepper S", in the top right corner of the "Library Manager" window
  • Install uStepper S library

The library is tested with Arduino IDE 1.8.11

Warning
MAC users should be aware, that OSX does NOT include SILABS VCP drivers, needed to upload sketches to the uStepper S, by default. This driver should be downloaded and installed from SILABS's website:
https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers
The uStepper S 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
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 !

Known Bugs
  • does not properly release motor in dropin mode
Author
Thomas Hørring Olsen (thoma.nosp@m.s@us.nosp@m.teppe.nosp@m.r.co.nosp@m.m)
Change Log
Version
2.0.0:
  • Changed name of "brake()" function in uStepper Class to "setBrakeMode()"
  • Implemented "setBrakeMode()" function in uStepper Class to choose between freewheel, braking with low side fets shorted and brake with specified hold current. default = brake with low side fets shorted
  • "setHome" argument of ustepper class "setup" function is now used
  • Implemented "checkOrientation()" function in uStepper Class, to check the orientation of the motor cable, and invert direction if needed.
  • Added 3 moves in "checkOrientation()" function in uStepper Class, to check orientation instead of just 1
  • Removed check for motor cable orientation from "setup()" function in uStepper Class. Users actively needs to call the "checkOrientation" function from uStepper Class, if they need this feature, AFTER calling the "setup()" function
  • Disabled driver on MCU reset while setting up, to avoid the motor spinning on startup if power was removed during motor movement
  • Moved the absolute position counter into the encoder getangle function
  • Added a LP filter on the absolute position data in the encoder function (so, getAngleMoved is filtered)
  • Stall detection removed from timer1
  • Variable filter depending on mode set in setup routine
  • Removed obsolete things in setup routine and timer1
  • Made new velocity measurement for encoder values
  • Made the control threshold for closed loop control variable and intrduced a function for editing it
  • Changed timer1 interrupt frequency to 2KhZ for all other modes than DROPIN
  • Added option to choose how long the "checkOrientation()" function in UstepperS class should move during check
  • Renamed "PID" to "CLOSEDLOOP" to avoid confusing the closed loop position mode with a PID controller. PID keyword is stall accepted for backwards compatibility
1.0.1:
  • Fixed bug in functions to set acceleration and deceleration
  • moved a couple of functions in uStepperDriver.h from public to protected section of class
  • added documentation
1.0.0:
  • Bug fixes
  • New Dropin PID code
  • Added dropin CLI interface
  • Fixed stall detection, and added user sensitivity parameter
0.1.1:
  • Bug fixes
0.1.0:
  • Initial release