███╗ ██╗██╗██╗ ██╗███████╗██████╗ ██████╗ ██████╗ ██████╗ ████████╗ ████╗ ██║██║██║ ██║██╔════╝██╔══██╗██╔═══██╗██╔══██╗██╔═══██╗╚══██╔══╝ ██╔██╗ ██║██║██║ ██║███████╗██████╔╝██║ ██║██████╔╝██║ ██║ ██║ ██║╚██╗██║██║██║ ██║╚════██║██╔══██╗██║ ██║██╔══██╗██║ ██║ ██║ ██║ ╚████║██║╚██████╔╝███████║██║ ██║╚██████╔╝██████╔╝╚██████╔╝ ██║ ╚═╝ ╚═══╝╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ██╗ █████╗ ██████╗ ██║ ██╔══██╗██╔══██╗ ██║ ███████║██████╔╝ ██║ ██╔══██║██╔══██╗ ███████╗██║ ██║██████╔╝ ╚══════╝╚═╝ ╚═╝╚═════╝
Cross-platform desktop instrument — real-time visualization, serial bridging, and extensible analysis pipelines for INA219, INA226, INA228, INA3221, and related energy-monitor ICs.
Crafted by NiusRobotLab — robotics-grade tooling for makers & engineers
| Live dashboard | Multi-channel metrics, fault awareness, and a data pipeline tuned for bench & field use |
| Input sources | 16 independent serial stream slots (USB JSONL) plus 3 built-in mock (simulated) sources for INA219 / INA226 / INA3221 — no hardware required for demos |
| Serial bridge | JSONL protocol over USB serial — pair with firmware examples in packages/arduino-bridge |
| Modern stack | Electron + Vite + React + TypeScript — fast HMR in dev, optimized renderer in prod |
| Core library | @niusrobotlab/ina-monitor-core — shared models, transports, and protection logic |
Reference screenshot (assets/screenshot.JPG): up to 16 concurrent serial streams and 3 simulated mock streams.
flowchart LR
subgraph Host["Host PC"]
UI["React UI<br/>Vite renderer"]
EL["Electron main"]
SP["serialport"]
end
subgraph Device["MCU + INA"]
FW["Firmware bridge<br/>.ino examples"]
end
UI <--> EL
EL <--> SP
SP <-- USB serial JSONL --> FW
git clone https://github.com/dunknowcoding/NiusRobotLab_INA_monitor.git
cd NiusRobotLab_INA_monitor
npm install
npm run dev- Development runs Vite on
:5173and launches Electron with hot reload. The UI resolves@niusrobotlab/ina-monitor-corefrom TypeScript sources, so you do not need to build the core package first. - Production build (after
npm run build):
npm run start:app-
Electron main/preload are compiled first
The app package definespredev→npm run build:electron, which runstscfor the Electron main process and preload script intopackages/ina-monitor-app/dist-electron/.
Why: Electron’s entry isdist-electron/main.js. If that folder is missing (fresh clone, cleanup, or deleteddist-electron), Electron exits with code 1 and almost no useful log. Runningbuild:electronbefore Vite + Electron prevents that. -
Port
5173must be free
Vite listens onhttp://localhost:5173/; the dev script waits for that port before starting Electron. If something else already uses 5173, Vite fails with “Port 5173 is already in use” and the wholedevcommand may exit with code 1 (not an Electron bug — fix by closing the other dev server or freeing the port). To use another port, change Vite’sserver.portand thewait-on tcp:<port>string inpackages/ina-monitor-app/package.jsonso they match.
| Package | Role |
|---|---|
@niusrobotlab/ina-monitor-core |
Types, protocols, fault engine, transports (library) |
@niusrobotlab/ina-monitor-app |
Electron shell + React UI |
arduino-bridge |
Example sketches for common breakout boards |
| Command | Description |
|---|---|
npm run dev |
Start Vite + Electron in development; predev runs build:electron first (writes dist-electron/) |
npm run build |
Build core, then renderer + Electron main/preload |
npm run start:app |
Run packaged Electron app (requires build first) |
npm run test |
Run core unit tests |
npm run lint |
ESLint (flat config) |
| Requirement | Notes |
|---|---|
| Node.js | ≥ 18 (current LTS recommended: 20.x or 22.x) |
| npm | Comes with Node; workspaces are used (default in npm 7+) |
| Git | For cloning and version control |
| Disk / RAM | ~500 MB for node_modules (varies); ≥ 4 GB RAM recommended for comfortable dev |
The app depends on serialport (native Node addon). npm install usually downloads prebuilt binaries. If a prebuild is missing for your OS/CPU/Node combo, npm falls back to compiling from source, which needs the toolchain below.
| Item | Purpose |
|---|---|
| Windows 10 / 11 (64-bit; ARM64 supported where Node/Electron builds exist) | Host OS |
| Node.js Windows Installer (LTS) | Node + npm; enable “Tools for native modules” if the installer offers it |
| Build tools (if native compile is required) | Install Visual Studio Build Tools with “Desktop development with C++” (MSVC, Windows SDK), or full Visual Studio with the same workload — required when serialport must compile via node-gyp |
| Python 3.x | Often required by node-gyp when building native addons (install from python.org and ensure python is on PATH) |
Tips: Run the terminal as Administrator only if installs fail due to permission issues. Use PowerShell or cmd; Git Bash works but paths must remain consistent. If USB serial access fails, install the board’s USB driver (e.g. CP210x, CH340, FTDI) from the vendor.
| Item | Purpose |
|---|---|
| glibc-based distros (Debian, Ubuntu, Fedora, etc.) | Most tested; musl (Alpine) may need extra steps for Electron/native modules |
build-essential (Debian/Ubuntu) or gcc, make, python3 |
Toolchain if serialport builds from source |
libudev-dev (Debian/Ubuntu) or systemd-devel / equivalent |
Headers for serial port enumeration (udev) |
Debian / Ubuntu example:
sudo apt update
sudo apt install -y build-essential python3 git
sudo apt install -y libudev-dev # for node-serialportFedora example:
sudo dnf groupinstall -y "Development Tools"
sudo dnf install -y python3 git systemd-devel pkgconf-pkg-configGrant your user access to serial devices if needed (e.g. add user to dialout on Debian/Ubuntu: sudo usermod -aG dialout $USER, then re-login).
| Item | Purpose |
|---|---|
| macOS 11+ (Big Sur or newer recommended) | Matches current Electron support |
| Xcode Command Line Tools | clang, make for any native compile: xcode-select --install |
| Python 3 | Bundled or via Homebrew if node-gyp asks for it |
Install Node via the official installer or Homebrew (brew install node@20). Approve any Gatekeeper prompts when Electron first runs.
node -v # should print v18.x or higher
npm -vThen from the repo root: npm install and npm run dev.
This project is released under the MIT License.