Using a Trinket to control a stepper motor with acceleration – Dorm automation

After almost four years living in university dorms, I am left aching to hack a place of my own. As expected, I eventually decided to automate my dorm room window blinds.

What came of it was a fanciful bit of ultra-lightweight Arduino code.
Be sure to visit the full write-up page for more details.

At the heart of this CommandStrip-stuck gadget is one original Adafruit Trinket microcontroller sporting a feeble ATTiny85. It sits next to a generic A3988 stepper motor driver.

While this project was originally intended to automate some window blinds, it soon was realized that controlling stepper acceleration on a Trinket with conventional Arduino libraries was both too resource intensive, and hard to come by. For that reason, an effort was made to bring all the parameters for adjusting stepper range, speed, and acceleration to the top of the sketch AND document their behavior in comments line by line. Likewise, the rest of the code is commented concisely throughout.


Source download:

Shared here are two versions of the Arduino/Trinket sketch with slightly different functions. Both follow a mapped value proportional to the analog input pot. and Both are easily configurable.

Visit the full write-up page for more downloads and info.



Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.