Skip to main content

3-axis magnetometer GUI with real-time plots and SCPI interface for NEnG 3Dmag instruments.

Project description

neng-mag-logger

Professional real-time magnetometer GUI for NEnG 3Dmag instruments.

Built with Tkinter and matplotlib. Connects via USB serial or WiFi TCP to a 3Dmag SCPI server running CircuitPython firmware, providing live magnetic field visualization and optional CSV data logging.


Features

  • Real-time live chart — Bx, By, Bz field components (top) and |B| magnitude + temperature (bottom)
  • Live readings panel — large numeric display of Bx, By, Bz (Gauss), |B|, Temperature (°C)
  • USB and WiFi connection — Auto/Force USB/WiFi with auto-discovery of WiFi IP via USB
  • Sensor detection — model, serial, firmware, sensor type (MLX90393/TLV493D/LIS2MDL/MMC5603), I2C address
  • MLX90393 profile switching — FAST / DEFAULT / HIACC with one click
  • CSV data logging — configurable output file, sampling rate (50–2000 ms), max buffer points
  • SCPI console — direct command entry with Up/Down arrow history navigation
  • Dark / Light theme — full matplotlib chart recolouring on toggle
  • Thread-safe — all SCPI communication protected by threading.Lock

Supported Sensors

Sensor Manufacturer Range Notes
MLX90393 Melexis ±50000 µT Profiles: FAST / DEFAULT / HIACC
TLV493D Infineon ±130 mT Low power
LIS2MDL STMicroelectronics ±49.152 Gauss Ultra-low power
MMC5603 MEMSIC ±30 Gauss High resolution
DUMMY Simulation (no hardware)

Installation

pip install neng-mag-logger

Or from source:

git clone https://gitlab.flavio.be/flavio/mag-logger.git
cd mag-logger
pip install -e .

Usage

mag-logger              # Launch the GUI
mag-logger --version    # Show version

Connection

All NEnG instruments support two transport modes, switchable at runtime in the GUI.

USB Serial

Setting Value
Interface USB CDC (ACM) — no driver needed on macOS / Linux
Baud rate 115 200
Framing 8-N-1
Terminator \n (LF); \r\n (CRLF) accepted
Clients One at a time

WiFi TCP

Setting Value
Port 5025 (standard SCPI-over-TCP)
Protocol Plain-text SCPI, \n-terminated
Clients Multiple simultaneous clients supported
IP discovery GUI auto-detects IP via USB (:WIFI:IP?)

WiFi requires the device to be in PROD or DEV USB mode (not DEBUG) and a WiFi network configured on the device.


SCPI Quick Reference

Measurement

Command Description
:READ? ASCII measurement: <ts>,<bx>,<by>,<bz>,<temp>
:READ:BIN? Binary measurement (IEEE-488.2 block, 5×float32)
:SENS:TYPE? Sensor type (MLX90393 / TLV493D / LIS2MDL / MMC5603 / DUMMY)
:SENS:ADDR? Sensor I2C address
:SENS:PROF? Active profile (MLX90393 only)
:SENS:PROF FAST|DEFAULT|HIACC Set profile (MLX90393 only)

Connection & System

Command Description
:WIFI:AVAILABLE? 1 if WiFi hardware present, 0 otherwise
:WIFI:CONNECTED? 1 if WiFi connected
:WIFI:IP? Current WiFi IP address
:WIFI:MAC? WiFi MAC address
:WIFI:RSSI? Signal strength (dBm)
:WIFI:CHANNEL? WiFi channel number
:WIFI:SSID? Primary SSID
:WIFI:SSID <name> Set primary network SSID
:WIFI:PASSWORD <pass> Set primary network password
:WIFI:HOSTNAME? Device hostname
:WIFI:HOSTNAME <name> Set device hostname
:WIFI:AUTOCONNECT? 1 if auto-connect on boot enabled
:WIFI:AUTOCONNECT 1|0 Enable / disable auto-connect on boot
:WIFI:STATUS? Compact status: CONNECTED,<ssid>,<ip>,<rssi> or DISCONNECTED
:WIFI:SCAN? Scan nearby networks (JSON array: ssid, rssi, channel)
:WIFI:NETWORK:LIST? List all configured networks (SSIDs only)
:WIFI:NETWORK:ADD <ssid>,<pass> Add / update a fallback network
:WIFI:NETWORK:REMOVE <ssid> Remove a fallback network
:WIFI:CONFIG:SAVE Persist WiFi config to flash
:WIFI:CONFIG:LOAD Reload WiFi config from flash
:WIFI:ENABLE? 1 if WiFi radio enabled
:WIFI:ENABLE 1|0 Enable / disable WiFi radio
:WIFI:CONNECT Manually trigger WiFi connection
:WIFI:DISCONNECT Disconnect from WiFi
:SYST:CLIENTS? Connected TCP clients: count,IP:port,status;...
:SYST:USB:MODE? USB mode (PROD / DEV / DEBUG)
:SYST:USB:MODE <mode> Set USB mode (requires reboot)
:SYST:VERS? Firmware version string
:SYST:ERR? Error queue (0,No error when empty)
:SYST:LOG? [n] Last n log lines (default 10, max 50)
:SYST:RES Reboot the MCU
:DIAG:PING? Returns PONG
*IDN? Instrument identification
*RST Reset to defaults
*CLS Clear status registers

WiFi config persistence: CIRCUITPY must be unmounted (device in PROD mode) for :WIFI:CONFIG:SAVE to survive reboots. In DEV/DEBUG mode the filesystem is read-only from CircuitPython's side — saves apply only until the next power cycle.


Development

pip install -e ".[dev]"
./verify-code.sh          # lint + tests
./verify-code.sh --fix    # auto-fix lint issues

Release

./release.sh patch          # bug fix
./release.sh minor          # new feature
./release.sh minor --pypi   # also publish to PyPI

Tokens: ~/.config/mag-logger/release.env (see release.env.example)


License

Proprietary — (c) 2024-2026 Prof. Flavio ABREU ARAUJO, UCLouvain. All rights reserved.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

neng_mag_logger-0.1.1.tar.gz (19.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

neng_mag_logger-0.1.1-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

Details for the file neng_mag_logger-0.1.1.tar.gz.

File metadata

  • Download URL: neng_mag_logger-0.1.1.tar.gz
  • Upload date:
  • Size: 19.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for neng_mag_logger-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e1b6e36ce7fa9156a2cc4654e0c1686951a8a5ec125dbdea5fd1f296b1537345
MD5 00171bb7b281ca686158e7725c54fff0
BLAKE2b-256 53ec8591d0e7e9ae93d9bd5d0b18267b973d0b5debd03415b7bbf30db7f2d8cd

See more details on using hashes here.

File details

Details for the file neng_mag_logger-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for neng_mag_logger-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ab39dff38a9ecfa75eaadb99a48622ee353e83c4c1ec41df66217f3d9c3b9e4b
MD5 a399e40c65c7dd875728570fd6da6d28
BLAKE2b-256 e8653b3b8d056530e371904248e693373e76f03d73f5b054476f539128c6c1f5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page