LLMind/README.md

160 lines
4.9 KiB
Markdown
Raw Permalink Normal View History

2024-10-19 05:05:34 +03:00
# Arduino CLI Installation Instructions
## Windows
To install Arduino CLI on Windows using Scoop:
```
scoop install arduino-cli
```
## Linux
To install Arduino CLI on Linux:
```
curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh
```
## Usage
2024-10-19 05:10:46 +03:00
### Using Make (Linux and Windows with Make installed)
We've provided a Makefile to simplify the process of compiling and uploading sketches to your Arduino board. Here's how to use it:
1. Generate the stimulation pattern, compile, and upload the sketch:
```
make all
```
2. Only generate the stimulation pattern:
```
make generate
```
3. Only compile the sketch:
```
make compile
```
4. Only upload the compiled sketch:
```
make upload
```
5. Clean the build files and generated pattern:
```
make clean
```
You can specify a different port or board by using the PORT and BOARD variables:
```
make upload PORT=COM3 BOARD=arduino:avr:uno
```
The default board is set to Arduino Nano with old bootloader (atmega328old). To see all available options, run:
```
make help
```
### Using PowerShell Script (Windows without Make)
For Windows users who don't have Make installed, we've provided a PowerShell script (build.ps1) that mimics the Makefile functionality. Here's how to use it:
1. Generate the stimulation pattern, compile, and upload the sketch:
```
.\build.ps1 all
```
2. Only generate the stimulation pattern:
```
.\build.ps1 generate
```
3. Only compile the sketch:
```
.\build.ps1 compile
```
4. Only upload the compiled sketch:
```
.\build.ps1 upload
```
5. Clean the build files and generated pattern:
```
.\build.ps1 clean
```
You can specify a different port or board by using the -PORT and -BOARD parameters:
```
.\build.ps1 upload -PORT COM3 -BOARD arduino:avr:uno
```
To see all available options, run:
```
.\build.ps1 help
```
## Manual Arduino CLI Usage
If you prefer to use Arduino CLI directly, you can still use the following commands:
2024-10-19 05:05:34 +03:00
```
arduino-cli compile --fqbn arduino:avr:nano:cpu=atmega328old your_sketch.ino
arduino-cli upload -p COMx --fqbn arduino:avr:nano:cpu=atmega328old your_sketch.ino
```
Replace `COMx` with the appropriate port for your Arduino board (e.g., COM20).
# Project Goal
The goal of this project is to create a system that generates and applies stimulation patterns based on MNIST handwritten digits to a special sample of nano fibers. These nano fibers act as a reservoir, essentially functioning as a small "mind" or computing system. This setup aims to explore the potential of reservoir computing using nano fibers for pattern recognition and information processing.
The project workflow is as follows:
1. Generate a stimulation pattern from MNIST data (gen_stimulat.py)
2024-10-19 05:10:46 +03:00
2. Upload this pattern to an Arduino board (using Arduino CLI, Makefile, or PowerShell script)
2024-10-19 05:05:34 +03:00
3. The Arduino applies the stimulation pattern to the nano fiber sample (apply_stimulation.ino)
4. Receive and decode the response data from the nano fiber reservoir (decode_serial_digit.py)
5. Visualize the received data to interpret the reservoir's response (visualize_digit.py)
This setup allows for experimenting with how nano fiber reservoirs can process and potentially recognize complex patterns like handwritten digits, exploring the intersection of materials science and neuromorphic computing.
# Python Scripts
This project includes several Python scripts for working with MNIST digit data and Arduino communication. Here's a brief overview of each script:
## decode_serial_digit.py
This script reads data from a serial port (default: COM20), expecting to receive response values from the nano fiber reservoir after stimulation. It then plots the received data using matplotlib.
Usage:
```
python decode_serial_digit.py
```
## gen_stimulat.py
This script generates a stimulation pattern from the MNIST dataset. It reads the training images and labels, selects the first occurrence of the digit '9', and converts its pixel values to a stimulation pattern. The pattern is then written to a C header file (stimulation_pattern.h) for use with Arduino.
Usage:
```
python gen_stimulat.py
```
## list_all_nines.py
This script reads the MNIST training labels and identifies all occurrences of the digit '9'. It prints the total count of '9's in the training set and the first 10 indices where '9' appears.
Usage:
```
python list_all_nines.py
```
## visualize_digit.py
This script provides a function to visualize a digit pattern using ASCII characters. It can be used to visualize both input stimulation patterns and the reservoir's response.
Usage:
```
python visualize_digit.py
```
These scripts work together to process MNIST data, generate stimulation patterns, and visualize the results of the nano fiber reservoir's computations. They are designed to be used in conjunction with the Arduino sketch for controlling the stimulation of the nano fiber sample.