This code is released under the MIT licence.
This is the firmware for a self-balancing two-wheeled robot. The robot uses stepper motors for transport, an LQG controller for stability, and a Kalman filter for sensor filtering. This project has been a great way for me to develop practical skills in many different areas. If you would like to see a technical write-up of this project, you can find it here.
I hope that this repo will encourage you to try to conquer the inverted pendulum as I have. :)
This project utilizes a Nano 33 BLE as its processor core and the A4988 motor driver to drive the stepper motors. For power, it uses a TalentCell YB1203000 Lithium Ion battery.
On the software side, the code requires two arduino libraries: <BasicLinearAlgibra.h> and <Arduino_LSM9DS1.h>. I couldn't find a good way to calculate the controller gain on the arduino board, so I used the Scipy and Numpy libraries in Python to calculate the controller and copied the values into the arduino code.
Enjoy!!!