Skip to main content

Alyxspu

Python driver and desktop studio for the Alyx I100 SPU (a simple processing unit built on an ESP32). Everything runs over a plain USB serial connection: no WiFi, no web.

The ESP32 does the work. It evaluates math expressions and trains and runs a small neural network on the chip. This library sends commands and reads the results.

Install

pip install alyxspu

1. Flash the firmware

The Arduino sketch is here. Open that alyx-i100.ino in the Arduino IDE (ESP32 board package installed), select your board and port, and upload. Close the Serial Monitor afterwards, because it blocks the port.

2. Use it from Python

from alyxspu import AlyxSPU

with AlyxSPU("COM5") as spu:              # "/dev/ttyUSB0" on Linux, omit if only one port exists
    print(spu.calc("sqrt(2)*3 + sin(pi/2)"))

    spu.build(inputs=2, hidden=4, outputs=1)
    spu.set_data([([0, 0], [0]), ([0, 1], [1]), ([1, 0], [1]), ([1, 1], [0])])   # XOR
    history = spu.train(epochs=3000, lr=0.5, on_loss=lambda e, loss: print(e, loss))
    print(spu.run([1, 0]))                # close to [1.0]
Method What it does
AlyxSPU.list_ports() List serial ports
calc(expr) Evaluate + - * / ^ ( ), pi sqrt sin cos tan exp ln abs on the ESP32
build(i, h, o) New 1-hidden-layer sigmoid network (max 8 / 16 / 4)
set_data(samples), add_sample(x, y), clear_data() Training set (max 32 samples, targets 0 to 1)
train(epochs, lr, on_loss=None) Train on-device, returns [(epoch, loss), ...]
run(inputs) Forward pass, returns the outputs
info(), ping(), command(line) Status and raw access

Errors from the device or the connection raise AlyxError.

3. Desktop app

alyxspu-studio

(or python -m alyxspu). Pick the port, connect, and use the calculator and neural network tabs. It needs tkinter, which ships with most Python installs.

Serial protocol

115200 baud, one text command per line: PING, INFO, CALC <expr>, NET <i> <h> <o>, DATA x.. | y.., CLEAR, TRAIN <epochs> <lr>, RUN x... Replies start with OK, ERR, RES, OUT or LOSS.

License

MIT

Metadata

Release files for alyxspu 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for alyxspu 0.1.1
File Size Uploaded Provenance Actions
alyxspu-0.1.1.tar.gz 11.9 kB Without provenance Details for alyxspu-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for alyxspu 0.1.1
File Interpreter ABI Platform Actions
alyxspu-0.1.1-py3-none-any.whl Python 3 none any Details for alyxspu-0.1.1-py3-none-any.whl

Total release size: 22.7 kB

Release files / alyxspu-0.1.1.tar.gz

Download URL alyxspu-0.1.1.tar.gz
Size 11.9 kB
Tags Source
SHA-256 checksum
How to use checksums
d305396595871ebe1784583885c7336c20632a9e379f268313650ed8e3273672
BLAKE2b-256 checksum
How to use checksums
9e341182dfe084d90120be1e006ec53349497186e06bf1d998008f819429f3fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.0

Release files / alyxspu-0.1.1-py3-none-any.whl

Download URL alyxspu-0.1.1-py3-none-any.whl
Size 10.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b6ae03438e6c8b3a49c22431e36a7dc94f2636692c16721e0f3d8c8ed2e62113
BLAKE2b-256 checksum
How to use checksums
7976fb3dded9247a42cf532e87923c52dc38758f7a19afde4bdcd2ecc8ca8e6f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.0

Security for alyxspu 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page