This repository implements lightweight Machine Learning ("Light AI" or TinyML) algorithms running natively and entirely offline on highly constrained microcontrollers. It showcases how neural networks, pattern classifiers, and reinforcement learning can execute directly on edge silicon without cloud dependencies.
-
Paradigm: Supervised Feedforward Artificial Neural Network (ANN) trained on-chip via backpropagation.
-
Task: 7-segment display digit recognition (mapping physical segments to digits 0–9).
-
Architecture: 7 input nodes, 8 hidden nodes, and 4 binary output nodes.
-
Mathematical Model: Calculates activations using sigmoid functions and performs localized weight updates with adjustable Learning Rate and Momentum.
- Paradigm: Supervised Feedforward Neural Network using on-chip backpropagation.
- Task: Recognizes and classifies sliding-window patterns of the Fibonacci sequence.
- Data Handling: Uses 7 sequential input values (with automatic 8-bit
bytewrap-around for values exceeding 255, such as 377 becoming121and 610 becoming98) mapped to 4-bit classifications. - Optimization: Configured to converge under success thresholds using raw on-device matrix math.
- Paradigm: Tabular Q-learning.
- Task: Autonomous pathfinding in a 1D grid world of 6 states (0 to 5).
-
Algorithm: Utilizes an
$\epsilon$ -greedy strategy to balance exploration and exploitation, dynamically updating a localized State-Action value matrix (Q-Table) via the Bellman optimality equation.
To get started, clone the repository and navigate into the project directory:
git clone https://github.com/universalbit-dev/universalbit-dev.git
cd universalbit-dev/ann/
You can compile and flash either model using the local sandbox script arduino_ai_uploader.sh.
# Make the deployment script executable
chmod +x arduino_ai_uploader.sh
# Run the automated uploader (Handles serial ports and chip auto-probing)
sudo ./arduino_ai_uploader.sh
- Dynamic Scanning: Automatically scans your workspace directory and lists all
.inofiles (dynamically parsingArduinoANN.ino,ArduinoANNFIB.ino, andArduinoRL.inointo the menu selection). - Local Sandboxing: Installs a localized, sandboxed instance of
arduino-cliinside your home directory so your system packages remain unmodified. - Serial Discovery: Scans active USB lines to auto-detect your active connection port (e.g.,
/dev/ttyUSB1). - Hardware Probing: Queries the hardware signature to determine if the connected board is an AVR (Nano/Uno), ESP8266, or ESP32 chip.
- Clean Builds: Isolates compiler tasks inside a temporary
/tmpenvironment to bypass multiple-definition or artifact conflicts.
The firmware is fully compatible with standard AVR (Nano/Uno) and 32-bit Expressif (ESP8266/ESP32) boards.
- Executes on-device backpropagation and tabular Q-value updates inside a restricted 2 KB of SRAM.
- Leverages fast 32-bit CPU clocks and spacious flash and RAM partitions to complete training iterations exponentially faster.
-
USB Data Cable: Be sure to use a dedicated USB Data Cable. Standard charging-only cables omit internal data lines and cannot compile/upload sketches or output serial logs.
-
Old Bootloader Fallback: Many common Arduino Nano clone boards use the Atmega328P Old Bootloader. If your upload times out, simply select Option 2 (Arduino Nano Old Bootloader) in the command-line script menu.
This project is licensed under the GNU General Public License v3.0. See the LICENSE file for the full terms and conditions.