# Centrifuge electronics architecture

The proposed system separates the touchscreen interface, centrifuge supervision, and motor drive. The RP2350 display has been selected by the user; the ESP32-S3-ETH board remains a candidate supervisor pending reallocation for the [updated I/O requirements](io-requirements.md). The display and VFD have separate RS485 connections to the ESP32. Datasoft communicates over Ethernet or Wi-Fi. The design uses one Winbond NOR flash device; on the proposed board this is the existing W25Q128.

```text
RP2350 touch display <--- RS485 port 1 ---> ESP32 supervisor
VFD / motor drive    <--- RS485 port 2 --->      |
Datasoft             <-- Ethernet/Wi-Fi -->      |
                                               +-- DI: lid status, rotor imbalance
                                               +-- DO: lid-lock solenoid command
                                               +-- Pulse input: tacho / RPM
                                               +-- Pulse input: Hall / rotor ID
                                               +-- I2C: RTD ADC, parameter NVM, RTCC
                                               +-- SPI flash: one onboard W25Q128
                                               +-- Ethernet, USB, WiFi

VFD / motor drive ---> Motor

Interface carrier / existing motor-board circuits: conditioning and drivers
Independent protective path: drive inhibition and safe lid release gating
```

The lid, imbalance, solenoid, tacho, and Hall signals are the motor-board I/O described by the user. The diagram groups their functions at the ESP32 boundary; it does not establish whether sensors connect through the motor board or directly to the carrier.

## RP2350 display responsibilities

- Render run screens, trends, recipe selections, user interaction, alarms, and maintenance information.
- Send operator requests to the supervisor and display acknowledged state.
- Use the display's onboard RS485 port for communication with the supervisor. Datasoft connects directly to the supervisor over Ethernet or Wi-Fi.
- Show loss of supervisor communication explicitly; stale screen data must not imply that a command was accepted.

The display's onboard RS485 uses UART1 TX GPIO8 and RX GPIO9 with automatic direction control in the archived schematic. An ESP32-side RS485 transceiver is still required. The earlier direct UART-header connection and display-based PC gateway are superseded. See the [RP2350 schematic](../research/RP2350-Touch-LCD-7.pdf) for the hardware revision used.

## ESP32 supervisor responsibilities

- Own the centrifuge run sequence, recipe validation, permitted operating limits, and state transitions.
- Own authoritative user roles, permissions, recipe changes, event records, and configuration.
- Read lid status and rotor imbalance; command the lid-lock solenoid through the appropriate driver.
- Measure RPM from tacho pulses and identify the rotor from Hall pulse timing between two magnets.
- Acquire RTD temperature through a 16-bit I2C ADC, save parameters in external I2C non-volatile memory, and maintain time with an I2C RTCC.
- Communicate with the VFD over the second RS485 port, process its status, and handle communication loss according to the agreed drive protocol and fault behavior.
- Manage Ethernet and WiFi diagnostics, storage, backed timekeeping, CSV export, and standalone PDF report generation.
- Accept commands from the display and network-connected Datasoft through the same authorization and state checks. Define the Datasoft application protocol and reconnect behavior for Ethernet or Wi-Fi.

The proposed board provides W5500 Ethernet, WiFi, microSD support, W25Q128 flash and PSRAM. Its W25Q128 is the single planned Winbond NOR device. Carrier requirements include two ESP32-side RS485 interfaces, RTD acquisition, parameter memory, clock backup, and any signal conditioning or drivers absent from the existing motor board.

## Motor board responsibilities

The user confirmed that the separate motor board handles drive and speed regulation and that a dedicated RS485 port is required for VFD communication. Confirm the VFD model, protocol, supported run/stop and speed-reference commands, status/fault feedback, and communication-loss response from its documentation. RS485 does not by itself establish Modbus RTU or the command/register map. Independent inhibition and lid-release conditions remain separate from the serial command path.

## I2C and storage responsibilities

Use distinct device addresses for the RTD ADC, parameter memory, and RTCC on the local I2C bus. Exact parts and addresses remain unselected. The earlier ADS1115 and DS3231 proposals are candidates only; the RTD circuit and accuracy target must guide ADC selection.

Parameter NVM remains explicitly required on I2C. Use the onboard 16 MB W25Q128 as the single NOR flash device, with capacity divided between firmware, any update slots, and data partitions. Define the data volume, retention, and write workload before fixing that layout. Whether microSD remains needed is open. No additional application GPIOs are allocated for another NOR chip.

## Protective functions

The lid-lock output requests an actuator action; command polarity and power-loss behavior remain undefined. Lid status must not be assumed to prove that the lock is engaged. Drive inhibition, overspeed handling, lid release conditions, sensor fault detection, and restart behavior need an application-specific protection design. Drive permit and watchdog outputs in the earlier map remain proposals. Missing tach pulses cannot distinguish a stationary rotor from a failed sensor without additional measures.

UI, networking, report generation, and logging failures must be handled without bypassing protective conditions. State recovery after reset or loss of power must not accidentally restart the motor or release the lid.

## Integration conditions

- Define transceivers, direction control, termination, biasing, reference/grounding, isolation, and protocol for the two RS485 links: display and VFD. They consume two ESP32-S3 UARTs, leaving one available subject to pin allocation. Datasoft uses the existing Ethernet or Wi-Fi interface.
- Keep tacho and Hall signals on direct ESP32 inputs suitable for interrupt/capture operation. Verify timing under concurrent communications and storage activity.
- USB flash-drive operation requires host firmware, a suitable connector or adapter, and a protected, controlled 5 V VBUS supply. The native ESP32 USB pins are shared with its USB programming/debug function.
- Keep I2C expansion local to the carrier and use 3.3 V logic pull-ups. Field wiring requires suitable interfaces.
- Keep onboard NOR on its existing flash interface. Verify Datasoft networking and microSD operation, if microSD is retained, alongside flash writes, two RS485 links, pulse capture, and USB export. The identified interfaces use 13 GPIOs with conventional direction control, leaving two of the earlier 15 candidate pins before debug and supporting controls; see [I/O requirements](io-requirements.md#resource-implications).
- Demonstrate offline PDF generation and export early. Browser printing does not meet standalone USB PDF export by itself.
- Confirm display glove performance, brightness, mounting, front ingress protection, vibration, temperature/humidity, and EMC at product level.

Technical references are collected in [Sources](sources.md). The [I/O requirements](io-requirements.md) define the current interfaces; [Pin assignment](pin-assignment.md) retains the superseded wiring proposal pending revision.
