Accelerometer

Bosch BMA400 on I2C(0) (scl=12, sda=21, 400 kHz, address 0x14 - SDO to GND). It is powered from the always-on 3.3 V rail, so it keeps running in deep sleep and its INT1 line (GPIO4) ends the sleep on motion.

The GPS Pro build uses the chip’s wakeup interrupt engine rather than sampling: configure_wakeup() puts the part in low-power mode with a one-time reference capture, all three axes enabled, one sample, threshold 934 (default 8 LSB at +-4 g, about 250 mg) and INT1 active HIGH, latched. Because the interrupt is latched until INT_STAT0 is read, the state of GPIO4 at the next wake answers “was there any motion since the last cycle”, which a three-sample delta check could miss during smooth driving. _cycle() reads the pin, then calls clear_wakeup() to release the latch.

Deep-sleep wakeup on INT1 (ext1, WAKEUP_ANY_HIGH, pin PULL_DOWN) is armed only while still; while moving the device rides the short 930 timer and re-arming the latch would re-wake it immediately. The reference baseline is nevertheless refreshed every cycle so a vehicle that stops is seen as still again.

is_moving() (three readings 200 ms apart) and debug() are kept for bench diagnostics.

Note

The board’s accelerometer footprint is labelled SC7A20/BMA400 - the Silan SC7A20 is a pin-compatible alternative. The firmware checks the BMA400 chip id (0x90) and reports BMA400: not found otherwise, in which case the reed alarm alone decides raw_motion.

class gpspro.firmware_core.BMA400[source]
ADDR = 20
ok()[source]
_read_accel()[source]
is_moving(threshold=128)[source]

Three readings 200ms apart — True if max gap total delta > threshold LSB. threshold=128 at ±4g ≈ 250mg, matches hardware wakeup interrupt sensitivity.

debug()[source]

I2C scan + register dump + 5 live readings. Call once to diagnose.

configure_wakeup(thresh=8)[source]

Example (verbatim from the firmware source):

BMA400 wakeup interrupt on INT1 (GPIO4). Correct register map per datasheet:
  0x19 = ACC_CONFIG0  power mode
  0x20 = INT_CONFIG1  latch mode
  0x21 = INT1_MAP     interrupt routing to INT1 (bit[0]=wkup)
  0x24 = INT12_IO_CTRL  INT1 polarity+drive (reset default = 0x22)
  0x2D = AUTOWAKEUP_1   bit[1]=wkup_int enable
  0x2F = WKUP_INT_CONFIG0  reference mode + axes + num_samples
  0x30 = WKUP_INT_CONFIG1  threshold

INT1 is active-HIGH (idle LOW) so it pairs with esp32.WAKEUP_ANY_HIGH,
and latched until INT_STAT0 (0x0E) is explicitly read — the hardware's
own temporary-latch option tops out at 8s, well under how long a GPS
fix can take, so the firmware clears it itself (see clear_wakeup()).
clear_wakeup()[source]

Read INT_STAT0 (0x0E) to release the latched wakeup interrupt so INT1 drops back to idle LOW, ready to detect the next motion onset.