I created the High Integrity Sumobot using Ada/SPARK and high integrity software engineering techniques. I wanted to make it easy for people interested in Ada/SPARK to see how all the pieces fit together in a small embedded project.
I did my best to write simple, clean, and maintainable code throughout. It's extensively commented.
I started with a Zumo 32U4 sumobot. But instead of programming it directly as a microcontroller like most people do, I turned it into an I2C slave device, which I control with a microbit I programmed in Ada/SPARK.
The zumo continuously collects sensor data and stores it in a buffer. The microbit periodically requests sensor data from the zumo over I2C and the zumo sends the data it most recently collected. The microbit validates the sensor data, decides how the zumo should move, and sends motor commands back to the zumo (also over I2C). The zumo validates the motor commands and then executes them. And then the process repeats (at least 50 times per second).
You can find the full documentation and build instructions for this project on my website. I've included everything you need to create your own High Integrity Sumobot:
- written requirements
- full parts list
- wiring diagram
- source code
- detailed build instructions (with photos)
- detailed software installation instructions (with screenshots)
- instructions for how to run the automated unit tests
- compile/build and upload/flashing instructions (with screenshots)
- end-to-end testing plan linked to each requirement
I welcome any feedback on my project. If you have a way to make it better I'd love to hear from you.