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

Uploaded Python 3

File details

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

File metadata

  • Download URL: mltoarduino-0.0.3.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.3.tar.gz
Algorithm Hash digest
SHA256 cbddd72433319dfcb79cc2b93e8f8f112b218f29f155a27a526cb67e60c3034b
MD5 f829fc41ce18ec53c900260a8c985395
BLAKE2b-256 94857d4b73704683b3477a6c64cecb62a2f8ab66df61702bdda4ca9fe851d9a5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mltoarduino-0.0.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a18e1da6354b8826fcfa9ea62dfcece96bf792efc82f6a785062861a2a86858f
MD5 35e06239b0588695e357c8b8055fbbba
BLAKE2b-256 c6614768e74c3f6f201a93e80a1826ed77b8492250d365ea5a2fc7c9b086d043

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