# QTFM Simple Gradiometer Guide

This app subtracts Sensor B from Sensor A only when their QTFM millisecond
timestamps identify the same measurement packet.

## Recommended wired configuration

For a new two-sensor wired synchronization:

1. Fully start both sensors.
2. Use the same data rate and environmental/filter settings.
3. Connect a UMCC cable from the chosen Master sensor's **Sync_Out** to the
   other sensor's **Sync_In**.
4. Set exactly one sensor to **MASTER** and the other to **SLAVE**.
5. Wait for both mode badges to confirm the requested modes.
6. Click **SYNC SENSORS** in the Time Series graph header.
7. Wait for `#Sensors Sync Complete`.
8. Confirm the app reports equal timestamp intervals, zero sample phase, and
   exact timestamp pairs before relying on the A−B plots.

This follows QuSpin's
[Gen-2 wired Master/Slave procedure](https://quspin.com/qtfm-gen-2/qtfm-gen-2-user-guide/syncing-your-gen-2-qtfm-sensors/).

## Valid and invalid role combinations

- **One Master + one Slave:** required to initiate a wired synchronization.
- **Two Masters:** invalid for gradiometer operation. The app disables A−B.
- **Two Slaves:** cannot initiate a new wired sync. If both sensors are already
  running and their live timestamps prove equal-rate, phase-aligned operation,
  the app permits exact-packet A−B plotting.

Timestamp agreement does not replace the physical wired-sync requirement when
performing a new wired synchronization. The cable continuously carries the
Master clock to the Slave.

## What happens when the sync cable is absent

Setting a sensor to Slave without a valid input clock may produce
`needs input clock`. The data stream may pause because the Slave is waiting for
the Master clock.

The app handles this by:

- displaying a cable/input-clock warning;
- timing out an unconfirmed mode request after two seconds;
- restoring the Master, Slave, data-rate, and reboot controls;
- keeping the gradiometer disabled until valid aligned data returns.

The serial write confirmation means the command reached the COM port. It does
not mean the sensor successfully entered the requested hardware mode.

## Reboot recovery

The independent **REBOOT SENSOR** button queues ASCII `e` to that sensor. The
app reports when the byte is actually written, waits three seconds, restores
the controls, and queries the mode and startup settings again. If the COM port
itself fails, disconnect and reconnect that sensor.

## CSV recording

Choose **START RECORDING** and select a base filename. The app writes one
`<name>_gradiometer.csv` file containing the PC time, exact device millisecond
timestamp, Sensor A and Sensor B fields, and A−B. Sensor serial numbers appear
once in the Sensor A and Sensor B column names.

Use **STOP & SAVE** before moving or opening the recording file.

## Gradiometer requirements

A−B updates only when:

- both sensors provide millisecond timestamps;
- data rates match;
- the role combination is not two Masters;
- timestamp cadence and phase are aligned;
- the raw millisecond timestamps match exactly for the two packets.

If A−B is not updating, open the in-app **USER GUIDE** and inspect the
timestamp-alignment message before changing analysis settings.
