What you’ll learn
- Who took top honors in this competition?
- Why Ada and SPARK should be important to embedded developers.
The Make with Ada 2021 competition has some winners. I was one of the judges for this competition and if you’ve ever been a judge you know that the job isn’t easy. I also run the Mercer Science and Engineering Fair with a host of club members with even more entries and a lot more judges. Logistics is a challenge, but in the end the results are what count.
This year, the 1st place prize of $2,000 went to Tharindu Suraj Liyanage, Founder and CEO of UAV-based startup SRQ Robotics. His project, “Autonomous Crazyflie with ToF Sensors” (Fig. 1), builds on an earlier project that moved the C-based flight-management software from C/C++ to Ada/SPARK.
Tharindu’s project added the Z-ranger deck with a laser sensor to the Crazyflie. This addition of code and hardware allowed the drone to do altitude holding. The Z-ranger deck uses a laser-based time-of-flight (ToF) sensor to accurately track height up to 2 m. The hackster.io platform hosts this Crazyflie project along with the rest of the projects in the contents.
“I have been implementing custom firmware for drones for the past five years,” said Mr. Liyanage. “After finding out about the existence of Ada firmware for the Crazyflie 2.0 nanodrone, I started testing it and was able to understand the core functionalities within a couple of weeks. The simplicity of the Ada firmware allowed me to implement my own functions, and the available Ada libraries enabled me to integrate different types of sensors within the drone. I plan to continue my drone firmware implementations with Ada and make them open source for everyone who has the passion.”
I won’t go through all the winners since the contest site does that, but it’s worth mentioning the top student award. This went to Ahmed Hamdy, an MSc. Computer & Systems Engineering student at Universiti Teknologi Malaysia in Kuala Lumpur, Malaysia. A number of the projects came from students there who were learning Ada and SPARK as they went along. I covered what a prior Make with Ada winner learned about Ada and SPARK in an earlier article.
The “Ada Accelerometer Driver + Stable Nerve Game” project used the popular BBC micro:bit v1.5 that has a built-in LSM303AGR accelerometer (Fig. 2). It also contains an array of LEDs that can be utilized for user feedback. These were used to replicate the moving table of physical games, where you try to move a tiny ball around. In this case, though, the game is to keep the table level. The AdaCore compiler and runtime already handle the micro:bit, but adding support for the driver and doing the game was part of the project.
Many of the projects had Ada code that dealt directly with I/O ports, but just as often they had to interface with C-based runtimes that were provided with the platform they were working on. I think all of the platforms used in this iteration of the competition were Arm-based due to the wide range of low-power microcontroller development kits available. AdaCore’s open-source compiler does support platforms like x86 and RISC-V.
What I did not see this time around were projects that employed SPARK and contracts. It’s not too surprising given that contracts and provable software is a bit more advanced, which can be overwhelming while trying to learn and use the basics within a language. On the other hand, Ada can save development costs even when more advanced training is added to the mix.
There’s a new “SPARK Ada for the MISRA C Developer” document and interactive training on the learn.adacore.com site that would be more applicable to advanced C/C++ programmers. Its extensive but a good read nonetheless.