Skip to main content

See readMe.ma

Project description

Convert a Python Machine Learning Model to Arduino Code (C++)

Introduction

Motivation

What ?
This project demonstrates the conversion of Python machine learning (ML) models to Arduino C++ code.
We will use some ML models purely as examples; the goal is not to find the best model or achieve minimal error.
Why ?
In certain applications, such as embedded systems, small microcontrollers with limited memory and computing resources are used. The idea is to train a machine learning model in a Python environment and then convert the trained model to C++ for deployment on a microcontroller.
In this project, we will use the Arduino Uno as an example, but the approach can be applied to other microcontrollers as well.
How ?
Follow the step-by-step guide below, or go directly to the PyPi package mltoarduino

Hardware

In this project, the Arduino Uno was used, but you can use other boards like Arduino Nano or Micro, Miga 2560, ESP32...
below a comparaison of some Arduino boards:

Feature Arduino Uno Arduino Nano Arduino Micro Arduino Mega 2560 ESP32
Microcontroller ATmega328P ATmega328P ATmega32U4 ATmega2560 Tensilica Xtensa LX6
Operating Voltage 5V 5V 5V 5V 3.3V
Input Voltage 7-12V 7-12V 7-12V 7-12V 5V via USB or 7-12V
Digital I/O Pins 14 (6 PWM) 14 (6 PWM) 20 (7 PWM) 54 (15 PWM) 34
Analog Input Pins 6 8 12 16 18
Flash Memory 32 KB 32 KB 32 KB 256 KB Up to 16 MB
SRAM 2 KB 2 KB 2.5 KB 8 KB 520 KB
EEPROM 1 KB 1 KB 1 KB 4 KB None
Clock Speed 16 MHz 16 MHz 16 MHz 16 MHz 240 MHz (dual-core)
Connectivity UART, I2C, SPI UART, I2C, SPI UART, I2C, SPI UART, I2C, SPI Wi-Fi, Bluetooth
USB Interface USB-B Mini USB Micro USB USB-B Micro USB
Dimensions 68.6 x 53.4 mm 45 x 18 mm 48 x 18 mm 101.52 x 53.3 mm 51 x 25.5 mm
Power Consumption ~50 mA ~50 mA ~50 mA ~70 mA Varies (~80-240 mA)
Special Features Simple and robust Compact USB HID support High I/O count Wi-Fi and BLE
Price Range Low Low Medium Medium Medium-High

How to use the package

!pip install mltoarduino

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mltoarduino-0.0.1.tar.gz (10.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mltoarduino-0.0.1-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file mltoarduino-0.0.1.tar.gz.

File metadata

  • Download URL: mltoarduino-0.0.1.tar.gz
  • Upload date:
  • Size: 10.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.5

File hashes

Hashes for mltoarduino-0.0.1.tar.gz
Algorithm Hash digest
SHA256 4ce827b8e2ed6e4679f4de0ad1c5de660d4da134b3c5337abc4c68532032a4df
MD5 4c1669257d5691761ea2a541d2bbdf47
BLAKE2b-256 a0193dfa8fd426d44d1cf7af5f9b319d15eaff24ac47279300f52e0ee61e9a18

See more details on using hashes here.

File details

Details for the file mltoarduino-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: mltoarduino-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.5

File hashes

Hashes for mltoarduino-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2782cdb68d07d697391700beed33c4caa6c4d217e20c01c684701427ebbbbad8
MD5 d21bbbc13de163bda2f7020e4c7e9b8b
BLAKE2b-256 21a527c6eed0d7b7f0a99292041c8b2fe436375e456d7f4f9bbc612a63cff91b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page