Use PlatformIO to build your tinyML projects

TinyML enables developers to run Machine Learning models on embedded devices with scarce resources, allowing users to detect complex motions, recognize sounds, classify images or find anomalies in sensor data. Sounds complicated? Doesn’t have to be! In this blog post we’ll show you how you can use Edge Impulse - a free, online platform for building TinyML projects - together with PlatformIO to capture training data, train a machine learning model, and then run this model on your development board.

This is a companion discussion topic for the original entry at

Thank you for sharing the PlatformIO info. This addition might be helpful. If you want to use SAMD processors (like WIO Terminal or MKR WAN 1300), be aware of the ‘printing floats’ issue. As stated here Empty array when printing results the result of the predictions is empty. You can solve this by adding these buildflags to your platformio.ini file:

build_flags = 

The first line will add printing float capabilities to your code, the second line is needed for older versions of CMSIS (ie. included in SAMD21/51 packages).

Another way to fix this is in your main.cpp file by adding the following line to your setup code:

asm(".global _printf_float");

and adding the macros as described in Slow DSP Operations:

 #define __STATIC_FORCEINLINE                   __attribute__((always_inline)) static inline
 #define __SSAT(ARG1, ARG2) \
 __extension__ \
 ({                          \
   int32_t __RES, __ARG1 = (ARG1); \
   __ASM volatile ("ssat %0, %1, %2" : "=r" (__RES) :  "I" (ARG2), "r" (__ARG1) : "cc" ); \
   __RES; \