<div align="center">

# Wilcoxon Sensor Gateways

### Wilcoxon 883M & Wilcoxon ILA210

Vibration monitoring for your browser, PLC and MQTT broker.

[![Web installer](https://img.shields.io/badge/Web_installer-Open-0b6bcb?style=for-the-badge)](https://dineshpalsingh1989.github.io/Wilcoxon-883M_RTU-to-TCP-and-MQTT/)
[![Downloads](https://img.shields.io/badge/Firmware-Downloads-198754?style=for-the-badge)](https://github.com/dineshpalsingh1989/Wilcoxon-883M_RTU-to-TCP-and-MQTT/releases)

[![CI](https://github.com/dineshpalsingh1989/Wilcoxon-883M_RTU-to-TCP-and-MQTT/actions/workflows/ci.yml/badge.svg)](https://github.com/dineshpalsingh1989/Wilcoxon-883M_RTU-to-TCP-and-MQTT/actions/workflows/ci.yml)
[![Modbus RTU + TCP](https://img.shields.io/badge/Modbus-RTU_%2B_TCP-2563eb)](#modbus-tcp)
[![MQTT](https://img.shields.io/badge/MQTT-Metrics_%26_alarms-7c3aed)](#mqtt)
[![License: MIT](https://img.shields.io/badge/License-MIT-green)](LICENSE)

[What's new](#whats-new-in-v4140) | [Watch the film](#watch-the-film) | [Choose your sensor](#choose-your-sensor) | [Install](#install-on-your-esp32-in-4-steps) | [Dashboard preview](#dashboard-preview) | [883M wiring](#hardware-and-wiring) | [ILA210 guide](ILA210/README.md)

</div>

## What's new in v4.14.0

![Cartoon wiring for the IRIV IOC with a Wilcoxon PCC420V 4–20 mA sensor and a separate 883M RS485 sensor, updated 13 November 2026](docs/images/iriv-pcc420-wiring.svg)

The IRIV IO Controller firmware now lets you select a PCC420V RMS or peak model for AN0/AN1, or enter a manual 4–20 mA scale. Enabled inputs appear on the main dashboard with the scaled value, raw current and loop fault state. DI0–DI10 actions and DO0–DO3 measurement rules are configurable. See the [wiring steps](docs/wiring.md#pcc420v-420-ma-sensor-on-an0-or-an1) and [IOC I/O settings](IRIV%20IOC/README.md#ioc-io). Physical PCC420V and IOC I/O operation still needs bench validation.

[Download v4.14.0 firmware](https://github.com/dineshpalsingh1989/Wilcoxon-883M_RTU-to-TCP-and-MQTT/releases/tag/v4.14.0).

## Earlier update: v4.13.0

![What's new in v4.13.0: 1. each waveform and spectrum is one MQTT message; 2. spectrum peaks above 32.767 g fixed; 3. messages state their unit, time or frequency step and point count; 4. the waveform preview keeps impacts; 5. failed sends are reported; 6. capture IDs stay unique after a reboot.](docs/images/whats-new-v4.13.0.svg)

883M firmware for the Adafruit Feather ESP32-S3, Cytron Maker ESP32 and IRIV IO Controller, tested on hardware:

1. **One MQTT message per waveform and per spectrum.** Your back end receives all 13,334 waveform points, or all 6,145 spectrum bins, in one message instead of joining 98 pieces per axis. The gateway streams the message in 1 KB pieces, so it needs only about 3 KB of RAM. **Your broker must accept messages of up to about 110 KB.**
2. **Spectrum peaks above 32.767 g are correct.** Spectrum registers are now read as unsigned, as the 883M manual specifies.
3. **Messages label themselves:** `unit`, `sample_rate_hz` (waveform), `freq_resolution_hz` (spectrum) and `points`.
4. **The waveform preview keeps impacts:** each of its 134 points is the largest sample in its block of 100.
5. **Failed sends are reported:** the Monitoring page shows *MQTT send incomplete* and the gateway reconnects.
6. **Capture IDs stay unique after a reboot** once the gateway has NTP time.

Default topics and `type` names are unchanged, and `total_chunks` is now `1`, so back ends written for chunks keep working. Details: [Waveform and spectrum messages](#waveform-and-spectrum-messages). The IRIV's MQTT library is now [WilcoxonMqtt](IRIV%20IOC/lib/WilcoxonMqtt/README.md) 0.2.0-alpha.1. Earlier changes: [releases page](https://github.com/dineshpalsingh1989/Wilcoxon-883M_RTU-to-TCP-and-MQTT/releases).

### Also new: choose your own MQTT topics

![Choose your own MQTT topics: in Settings, MQTT, set Topics to Custom and type a topic for metrics, waveform, spectrum, status and command; the gateway then sends each kind of message to its own topic and listens for commands on the command topic.](docs/images/mqtt-custom-topics.svg)

In **Settings → MQTT**, set **Topics** to **Custom** to send metrics, waveforms, spectra and health status to topics you choose, and to choose the command topic, where your own system sends commands such as `trigger_all` to the gateway. **Default** keeps today's topics, and the message contents do not change. Details: [MQTT](#mqtt).

## Watch the film

[![Watch the film (3:00): IRIV IO Controller + Wilcoxon 883M + Viking Analytics, with a DO0 alarm relay and DI1 acknowledge button](showcase/images/film-poster-play.jpg)](https://dineshpalsingh1989.github.io/Wilcoxon-883M_RTU-to-TCP-and-MQTT/showcase/)

**[▶ Open the film and the interactive page](https://dineshpalsingh1989.github.io/Wilcoxon-883M_RTU-to-TCP-and-MQTT/showcase/)**: a narrated 3D film, under 4 min with captions, including a cutaway of the motor and pump, showing a Wilcoxon 883M on an IRIV IO Controller sending readings to Viking Analytics over MQTT. It also shows two optional PCC420V 4–20 mA sensors on AN0 and AN1. DO0 drives the alarm relay and DI1 acknowledges it. The page also has a hands-on alarm demo, the wiring table and the 883M specifications. [Download the MP4](showcase/IRIV-IOC-883M-vibration-tour.mp4).

## Choose your sensor

[**➜ Open the web installer**](https://dineshpalsingh1989.github.io/Wilcoxon-883M_RTU-to-TCP-and-MQTT/)

Choose your sensor first, then your board. Each sensor has its own firmware and wiring.

| | Wilcoxon 883M | Wilcoxon ILA210 |
| --- | --- | --- |
| Monitor | X/Y/Z vibration, temperature, waveforms and sensor spectra | Vibration metrics, waveforms, sensor spectra and alarm outputs |
| Connect | Web dashboard, Modbus TCP and MQTT | Web dashboard, Modbus TCP, MQTT and IOC I/O status |
| Boards | Adafruit Feather ESP32-S3, Cytron Maker ESP32, IRIV IO Controller | ESP32-S3 DevKitC-1-N8, IRIV IO Controller |
| Industrial I/O | See 883M integration notes below | Separate digital input, analog/4-20 mA and alarm-output pages on IRIV |
| Start here | [883M setup](#install-on-your-esp32-in-4-steps) | [ILA210 setup and wiring](ILA210/README.md) |
| Installer | [Select 883M](https://dineshpalsingh1989.github.io/Wilcoxon-883M_RTU-to-TCP-and-MQTT/) | [Select ILA210](https://dineshpalsingh1989.github.io/Wilcoxon-883M_RTU-to-TCP-and-MQTT/#ila210) |

### ILA210 public test release

Every release includes ILA210 images for both supported boards; the links below always fetch the latest release. Software builds and simulated tests pass; physical ILA sensor/IOC acceptance remains pending. Confirm your sensor model, register manual and board wiring before connecting equipment. See [readiness and bench checks](ILA210/docs/ioc-readiness.md).

| Your board | Easiest installation | Manual download |
| --- | --- | --- |
| ESP32-S3 DevKitC-1-N8 | [Browser installer: choose ILA210, then ESP32-S3](https://dineshpalsingh1989.github.io/Wilcoxon-883M_RTU-to-TCP-and-MQTT/#ila210) | [Factory image (flash at 0x0)](https://github.com/dineshpalsingh1989/Wilcoxon-883M_RTU-to-TCP-and-MQTT/releases/latest/download/factory-ila210-esp32s3.bin) |
| Cytron IRIV IO Controller | BOOT + RESET, then copy UF2 to the RP2350 drive | [Download ILA210 IRIV UF2](https://github.com/dineshpalsingh1989/Wilcoxon-883M_RTU-to-TCP-and-MQTT/releases/latest/download/firmware-ila210-cytron_iriv_io_controller.uf2) |

[Release notes and all files](https://github.com/dineshpalsingh1989/Wilcoxon-883M_RTU-to-TCP-and-MQTT/releases/latest) include checksums. Original ESP32/Maker ESP32 is supported by the 883M firmware only. Never interchange the two sensors' images.

### What you can do

- View live vibration and temperature, inspect captures and download CSV logs.
- Connect a PLC through Modbus TCP or publish metrics and alarms to MQTT.
- On ILA210 IRIV, configure push-buttons, analog thresholds, beacons and sounders on separate pages. MQTT reports commanded output states; it does not confirm a physical load operated.
- Configure ILA210 sensor-loss timeout and output behavior independently of vibration thresholds.

Open **Wilcoxon.code-workspace** for separate Explorer entries **Wilcoxon 883M** and **Wilcoxon ILA210**. Open a board folder to find its own `src/main.cpp`, web/HTML code, libraries and build scripts.

---

The setup and integration sections below describe the **883M firmware**. For ILA210, use its [dedicated README](ILA210/README.md).

## Project folders

Each supported board now owns a complete standalone project: `src/main.cpp`, its other firmware modules and HTML, `lib/`, `include/`, `scripts/`, `platformio.ini` and `profile.ini`. Open that board folder in PlatformIO, or use the sensor-root selector to keep existing CI commands.

- `ESP32 Family/ESP32-S3/`
- `ESP32 Family/Cytron Maker ESP32/`
- `IRIV IOC/`

See the [board project guide](docs/board-projects.md) for the complete layout and standalone/root build commands.

Board projects are independent copies. Make future fixes in every applicable board; there is no hidden shared firmware implementation. External libraries are declared in each board configuration and downloaded by PlatformIO. The 883M Modbus library is included locally under each board's `lib/` folder.

## Install on your ESP32 in 4 steps

**You can put this gateway on your own ESP32 board straight from your browser.** No PlatformIO, Arduino IDE or library downloads: the firmware already contains everything, including the Wilcoxon883MRTU Modbus RTU/TCP library.

| You need | |
| --- | --- |
| Sensor | **Wilcoxon 883M**. On the installer, choose **Wilcoxon 883M**. For ILA210, select **Wilcoxon ILA210** and use its [separate guide](ILA210/README.md). |
| Board | **Cytron Maker ESP32**, **Adafruit Feather ESP32-S3** or **Cytron IRIV IO Controller**, see [Supported boards](#supported-boards) |
| Cable | USB-C **data** cable |
| Computer | Chrome or Edge on Windows, macOS, Linux or ChromeOS |
| Sensor wiring (afterwards) | RS485-to-TTL module and Wilcoxon 883M, see [Hardware and wiring](#hardware-and-wiring) |

### Supported boards

This gateway supports **three boards**. On the [web installer](https://dineshpalsingh1989.github.io/Wilcoxon-883M_RTU-to-TCP-and-MQTT/), first choose **ESP32 board** or **IRIV IO Controller**:

1. **Adafruit Feather ESP32-S3** (ESP32-S3 chip): ESP32 board, Wi-Fi
2. **Cytron Maker ESP32** (original ESP32 chip): ESP32 board, Wi-Fi
3. **Cytron IRIV IO Controller** (RP2350A chip): industrial controller with isolated RS485 and **wired Ethernet**; installs by copying a `.uf2` file, see [IRIV IO Controller](#iriv-io-controller)

**For ESP32 boards the installer finds the chip automatically.** When you click **Install** and pick the port, it reads the chip on the connected board and installs the matching build. There is nothing to choose.

**Any chip not in this list is refused.** If the board has an ESP32-S2, ESP32-C3, ESP32-C6, ESP32-H2 or any other chip, the installer stops with *"This device is not supported"* and writes nothing to the board.

| Board | Chip | Build installed | Status LED | Buzzer | User button |
| --- | --- | --- | --- | --- | --- |
| Adafruit Feather ESP32-S3 | ESP32-S3 | `adafruit_feather_esp32s3` | RGB LED, GPIO48 | GPIO5 | GPIO0 (BOOT) |
| [Cytron Maker ESP32](https://my.cytron.io/p-maker-esp32-bundle) | ESP32 (ESP32-WROOM-32E, 8 MB flash) | `cytron_maker_esp32` | Onboard LED on GPIO2 | Onboard piezo, GPIO26 | Onboard button, GPIO4 |
| Cytron IRIV IO Controller | RP2350A (2 MB flash) | `cytron_iriv_io_controller` (`.uf2`) | USR LED, GP29 | Internal buzzer, GP11 | USER button, GP28 |

Both ESP32 builds use the **same RS485 wiring**: GPIO18 (RX), GPIO17 (TX) and GPIO14 (DE/RE). The IRIV IO Controller has RS485 built in. See [Hardware and wiring](#hardware-and-wiring).

> **Cytron Maker ESP32 is supported from v4.10.0.** The original ESP32 has less RAM than the ESP32-S3, so the firmware sends large pages in parts and sets its capture buffers aside at startup. If the GitHub updater ever reports a memory or TLS error, update by uploading `firmware-cytron_maker_esp32.bin` under **Settings > Device Diagnostics > Firmware Update (OTA)** instead.
>
> On the Maker ESP32 the GPIO2 LED is **on** when the gateway is online, **blinks** during captures and metric recording, and is **off** when offline or after a sensor error. GPIO17 and GPIO18 also have onboard activity LEDs, so they flicker with RS485 traffic. The buzzer's mute switch silences the Wi-Fi alarm beeps.

### IRIV IO Controller

> **Supported from v4.11.0, tested on an IRIV IO Controller.** The IRIV build runs the same gateway: dashboard, Modbus TCP, MQTT and captures.
>
> **New in v4.12.0 (IRIV IO Controller, 883M and ILA210 firmware), tested on an IRIV IO Controller:**
> - **Static IP address:** choose Automatic (DHCP) or Static IP under **Settings > Network** (883M) or **Settings > Ethernet** (ILA210). Holding **USER** for 5 seconds still reaches 192.168.4.1 if the static address is wrong.
> - **Our own MQTT library:** MQTT now uses this project's [WilcoxonMqtt](IRIV%20IOC/lib/WilcoxonMqtt/README.md) instead of the third-party PubSubClient. Topics, messages and settings are unchanged. See [Built on our own libraries](#built-on-our-own-libraries).
> - **Watchdog on:** the gateway restarts itself if it stops responding for 60 seconds.
>
> **MQTT over TLS (port 8883) is not supported on the IRIV.** Use plain MQTT on **port 1883**, on a trusted network or through a local broker. The gateway's MQTT page shows this, the TLS switch is disabled, and a TLS setting saved earlier is ignored. Brokers that only accept TLS (for example HiveMQ Cloud and EMQX Cloud Serverless) need an ESP32 board.

The IRIV IO Controller is a DIN-rail controller with an **isolated RS485** port (automatic direction control, switchable 120 Ω termination) and **wired Ethernet**. It has no Wi-Fi, so the Wi-Fi pages become a **Network** page.

![IRIV IO Controller front panel: the gateway uses RS485 A, B and G, V+ and V− supply, Ethernet, USB-C, USER button, USR LED and configurable digital and analog I/O.](docs/images/iriv-io-controller.svg)

| IRIV connection | RP2350A pin | Used by the gateway for |
| --- | --- | --- |
| RS485 **A / B / G** (Terminal 1) | UART1: TX GP24, RX GP25 | Wilcoxon 883M, Modbus RTU (direction is automatic) |
| **V+ (10–30 V) / V−** (Terminal 1) | — | IRIV power. USB-C also powers it. |
| **ETH** | W5500 on SPI0: MOSI GP19, MISO GP20, SCK GP22, CS GP21, INT GP18, RESET GP23 | Dashboard, Modbus TCP and MQTT |
| **USER** button | GP28 | Hold 5 s for the fixed address 192.168.4.1 |
| **USR** LED | GP29 | Status: on when online, blinking during captures |
| Buzzer (inside) | GP11 | Start-up beep and network-loss alarm |
| DI0–DI10, DO0–DO3, AN0–AN1 | GP0–GP10, GP12–GP15, GP26–GP27 | Configurable input actions, relay rules and scaled analog inputs, see [IOC I/O](IRIV%20IOC/README.md#ioc-io) |

> **IRIV I/O.** DI0–DI10 can be assigned capture, acknowledge, alarm or DO override actions (defaults: DI0 capture, DI1 acknowledge). DO0–DO3 follow selectable 883M or analog rules, and AN0/AN1 read 4–20 mA or 0–10 V with PCC420V model presets or manual scaling. Enabled analog readings appear on the main dashboard; configure them under **Settings > IOC I/O**. See the [IOC I/O guide](IRIV%20IOC/README.md#ioc-io). These functions are not yet validated on hardware.

The [PCC420V wiring steps](docs/wiring.md#pcc420v-420-ma-sensor-on-an0-or-an1) show the loop supply, AN input and AGND connection. The drawing is a functional guide; confirm the exact sensor connector and polarity before wiring.

1. **Install:** on the web installer choose **IRIV IO Controller**, confirm the printed board name, enter device and company names, then click **Download .uf2**. Connect the IRIV's USB-C (PROG) port, hold the **BOOT** pinhole button, press **RESET**, release **BOOT**, and copy the file to the **RP2350** drive that appears.
2. **Connect:** plug in Ethernet. The gateway gets its address by DHCP and answers at **http://ila-gateway-883m.local**. If no DHCP server answers within 10 seconds, it uses **192.168.4.1** (set your laptop to 192.168.4.2, mask 255.255.255.0). Holding **USER** for 5 seconds also switches to 192.168.4.1. To use a fixed address instead, choose **Static IP address** under **Settings > Network** and enter the IP address, subnet mask and, optionally, gateway and DNS; the gateway restarts with that address, and holding **USER** still reaches 192.168.4.1 if the address is wrong.
3. **Wire the sensor** to the IRIV's RS485 **A, B, G** terminals, see [the wiring guide](docs/wiring.md#cytron-iriv-io-controller).
4. **Update:** upload `firmware-cytron_iriv_io_controller.bin` under **Settings > Device Diagnostics > Firmware Update (OTA)**, or copy a new `.uf2`. Both keep settings. **Settings > GitHub Firmware Updates** cannot install directly on this board yet.

> **Other boards with the same chip are not supported.** The installer checks the chip, not the board name. So another ESP32-S3 board will be offered the Feather build, and another original-ESP32 board will be offered the Maker ESP32 build, which needs 8 MB flash. They may not start, or may drive the wrong pins. Use one of the two boards above, or check [`src/config/config.h`](ESP32%20Family/ESP32-S3/src/config/config.h) against your hardware and build from source.

<p align="center"><a href="https://dineshpalsingh1989.github.io/Wilcoxon-883M_RTU-to-TCP-and-MQTT/"><strong>➜ Open the web installer</strong></a></p>

![Four install steps: open the web installer, plug in the Feather over USB-C, click Install and pick the port, then press RESET and join the ILA_Sensor_AP Wi-Fi network.](docs/images/install-steps.svg)

1. **Open the [web installer](https://dineshpalsingh1989.github.io/Wilcoxon-883M_RTU-to-TCP-and-MQTT/)** in Chrome or Edge on a computer.
2. **Plug the board in** with a USB-C data cable.
3. **Click Check USB and firmware** for the release you want, select the board's port, confirm the printed board name, and enter device and company names. Then click **Install** and pick the same port. If no port appears, hold **BOOT**, tap **RESET** (labelled **EN** on the Maker ESP32), release **BOOT** and try again.
4. **Press RESET** (or **EN**), join the Wi-Fi network **`ILA_Sensor_AP`** (password `12345678`), open **http://192.168.4.1** and enter your own Wi-Fi under **Settings > Wi-Fi**.

<table>
<tr>
<td width="60%"><img src="docs/images/web-installer.png" alt="Web installer page with an Install button next to the available firmware version."></td>
<td width="40%"><img src="docs/images/wifi-setup.png" alt="Gateway Wi-Fi Settings page with a network selected, password entered and a Save and Connect button."></td>
</tr>
<tr>
<td><em>Step 3: the web installer. The version shown is an example; the page lists the current releases.</em></td>
<td><em>Step 4: Wi-Fi Settings on the gateway (simulated demo).</em></td>
</tr>
</table>

After saving, the gateway restarts and joins your network. Open its new IP address to see the dashboard, then [wire the sensor](#hardware-and-wiring).

After flashing, the installer can read a USB startup report and download a JSON record with the generated gateway serial, board ID, MAC address, firmware version, device and company names, and available 883M identity. Once the [private installation registry](docs/install-registry.md) is configured and its key entered, the record is saved to GitHub automatically when detected.

### If the install does not work

Re-installing is always safe: the ESP32's built-in loader cannot be erased, so you can simply try again.

| Problem | Fix |
| --- | --- |
| No port appears | Use a USB-C **data** cable, try another USB socket (no hub), then hold **BOOT**, tap **RESET**, release **BOOT** and try again |
| No port appears (Maker ESP32, Windows or macOS) | Install the WCH USB-serial driver (CH9102/CH343) for the board's USB chip, then reconnect |
| "This device is not supported" | The board's chip is not ESP32-S3 or ESP32, or the selected release is older than Maker ESP32 support |
| "Failed to connect" or timeout | Close Arduino IDE, PlatformIO or any serial monitor using the port, then use BOOT + RESET as above |
| Stops halfway | Change the cable, avoid hubs and install again |
| Finished but nothing happens | Press **RESET**. Still no `ILA_Sensor_AP`? Install again with *Erase device* ticked |
| Browser not supported | Use Chrome or Edge on a computer, or one of the other ways below |

**Other ways to install the same firmware:**

| Way | Use when |
| --- | --- |
| [Espressif browser flasher](docs/installing-firmware.md#2-espressif-browser-flasher): write `factory-<board>.bin` at `0x0` | The installer page fails but Chrome or Edge works |
| [esptool command line](docs/installing-firmware.md#3-esptool-command-line): `python -m esptool write_flash 0x0 factory-<board>.bin` | Any computer with Python, no browser needed |
| [Espressif Flash Download Tool](docs/installing-firmware.md#4-espressif-flash-download-tool-windows) | Windows users who prefer a desktop app |
| [Build from source](#build-and-flash-the-gateway) with PlatformIO | Developers |

`<board>` is `adafruit_feather_esp32s3` or `cytron_maker_esp32` ([Supported boards](#supported-boards)). The factory file is on each [release](https://github.com/dineshpalsingh1989/Wilcoxon-883M_RTU-to-TCP-and-MQTT/releases) and clears saved settings. The [installation guide](docs/installing-firmware.md) has step-by-step instructions for each way.

## Built on our own libraries

> From **v4.10.0** the gateway uses this project's own **Wilcoxon883MRTU 0.1.0-beta.4** library for both sides of the gateway. The third-party `ModbusMaster` and `modbus-esp8266` libraries are no longer used. Register addresses, MQTT messages and web pages are unchanged. The library itself is still versioned as a beta while its API may change.

![Gateway data flow: the 883M is read by the Wilcoxon883MRTU client into gateway memory, and the Wilcoxon883MTCP server answers PLCs from that memory alongside the web dashboard and MQTT.](docs/images/data-flow.svg)

| Part | Job | Replaces |
| --- | --- | --- |
| `Wilcoxon883MRTU` | Reads the sensor over RS485: metrics, captures, device identity | `ModbusMaster` |
| `Wilcoxon883MTCP` | Serves the gateway's registers to PLCs/SCADA over Wi-Fi | `modbus-esp8266` |
| `WilcoxonMqtt` (from v4.12.0, IRIV IO Controller) | MQTT client: connects to the broker, publishes metrics, waveforms and alarms, receives commands | `PubSubClient` |

**WilcoxonMqtt** is a small MQTT 3.1.1 client written for this project. It has the same functions as PubSubClient, so MQTT topics, messages and settings did not change. Compared with PubSubClient it sends large waveform messages straight from memory without copying them, puts a time limit on every network read and write, and closes a broken connection cleanly instead of confusing the broker. It is used by the 883M and ILA210 firmware on the IRIV IO Controller, also underneath TLS (W5500SecureMqtt). The ESP32 boards still use PubSubClient. Its tests run the real library code against a simulated connection and against a real broker; see the [WilcoxonMqtt guide](IRIV%20IOC/lib/WilcoxonMqtt/README.md).

Libraries in the IRIV IO Controller firmware:

| Library | Made by | Used for |
| --- | --- | --- |
| Wilcoxon883MRTU / Wilcoxon883MTCP | This project | 883M sensor over RS485 and the Modbus TCP server (883M firmware) |
| WilcoxonMqtt | This project | MQTT |
| W5500SecureMqtt | This project | MQTT over TLS (not used while TLS is off on the IRIV) |
| IRIVIOCHardware | This project | Separate library; not built into the gateway firmware |
| ArduinoJson | Benoît Blanchon (MIT) | Settings files, web page data and MQTT messages |
| Arduino-Pico core | Earle Philhower (LGPL) | Base system: RP2350 start-up, W5500 Ethernet, TCP/IP (lwIP), web server, LittleFS storage, FreeRTOS |

The gateway compiles its own copy of the Modbus library, so a gateway firmware update brings the matching version. **Settings > Device Diagnostics** shows which version is installed. For your own Arduino or PlatformIO sketches, use the separate [Wilcoxon883MRTU library](https://github.com/dineshpalsingh1989/Wilcoxon883MRTU), now accepted into Arduino Library Manager. Its current release is a beta pending real sensor and PLC validation. Installing the library alone does not change gateway firmware. The [library migration guide](docs/modbus-library.md) covers compatibility, memory use and remaining bench tests.

## What you can do

| Feature | What it provides |
| --- | --- |
| Browser dashboard | Live X/Y/Z metrics, velocity and temperature trends, and waveform/spectrum charts |
| Sensor health | Connection status, failed reads, timeouts and age of the last successful reading |
| Configurable alarms | Velocity RMS and temperature thresholds with a configurable delay |
| Capture tools | Single-axis or XYZ captures, capture history and CSV export |
| MQTT integration | Scalar metrics, whole waveform and spectrum per message, health status and remote commands |
| Modbus TCP server | Cached measurements and capture buffers for up to 8 PLC and SCADA clients |
| Gateway management | Wi-Fi, RS485, MQTT and time settings, plus GitHub firmware installation |

## Dashboard preview

![ESP32 gateway dashboard showing simulated sensor health, vibration metrics, trends and capture controls.](docs/images/dashboard.png)

*Actual dashboard rendered by the hardware-free demo with simulated readings. Values shown are illustrative.*

<table>
<tr>
<td width="30%"><img src="docs/images/dashboard-mobile.png" alt="Dashboard on a phone-sized screen with simulated readings."></td>
<td width="70%"><img src="docs/images/system-info.png" alt="Device Diagnostics page showing firmware and Modbus library version with simulated device values."></td>
</tr>
<tr>
<td><em>Mobile layout (simulated).</em></td>
<td><em>Device Diagnostics shows the installed Modbus library version (simulated).</em></td>
</tr>
</table>

## Quick start

### Downloads

Most users only need the [web installer](#install-on-your-esp32-in-4-steps).

| Download | For | Where |
| --- | --- | --- |
| Gateway firmware, new board | First install or recovery | [Web installer](https://dineshpalsingh1989.github.io/Wilcoxon-883M_RTU-to-TCP-and-MQTT/), or `factory-<board>.bin` at `0x0` from the [releases](https://github.com/dineshpalsingh1989/Wilcoxon-883M_RTU-to-TCP-and-MQTT/releases) |
| Gateway firmware, update | A gateway that already runs this firmware | **Settings > GitHub Firmware Updates**, or `firmware-<board>.bin` on the [latest release](https://github.com/dineshpalsingh1989/Wilcoxon-883M_RTU-to-TCP-and-MQTT/releases/latest) |
| Wilcoxon883MRTU library | Using Modbus RTU/TCP in your own sketch | Search **Wilcoxon883MRTU** in Arduino IDE's Library Manager, or use the [beta source ZIP](https://github.com/dineshpalsingh1989/Wilcoxon883MRTU/releases/tag/v0.1.0-beta.4) until its listing appears |

### Try it without hardware

Install Node.js, then run:

```sh
git clone https://github.com/dineshpalsingh1989/Wilcoxon-883M_RTU-to-TCP-and-MQTT.git
cd Wilcoxon-883M_RTU-to-TCP-and-MQTT
node demo/mock_server.js
```

Open **http://localhost:8080**. Use the demo scenario selector to explore normal operation, high vibration and an offline sensor. Settings and firmware update actions are simulated. See the [demo guide](demo/README.md) for details.

### Build and flash the gateway

1. Install PlatformIO and open this repository in VS Code.
2. Check the board and pin assignments below against your hardware.
3. Connect the board over USB and run, choosing the environment for your board:

```sh
pio run -e adafruit_feather_esp32s3            # or: -e cytron_maker_esp32 / -e cytron_iriv_io_controller
pio run -e adafruit_feather_esp32s3 --target upload
pio device monitor
```

Each [supported board](#supported-boards) has its own environment, `adafruit_feather_esp32s3`, `cytron_maker_esp32` or `cytron_iriv_io_controller`, using the Arduino framework. `pio run` alone builds all three. The IRIV build uses the Arduino-Pico core through the community `maxgerhardt/platform-raspberrypi` PlatformIO platform, pinned to a fixed commit; its `firmware.uf2` is in `.pio/build/cytron_iriv_io_controller/`. PlatformIO installs the libraries declared in [platformio.ini](platformio.ini). The build helper also requires Python's `certifi` package in the PlatformIO Python environment.

### Connect to Wi-Fi

1. Connect to the gateway access point **`ILA_Sensor_AP`**, password **`12345678`**.
2. Open **http://192.168.4.1**.
3. Open **Settings > Wi-Fi** and save your network credentials.
4. Open the gateway's assigned local IP address to use the dashboard.

## Hardware and wiring

![ESP32-S3 to RS485 transceiver and Wilcoxon 883M functional wiring](docs/images/wiring.svg)

Follow the [step-by-step wiring and troubleshooting guide](docs/wiring.md) before powering the hardware.

| Component | Purpose |
| --- | --- |
| ESP32 board | Gateway; see [Supported boards](#supported-boards). Project hardware targets the Cytron Maker Feather AIoT S3 |
| Wilcoxon 883M | RS485 Modbus RTU vibration and temperature sensor |
| RS485-to-TTL UART module | Interface with ESP32-compatible 3.3 V logic levels |
| Suitable DC supply | Sensor power; check the linked sensor manual for supply and wiring requirements |

**Current firmware assignments** from [src/config/config.h](ESP32%20Family/ESP32-S3/src/config/config.h):

| Connection / function | ESP32-S3 build | Cytron Maker ESP32 build | IRIV IO Controller build |
| --- | --- | --- | --- |
| RS485 module RO → UART RX | GPIO18 | GPIO18 | Built in (UART1 RX, GP25) |
| UART TX → RS485 module DI | GPIO17 | GPIO17 | Built in (UART1 TX, GP24) |
| RS485 module DE and RE direction control | GPIO14 | GPIO14 | Not needed: automatic |
| Buzzer | GPIO5 | GPIO26 (onboard) | GP11 (internal) |
| User button | GPIO0 | GPIO4 (onboard) | GP28 (USER) |
| Status LED | GPIO48, RGB | GPIO2, onboard single-colour LED | GP29 (USR LED) |
| Network | Wi-Fi | Wi-Fi | Ethernet, W5500 on SPI0 (GP18–23) |

Connect the sensor's RS485 pair to the module's A/B terminals according to the hardware documentation. Confirm grounding and termination for your installation. Board labels can differ from GPIO numbers; verify the selected board before applying power.

[Wilcoxon 883M user manual (PDF)](883M-User-Manual-Rev.1.0_20241206-EN.pdf)

## MQTT

The default base topic is **`883M`**, configurable in Settings. TLS is supported on the ESP32 boards (TLS 1.2; they cannot use TLS 1.3). The IRIV IO Controller supports plain MQTT on port 1883 only.

To check a broker and watch a running gateway's messages from your computer (Python, no extra packages; password from the `MQTT_PASSWORD` environment variable):

```sh
python scripts/mqtt_check.py --host <broker> --port 8883 --tls --insecure --user <user> --command get_metrics --seconds 60
```

| Topic | Direction | Content |
| --- | --- | --- |
| `883M` | Gateway → broker | Metrics, waveforms and spectra (one message each) |
| `883M/status` | Gateway → broker | Health status, normally every five minutes |
| `883M/command` | Broker → gateway | Commands addressed to the sensor serial number |

These are the **Default** topics. To send each kind of message to your own topic, open **Settings → MQTT**, set **Topics** to **Custom** and enter a topic for each group. The gateway restarts to apply them; the message contents do not change.

| Custom field | Messages (`type`) | Default topic |
| --- | --- | --- |
| Metrics topic | `metrics` | Base Topic |
| Waveform topic | `waveform_preview`, `waveform_chunk` | Base Topic |
| Spectrum topic | `spectrum_chunk`, `spectrum_peaks` | Base Topic |
| Status topic | `health_status` (includes the 883M `sensor_firmware` version), `combined_spectrum_peaks` | `883M/status` |
| Command topic | Commands from your system to the gateway (see below) | `883M/command` |

Custom topics must not contain `#` or `+`, can be up to 128 characters, and the command topic must differ from the other four. On the IRIV IO Controller, `io_status` stays on `<Base Topic>/io`.

### What the command topic is for

The other topics carry data **from** the gateway. The command topic works the other way: the gateway **listens** on it, so your own system (back end, SCADA, Node-RED or a script) can control the gateway over MQTT without opening its web page. Use it to:

- start a waveform and spectrum capture now, for one axis or X, Y and Z;
- ask for the latest metrics now instead of waiting for the next reading;
- change how often captures run automatically;
- restart the gateway remotely.

If you never send commands, leave the command topic as it is; the gateway still sends its data on schedule. Example with the Mosquitto command-line client:

```sh
mosquitto_pub -h <broker> -p 1883 -u <user> -P <password> -t 883M/command -m '{"serial_number":"<sensor serial>","command":"trigger_all"}'
```

With **Custom** topics, publish to the command topic you set instead of `883M/command`.

Every command must include a **`serial_number` matching the connected sensor**; the gateway ignores commands for other serial numbers, so several gateways can share one command topic. The serial number is shown on the MQTT settings page.

```json
{
  "serial_number": "ENTER_DEVICE_SERIAL_HERE",
  "command": "trigger_capture",
  "axis": "X"
}
```

| Command | Additional fields | Action |
| --- | --- | --- |
| `trigger_capture` | `"axis": "X"`, `"Y"` or `"Z"` | Capture waveform and spectrum for one axis |
| `trigger_all` | None | Start an XYZ capture sequence |
| `get_metrics` | None | Publish scalar metrics immediately |
| `set_interval` | `"interval_ms": 600000` | Set the automatic capture interval; example is 10 minutes |
| `reboot` | None | Restart the gateway |

Set `interval_ms` to `2147483647` to use the firmware's disabled auto-capture interval. Captures are refused while another capture or firmware update is active.

### Waveform and spectrum messages

![Before: each axis capture was split into 98 small MQTT pieces that the back end had to collect. Now: the gateway counts the message size, then sends the whole waveform as one message in 1 KB pieces, using about 3 KB of RAM.](docs/images/mqtt-one-message.svg)

From v4.13.0, each axis capture sends its **whole waveform in one MQTT message** and its **whole spectrum in one MQTT message**. Your back end does not need to collect or join pieces. The messages, in the order they are sent:

| Order | `type` | Topic | Content | Typical size |
| --- | --- | --- | --- | --- |
| 1 | `waveform_preview` | `883M` | 134 points, one per 100 samples, for a quick plot | about 1 KB |
| 2 | `waveform_chunk` | `883M` | Whole waveform: 13,334 points, 1 second | about 60–107 KB |
| 3 | `spectrum_chunk` | `883M` | Whole spectrum: 6,145 bins, 0–5 kHz | about 15–45 KB |
| 4 | `spectrum_peaks` | `883M` | Top 5 spectrum peaks (`freq_hz`, `amp_g`); single-axis captures only | under 1 KB |
| 5 | `combined_spectrum_peaks` | `883M/status` | Top 5 peaks for X, Y and Z; sent once after the Z axis of an XYZ capture | under 1 KB |

An XYZ capture (`trigger_all`, Modbus trigger value 1, a configured IRIV DI input or the automatic interval) repeats steps 1–3 for X, Y and Z, then sends step 5 instead of step 4. Messages are QoS 0 and not retained. The topics shown are the defaults; with **Custom** topics each message goes to the topic set for its group (see above).

The `type` names and the `chunk_index` / `total_chunks` fields are kept from older firmware (v4.12.0 and earlier), which split each capture into 200-point chunks. Each message is now complete: `chunk_index` is always `0` and `total_chunks` is always `1`, so a back end written for chunks keeps working without changes.

Fields in every `waveform_chunk` and `spectrum_chunk` message:

| Field | Example | Meaning |
| --- | --- | --- |
| `model`, `serial_number` | `"Wilcoxon 883M"`, `"ENTER_DEVICE_SERIAL_HERE"` | Sensor that produced the data, as read from the sensor |
| `timestamp` | `"2026-11-13T10:15:02"` | Gateway local time when the message was sent (no UTC `Z`), or `"No Time Sync"` |
| `type` | `"waveform_chunk"` | `waveform_chunk` (waveform) or `spectrum_chunk` (spectrum) |
| `unit` | `"g"` | Unit of every value in `data` |
| `sample_rate_hz` | `13333.33` | Waveform only. Point `n` of `data` is at `n / sample_rate_hz` seconds |
| `freq_resolution_hz` | `0.813802` | Spectrum only (`13333.333 / 16384`). Point `n` of `data` is at `n * freq_resolution_hz` Hz |
| `axis` | `"X"` | `X`, `Y` or `Z` |
| `capture_id` | `"1794118502-3600512"` | `<Unix seconds>-<gateway uptime ms>`; identifies the capture |
| `chunk_index`, `total_chunks` | `0`, `1` | Always `0` and `1` (see above) |
| `points` | `13334` | Number of values in `data`: 13,334 for a waveform, 6,145 for a spectrum |
| `data` | `[0.012, -0.034, …]` | All values in g, exact to 0.001 g as read from the sensor |

```json
{
  "model": "Wilcoxon 883M",
  "serial_number": "ENTER_DEVICE_SERIAL_HERE",
  "timestamp": "2026-11-13T10:15:02",
  "type": "spectrum_chunk",
  "unit": "g",
  "freq_resolution_hz": 0.813802,
  "axis": "X",
  "capture_id": "1794118502-3600512",
  "chunk_index": 0,
  "total_chunks": 1,
  "points": 6145,
  "data": [0, 0.011, 0.002]
}
```

The `data` array above is shortened; a real message holds all `points` values. The `waveform_preview` message has `model`, `serial_number`, `timestamp`, `type` and `data` only, with no `axis` or `capture_id`. Each preview point is the sample with the largest magnitude in its block of 100, so short impacts stay visible.

In your back end, read one message and use it directly: `data` is the full waveform or spectrum, and `sample_rate_hz` or `freq_resolution_hz` gives the time or frequency axis. Check that `data` has `points` values.

What to expect:

- **Your broker must accept messages of up to about 110 KB.** The largest possible message is a waveform with every sample at the register limit, about 107 KB. Mosquitto and EMQX accept this by default, and so does AWS IoT Core (128 KB limit); check the limit on other brokers or cloud services.
- One axis is about 75–150 KB in total, and an XYZ capture about 230–450 KB. The exact size depends on the vibration level, because values are sent as text.
- A waveform should take under a second to send on a normal network (not yet measured on hardware). On the IRIV IO Controller, web pages and Modbus TCP wait until the message has been sent.
- If a message cannot be sent completely (for example the connection drops), the gateway reconnects to the broker, logs the failure and continues with the capture. The Monitoring page shows **MQTT send incomplete - see log** for that axis instead of **MQTT publish attempted**. The broker discards a message that was cut off, so a subscriber never receives part of a waveform.
- `capture_id` stays unique across reboots once NTP time has synced. Without time sync its first part is a small number and IDs can repeat after a reboot.
- Spectrum values are read as unsigned 16-bit registers (883M manual), so they are never negative.

How it fits in memory: the gateway does not build the whole message in RAM, because a JSON copy of one waveform would need about 300 KB. It first counts the message length, because MQTT sends the length before the data. It then formats the values and sends them in 1 KB pieces. This needs about 3 KB of extra RAM on every board.

Timestamps use configured local time and do not carry a UTC `Z` suffix.

## Modbus TCP

The gateway serves cached data on the configured Modbus TCP port, normally **502**. Values are **holding registers**, using zero-based addresses. Divide raw values by the scale below to obtain engineering units.

| Address | Measurement | Scale | Unit |
| --- | --- | --- | --- |
| 0 | X acceleration RMS | 100 | g |
| 1 | X acceleration peak | 100 | g |
| 2 | X acceleration RMS, 10–5k Hz | 100 | g |
| 3 | X acceleration peak, 10–5k Hz | 100 | g |
| 4 | X velocity RMS | 10 | mm/s |
| 5 | X velocity peak | 10 | mm/s |
| 6 | X displacement RMS* | 1 | µm |
| 7 | X displacement peak | 1 | µm |
| 8 | X true peak | 100 | g |
| 9 | X crest factor | 100 | — |
| 20–37 | Y metrics, same layout as X addresses 0–17 | Varies | Varies |
| 40–57 | Z metrics, same layout as X addresses 0–17 | Varies | Varies |
| 60 | Temperature | 10 | °C |
| 1000–14333 | Latest-axis waveform, signed Int16 | 1000 | g |
| 20000–26144 | Latest-axis spectrum, UInt16 | 1000 | g |

| 90 | Waveform status: 0 = busy/not ready, 2 = X ready, 3 = Y ready, 4 = Z ready | — | — |
| 91 | Spectrum status: same values as 90 | — | — |

*Displacement RMS is not currently read from the sensor. See [the register cache implementation](ESP32%20Family/ESP32-S3/src/modbus/modbus_tcp.cpp) and [register constants](ESP32%20Family/ESP32-S3/src/config/config.h) for the complete mapping.*

Server behaviour: function codes 03, 04, 06 and 16, up to **8 clients**, any unit ID, up to 125 registers per read. Registers 0–99 accept writes, but the next sensor update overwrites them. Waveform and spectrum registers are read-only and are copied from a finished capture, so a PLC never reads a buffer that is still downloading. A read that spans an unmapped gap (for example 95–105) returns an illegal-address exception. Modbus TCP has no authentication; keep port 502 on a trusted network.

Write **1** to register **92 or 93** for an XYZ capture, **2** for X, **3** for Y or **4** for Z. Either trigger starts the gateway's complete capture flow, which downloads both waveform and spectrum data. Registers 90 and 91 are cleared to 0 when a capture starts and updated with the ready axis when each dataset is available. Trigger registers clear after processing. Zero is a no-op; invalid values, simultaneous nonzero writes to both trigger registers, and triggers while the gateway is busy are ignored and logged (the Modbus write itself is still acknowledged).

![Modbus TCP settings page with the register map and simulated live values.](docs/images/modbus-tcp-settings.png)

*Settings > Modbus TCP lists the register map with live values (simulated here).*

## Firmware updates

Open **Settings > GitHub Firmware Updates** to check for a newer stable release and install it on the **ESP32 gateway**.

The updater requires a stable `vMAJOR.MINOR.PATCH` release, the asset for the gateway's own board (`firmware-adafruit_feather_esp32s3.bin` or `firmware-cytron_maker_esp32.bin`), and GitHub's SHA-256 asset digest. It validates HTTPS certificates, image compatibility, partition size and the downloaded checksum before activating the image and rebooting. Wi-Fi and a correct gateway clock are required.

See the [update guide](demo/README.md#github-firmware-installation) for release publishing and validation details. Updates apply to the gateway; they do not update the Wilcoxon sensor firmware.

**Beta releases** use tags such as `v4.10.0-beta.1`. They are published as GitHub **pre-releases**, never marked Latest, so the gateway's updater does not offer them. To try a beta, download the `firmware-<board>.bin` for your board from the pre-release and upload it under **Settings > Device Diagnostics > Firmware Update (OTA)** or with PlatformIO. A gateway running a beta can later move to the matching stable release (for example `v4.10.0`) through the normal updater.

## Watchdog protection

The background task configures the ESP32 task watchdog for 60 seconds with panic handling and explicitly subscribes itself. It feeds the watchdog in its main loop and during sensor block reads and while sending waveform and spectrum messages over MQTT. This is intended to recover from a subscribed task that stops servicing the watchdog.

The web task is not explicitly subscribed, and initialization/subscription return values are currently unchecked. Full task coverage and recovery must be verified on the actual board, including healthy long captures and firmware updates. Source: [task setup](ESP32%20Family/ESP32-S3/src/tasks/tasks.cpp).

On the IRIV IO Controller (from v4.12.0) a top-priority supervisor task feeds the RP2350 hardware watchdog while the background task keeps checking in; if it stops for 60 seconds the gateway restarts.

## Operational notes

- Trend history (120 successful snapshots) and capture history (20 results) are stored in RAM and reset on reboot. Alarm settings persist on the real gateway.
- Dashboard alarms are disabled until configured. They do not control machinery or the buzzer; choose limits appropriate to the machine.
- Web and OTA endpoints currently have no authentication. Deploy the gateway on a trusted network.
- Firmware integrity checks do not provide signature verification or application-health rollback. Actual sensor operation and flash updates still require validation on the target hardware.

## Project layout

Inside each selected board folder:

| Location | Contents |
| --- | --- |
| `src/main.cpp` | Firmware entry point |
| `src/config/`, `src/core/` | Pin/register definitions, state and monitoring |
| `src/modbus/`, `lib/Wilcoxon883MRTU/` | Board-owned sensor RTU/TCP implementation and local Modbus library |
| `src/capture/`, `src/mqtt/` | Capture state machine, logs, publishers and commands |
| `src/web/` | HTML, dashboard, settings pages and HTTP routes |
| `src/ota/` | Firmware upload and GitHub release installation |
| `src/hardware/`, `src/tasks/`, `src/utils/` | Hardware helpers, FreeRTOS tasks and utilities |
| `scripts/`, `include/` | Board build helpers and project headers |
| `platformio.ini`, `profile.ini` | Standalone dependencies and board settings |

At the repository root, `demo/` contains simulated previews, `installer/` the public installer, and `scripts/` the compatibility/release helpers. `experiments/Wilcoxon883MRTU-beta/` remains a library development project; each board builds its local library copy.

## License

Released under the [MIT License](LICENSE).
