OpenValence Download

Neutrino

The Nucleus hub firmware compiled to WebAssembly and built into Phosphor. It acts like a real machine over Valence, with no PCB and no motor.

Lives in the Nucleus repo. Apache-2.0.

Status

In every Phosphor pre-release build for Windows, macOS and Linux. Android is in development.

What it's for

The same code as the PCB

Neutrino compiles the firmware's own source files: the Valence hub, the catalog, the motion arbiter with every safety gate, the pattern generators and the Kinetic² planner. Only the parts that touch hardware are swapped for stand-ins, and the firmware is never changed to suit Neutrino.

With the PCB

  1. Phosphoron your computer
  2. Nucleushub and Kinetic² on the ESP32-P4
  3. Servo driveand the motor

With Neutrino

  1. Phosphorthe same app
  2. Neutrinothe same hub and Kinetic² code, as WebAssembly
  3. A step countno drive, no motor
PartOn the PCBIn Neutrino
Hub, catalog, patterns, plannerNucleus firmwareThe same source files. The catalog has the same etag as the board's.
Motor outputThe LP core sends quadrature to the servo driveAn ideal emitter that hits every step on time. Position is its step count.
LinkWebSocket over Wi-FiMessages between Phosphor and a worker thread, one Valence frame each. No network socket.
Settings and presetsFlashPhosphor's app storage, kept between runs.
Wi-FiThe ESP32-C6 radioOne saved network and a made-up scan list. Joining does nothing.

How it runs in Phosphor

  1. Phosphor carries the WebAssembly build inside the app, about 660 KB.
  2. When you press Connect, it starts Neutrino in a worker thread, at its home position with its pairing window open, so Phosphor pairs with it the way it pairs with a real machine.
  3. The worker runs the hub on its own clock: a motion pass every 1 ms, the same tick as the PCB's, and a hub pass every 5 ms.
  4. Phosphor talks to it through the same connection code it uses for a real hub. Nothing goes out on the network.
  5. Disconnecting stops Neutrino. Its settings, presets and pairings are saved for the next run.
Phosphor connected to Neutrino, running the Advanced pattern at speed 55. No sound.

Try it

  1. Install Phosphor from Downloads and open the Hubs page.
  2. Under Saved hubs, find the row named Neutrino with the ν badge. Hover the badge to read "Virtual machine: real Nucleus firmware, emulated in the app".
  3. Press Connect.

Neutrino is never saved as a hub and never connects on its own. The getting started guide walks through the first session.

The Phosphor Hubs page before connecting, with Neutrino listed under Saved hubs, its ν badge, the line The hub as software, and a Connect button.
The Hubs page. Neutrino is the row at 1, and 2 is its Connect button.

For developers

A native build of the same code runs as a standalone hub on your desktop, for client tests and the bench. Check out Valence and Kinetic beside Nucleus, then from the Nucleus folder:

cmake -S sim/neutrino -B sim/neutrino/build -G Ninja -DCMAKE_BUILD_TYPE=Release
cmake --build sim/neutrino/build
sim/neutrino/build/neutrino-sim --homed --pairing-window

It listens for Valence sessions over WebSocket on port 82 and answers discovery on the LAN. --pairing-window lets the first client that connects pair with configure access, as a PAIR press does on the PCB. On Windows, build with WinLibs MinGW-w64 and add -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILER=gcc. The README lists every flag.

The WebAssembly build uses Emscripten:

emcmake cmake -S sim/neutrino/wasm -B sim/neutrino/wasm/build -G Ninja
cmake --build sim/neutrino/wasm/build
node sim/neutrino/wasm/check.mjs

Phosphor's Neutrino cluster runs many Neutrino hubs at once on worker threads to soak-test the hub and the client, about 1,500 of them in real time on a 16-core PC.

Limits

  • Motion is ideal. There is no drive, motor or encoder, so following error and drive alarms never show up.
  • No HOME button and no E-stop input. Phosphor's Halt and Pause work.
  • The Wi-Fi networks are made up, and memory and TCP figures read 0.
The Phosphor Wi-Fi picker connected to Neutrino, listing made-up networks such as Workshop, Guest, Printer-Direct, Cafe and Garage, with the saved network checked as connected.
The Wi-Fi picker on Neutrino. Every network in the list is made up.

Related

Neutrino is Nucleus without the PCB. It plans with Kinetic, talks to clients over Valence and ships inside Phosphor.