Skip to the content
PCBKitNew board
2 layers15.2 × 10 mmLedarray, the printed circuit board in 3D

Notes on Machine Learning on edge for embedded/sensor/IoT uses

Size
15.2 × 10 mm
Copper layers
2
Thickness
1.6 mm
Parts
16
Nets
12
Pads
54
Tracks, vias
19, 0
Routed
Yes
KiCad
KiCad 7 (file 20221018)
Created
17 Jul 2019
Updated
24 Sep 2026

Overview

Ledarray is an open-source printed circuit board by jonnor, from the jonnor/embeddedml repository on GitHub. It is a 2-layer board of 15.2 × 10 mm with 16 parts on 12 nets, routed with 19 tracks and 0 vias.

Its parts include 4 resistors, 4 diodes and 2 connectors. It belongs with the sensors and measurement boards of this library.

README

README.md

Machine learning on embedded devices

Focused primarily on running inference/prediction/feed-forward part on a microcontroller (or small embedded device). Training phase can run on a standard computer/server, using existing tools as much as possible.

Background

What and when to use machine learning

The defaults right now are to do conventional signal processing (no learning) in sensor, and stream raw data to the cloud for storage and processing. Machine learning happens in the cloud. If gateways are used, they mostly forward communication (no data processing).

On-edge processing valueable when

  • Local response needed. Autonomy
  • Adaptable response needed. Over time, in context.
  • Low/predictable latency needed
  • Sending raw sensor data has privacy implications. Audio, video.
  • Unreliable connection
  • High bandwidth sensor input. Audio, video, accelerometer/IMU, current sensor, radiowaves.
  • Low bandwidth algorithm output
  • Events of interest are rare
  • Low energy usage needed
  • Full/raw sensor data is not valuable to store
  • Sensor system should be low cost

Example usecases

  • Predictive maintenance, using audio/vibration data
  • Activitity detection for people, using audio/accelerometer data. Assistive tech, medical
  • Appliance disaggregation, using aggregated power consumption data. "Non-Intrusive Load Monitoring" (NILM)
  • Anomaly/change detection for predictive maintenance, using audio/vibration data, or electrical data
  • Gesture recognition as human input device, using accelerometer/gyro data.
  • Speech/command recognition as human input device, using microphone. Keyword/Wake-word detection
  • Battery saving in wireless sensors. Normally sending day/week aggregates, on event/anomaly detection send data immediately
  • Health status of animals via activity detected using accelerometer
  • Monitoring eating activity using accelerometer 1
  • Environmental monitoring, using microphone to detect unwanted activity like cutting down trees
  • Adaptive signalling and routing for wireless transmission in Wireless Sensor networks
  • Electronic nose using arrays of MEMS detectors
  • Material identification using reflecive spectrometer 1

More notes on Applications

Motivation

  • Why the Future of Machine Learning is Tiny (devices) Tiny Computers are Already Cheap and Everywhere. Energy is the Limiting Factor.We Capture Much More Sensor Data Than We Use.
  • embedded.com: Bringing machine learning to the edge Predictions are much lower bandwidth than the raw sensor data (e.g. video) It allows for local adaptation in the AI logic (L-DNN) It achieves lower latency between observed event and action resulting from AI logic "the most important question is what is the least amount accuracy and computation complexity we can do while still delivering the business value?" Top mistake: "Continuing with the top down approach ‘let’s make it perform the task first and then squeeze it on device` instead of switching to bottom up ‘let’s make it run on device and fulfill all hardware constraints first, and then tune it for the task at hand’."
  • How to run deep learning model on microcontroller with CMSIS-NN. Why run deep learning model on a microcontroller? Sensitive data gets to the cloud, photos, and audio recordings. The company who sells this may charge a service fee to use its service and even worse sell your private data. It won't work without the network connection to the server. Data traveling back and forth between the device and server introduces lag. Require network and wireless hardware components on the circuit design which increase the cost. It might waste bandwidth sending useless data.

Own contributions

Presentations

Lecture notes

Open source software

  • emlearn. Machine Learning inference engine in C99 for Microcontrollers and Embedded devices. Since 2018.
  • emlearn-micropython. Efficient and convenient Machine Learning and DSP for MicroPython. Since 2024.

Fun projects

Commercial projects

Learning material

Books

Articles

Tools

Open-source

  • emlearn. Inference engine for microcontrollers. Supports converting scikit-learn models to plain C code. No dynamic allocations. No runtime needed.
  • TensorFlow Lite for Microcontrollers. Supports neural network models made with TensorFlow (including Keras). Can run on wide range of platforms. Since November 2018. Supports ARM Cortex M, RISC-V, ESP32/Xtensa and Linux/MacOS host. Requires a runtime, aroud 20 kB.
  • onnx2c. Allows generating C code from ONNX models.
  • iree. Compiler. Has bare metal target. Around 30 kB runtime.
  • executorch. C++ framework for deploying PyTorch models. Focused on custom backends, NPUs etc. Microcontroller CPU less in focus. Around 50 kB runtime. Supports bare-metal via "Portable" operations, or specialized for Cortex M.
  • nnom - Fixed-point neural network compiler for microcontrollers. Supports wide range of networks. Outputs plain C code. Can use CMSIS-NN on ARM Cortex M.
  • Embedded Learning Library by Microsoft. Discontinued in 2024 Set of C++ libraries for machine learning on embedded platforms. Includes code for kNN, RandomForest etc. Also has some node-based dataflow system in place it seems. JavaScript and Python bindings.
  • uTensor. Export Tensorflow model to mbed/ARM microcontrollers. Not supported on ESP32 or RISC-V or similar. Lower activity since 2021.
  • sklearn-porter. Can compile DecisionTreeClassifier and SVC models to C. Uses dynamic memory. Not optimized for use on embedded devices.
  • microTVM. Depends only on the C standard library, and runs bare metal such as STM32 and NRF52 microcontrollers. Is under development. Which models are supported on microcontrollers not specified.

Low-level libraries

  • gemmlowp. Low-precision matrix multiplication. Only general matrix multiplication ("GEMM"). C++11
  • CMSIS-NN. Neural network operations for ARM Cortex M.
  • esp-nn. Neural Network functions Espressif ESP32 (Xtensa and RISC-V).
  • . Can be used bare-metal, but more focused on mobile/server grade (Cortex A+ etc).

Proprietary

  • X-CUBE-AI for STM32

Historical

  • nn4mc_cpp. Neural Networks for Microcontrollers. Supports Keras natively. Provides instructions for PyTorch et.c via ONNX. Documentation for using from Python is lacking, as well as the type of networks supported. Does not seem maintained since 2020.
  • micromlgen. Generate C code for microcontrollers from Python's sklearn classifiers. Archived in 2024.

Models

A range of Machine Learning models are useful in an embedded devices setting. Classical methods are used when the amount of data is quite small, and neural networks for large datasets and complex inputs.

Below are notes on the various models in the context of embedded Machine Learning, including model size and compute-time optimization.

More topics

State of the Art in 2019

Of ML inference on general-purpose microcontrollers.

text
TODO: update for 2023
  • Deep models have efficient implementations for ARM Cortex-M. Ex: CNN and RNN in CMSIS-NN, FC in uTensor
  • Some implementations available for non-neural models that can be used. Ex: SVM,RF,AdaBoost in sklearn-porter
  • A few special-designed ML algorithms made. Ex: ProtoNN, Bonsai
  • Basic tools available for converting Tensorflow models
  • Keyword-spotting/wake-word on audio well established. Used in commercial products (Alexa etc)
  • Human activity detecton on accelerometers.
  • Computer vision is actively developed
  • Lots of research and many announcements of low-power co-processors, but little on market yet

Limitations

  • Neural models lacking for non-ARM micros. ESP8266/ESP32
  • Non-neural models missing inference engines designed for microcontrollers
  • "Small DNN" work mostly on computer vision for mobile phones (model size 1000x of uC)
  • Few/no pretrained models available. Transfer learning little explored?
  • Very little documentation of entire development process. From planning, data aquisition, model design
  • Best practices underdocumented (or underdeveloped?)

Ways of advancing, make contributions

  • Faster inference. Power saving, or bigger problems.
  • Smaller models. Cheaper MCU, or bigger problems.
  • Better accuracy on a problem. Better user experience, new usecases
  • Solve a concrete usecase. Easier to deploy similar usecases
  • Comparison between approaches. Microcontroller, ML model
  • Libraries or tools. Lower time to market, enable more developers

Parts

16
QtyValueFootprintReferences
4LEDLED_SMD:LED_0805_2012Metric_Pad1.15x1.40mm_HandSolderD1, D2, D3, D4
4RResistor_SMD:R_0805_2012Metric_Pad1.20x1.40mm_HandSolderR1, R2, R3, R4
2Conn_01x04Connector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_VerticalJ1, J2

The 10 most common of 16 parts.

Questions

How big is the Ledarray PCB?

It measures 15.2 × 10 mm and has 2 copper layers, 1.6 mm thick.

What parts does the Ledarray use?

16 parts. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the Ledarray KiCad files?

From the jonnor/embeddedml repository on GitHub, at the commit this page was made from: the board is emlearn/pulsemeter/hardware/ledarray/ledarray.kicad_pcb and its schematic emlearn/pulsemeter/hardware/ledarray/ledarray.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the Ledarray design in my own project?

Its repository states no licence, so its author keeps all rights: ask jonnor before reusing the design.

More from jonnor/embeddedml

5
  • 2 layers52 × 26 mmDml10, the printed circuit board in 3D

    Dml10

    jonnor/embeddedml

    Notes on Machine Learning on edge for embedded/sensor/IoT uses

    51 parts317
  • 2 layers40 × 20 mmDml20m, the printed circuit board in 3D

    Dml20m

    jonnor/embeddedml

    Notes on Machine Learning on edge for embedded/sensor/IoT uses

    37 parts317
  • 2 layers42 × 14.2 mmDml21m, the printed circuit board in 3D

    Dml21m

    jonnor/embeddedml

    Notes on Machine Learning on edge for embedded/sensor/IoT uses

    34 parts317
  • 2 layers12 × 15.5 mmBm7161, the printed circuit board in 3D

    Bm7161

    jonnor/embeddedml

    Notes on Machine Learning on edge for embedded/sensor/IoT uses

    16 parts317
  • 2 layers14 × 12.5 mmTinypulse, the printed circuit board in 3D

    Tinypulse

    jonnor/embeddedml

    Notes on Machine Learning on edge for embedded/sensor/IoT uses

    12 parts317

Similar boards

  • 2 layers140.5 × 30 mmType e, the printed circuit board in 3D

    Type e

    google/mozc-devices

    Circuit diagrams and firmware source code for Gboard DIY keyboards

    16 parts3kApache-2.0
  • 2 layers41.4 × 14.5 mmU2f zero, the printed circuit board in 3D

    U2f zero

    conorpp/u2f-zero

    U2F USB token optimized for physical security, affordability, and style

    16 parts2.4k
  • 2 layers122 × 37 mmV0-UmbilicalBoard, the printed circuit board in 3D

    V0-UmbilicalBoard

    VoronDesign/Voron-Hardware

    Cool Hardware designed by the Voron Design group

    16 parts1.1kGPL-3.0
  • 2 layers152 × 57.6 mmVideoslotadapter, the printed circuit board in 3D

    Videoslotadapter

    hoglet67/RGBtoHDMI

    Bare-metal Raspberry Pi project that provides pixel-perfect sampling of Retro Computer RGB/YUV video and conversion to HDMI

    16 parts1kGPL-3.0
  • 2 layers36 × 63.4 mmSmart ringfinal layout, the printed circuit board in 3D

    Smart ringfinal layout

    hackclub/OnBoard

    💡 Join 1,000 teenagers and make your first PCB with a $100 grant!

    16 parts915
  • 2 layers60 × 40 mmHASwitchPlate, the printed circuit board in 3D

    HASwitchPlate

    aderusha/HASwitchPlate

    LCD touchscreen for Home Automation

    16 parts738MIT
  • 2 layers21.1 × 26.9 mmDemo, the printed circuit board in 3D

    Demo

    easyw/kicadStepUpMod

    kicadStepUp: ECAD to MCAD FreeCAD WorkBench

    16 parts704