This is an old revision of the document!
Table of Contents
What I want to accomplish
- Write the software.
What I've done
The software needs to do a few things:
- Connect to my MQTT server for control purposes,
- Receive new patterns,
- Trigger patterns.
- Do the kinematic calculations,
- Drive the stepper motors.
I'm concerned that handling network traffic might interfere with smooth operation of the stepper motors, so I think I might unsubscribe from time-consuming MQTT topics while a pattern is playing, and then subscribe again once a pattern is finished to get new patterns from persisted topic publications.
Microcontroller choice
I initially picked the Wemos D1 Mini for the microcontroller, because it's cheap and compact. Cheaper knockoffs are common too. I wrote the code assuming I had unlimited processing power available - my code would run as fast as I would need it to run to achieve my goals. This turned out to be incorrect by about an order of magnitude. I was able to scrimp and save some overhead here and there by quashing float maths, but even after all the optimisation I could muster I was still about 4x shy of where I wanted to be.
At the time I was running with 16x microstepping, where 16 rising edges on the step pin would result in 1.8 degrees of turning on my steppers. This, plus a 2.2:1 gear reduction, meant that if I wanted to turn at 60 rpm, an arbitrary target I chose to aim for, I would need to transition the step pin every 71 microseconds.
What I want to accomplish next time
- Build the electronics.