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.2.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.2-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mltoarduino-0.0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 6a8e95d087198e733233d3071a11661abb013e98648b3a38daeecfe012a859c2
MD5 efb98d93166ee523ec07439716dc6b42
BLAKE2b-256 51a5d80a55194ddca72e0efd0492fce3dc58d024796ef8537a73464f6983e957

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mltoarduino-0.0.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 109a12d677ac3272d7055ab6ec10e594330998ee4990adad805b1451dfdf0741
MD5 491cd671966ab20d750e937e4efbd681
BLAKE2b-256 64dc9a871d44c0eff138647ebf4a62eee6d08c4960d22e7e6e65795ff830df74

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