Showing posts with label MicroPython. Show all posts
Showing posts with label MicroPython. Show all posts

Saturday, April 8, 2023

Has anyone integrated ai models in to micropython?

 Integrating AI models into MicroPython can be challenging due to the limited resources available on microcontrollers, which usually have constraints on memory, processing power, and energy consumption. However, there are examples of AI models being integrated into MicroPython, particularly for TinyML applications.

One approach is to use TensorFlow Lite for Microcontrollers, a version of TensorFlow Lite designed specifically for microcontrollers and embedded devices. TensorFlow Lite for Microcontrollers supports a subset of operations available in the full TensorFlow Lite, making it suitable for running on resource-constrained devices.

While TensorFlow Lite for Microcontrollers does not have direct support for MicroPython, you can use the C++ API to integrate the AI models into your MicroPython application. Some microcontrollers, like the ESP32, support both MicroPython and the TensorFlow Lite for Microcontrollers C++ API. In such cases, you can use the C++ API to run the AI model and then interact with it through MicroPython.

An example of this approach can be found in the following GitHub repository: https://github.com/mocleiri/tensorflow-micropython-examples

It demonstrates how to use TensorFlow Lite for Microcontrollers with MicroPython on an ESP32 microcontroller. The repository includes examples for running speech recognition and image classification models.

Keep in mind that running AI models on microcontrollers can be challenging due to the limited resources available. You may need to optimize the model, use quantization, or apply other techniques to make the AI model suitable for deployment on such devices.

Sunday, March 7, 2021

ampy - Utility to interact with a MicroPython board over a serial connection.

 

This can be really useful to control the I/O hardware if your control board is running on MicroPython like the Micro:Bit. 


I found ampy was being used by the Hadabot Project used for teaching ROS2. that consisted of an ESP32 Wifi board running ampy, and a simple DC motor controller on a magic chassis , turtle bot robot that is just two motors, a motor driver , and encoders, and a few sensors.  Everything was being over Wifi to be controlled by ROS via the ampy python library which is a cinch to in then map ROS messages in to micropython function calls.  


https://github.com/scientifichackers/ampy

ampy

MicroPython Tool (ampy) - Utility to interact with a CircuitPython or MicroPython board over a serial connection.

Ampy is meant to be a simple command line tool to manipulate files and run code on a CircuitPython or MicroPython board over its serial connection. With ampy you can send files from your computer to the board's file system, download files from a board to your computer, and even send a Python script to a board to be executed.

Note that ampy by design is meant to be simple and does not support advanced interaction like a shell or terminal to send input to a board. Check out other MicroPython tools like rshell or mpfshell for more advanced interaction with boards.