Hardware & Pi Setup Guide
Complete hardware specification with verified, purchasable components — exact model numbers, suppliers, and prices. Everything you need to build a MineGuard monitoring unit for ~$1,400-1,500.
System Architecture
Everything connects to a single Raspberry Pi 5. Solar powered. Works offline, syncs when connected. All data logged locally with timestamps.
┌──────────────────────────────────┐
│ Raspberry Pi 5 (4GB) │
│ │
[Engine] ──audio──▶ │ [INMP441 MEMS Mic] ──I2S──▶ GPIO│
│ │
[Sample] ──weight─▶ │ [Load Cell] ──▶ [NAU7802] ─I2C─▶│
[Leach Jar] ─vol──▶ │ [VL53L1X ToF] ────────────I2C─▶│
[Assay] ───SWV────▶ │ [EVAL-AD5941] ────────────SPI─▶│
[Solution] ─temp──▶ │ [DS18B20] ────────────1-Wire──▶│
[Tamper] ──shock──▶ │ [ADXL345] ──────────────I2C──▶│
[Location] ─GPS───▶ │ [NEO-6M] ─────────────UART──▶│
[Weather] ─────────▶│ [BME280] ──────────────I2C──▶│
│ [SH1106 OLED] ─────────I2C──▶│
│ │
│ ──WiFi/4G──▶ [Cloud Dashboard] │
└──────────────────────────────────┘
│
[100W Solar] ──▶ [50Ah LiFePO4] ──▶ [Pi 5]Single Board
One Raspberry Pi 5 runs all sensors, ML inference, and data logging
Offline-First
All data stored locally in SQLite, synced to cloud when connectivity is available
Solar Powered
100W panel + 50Ah LiFePO4 battery provides 4+ days of autonomy without sun
Computing & Control
The Raspberry Pi 5 is the brain of the system — enough power for ML inference, GPIO for sensors, and low power draw.
Hardware Specs
- Raspberry Pi 5 (4GB RAM) — $75
4GB sufficient for TFLite ML inference and concurrent sensor processing
- SanDisk MAX Endurance 64GB microSD — $15
Industrial-grade endurance for reliability in extreme temperatures
- Built-in WiFi + optional 4G USB modem
For remote sites with no WiFi coverage
- Power draw: ~5W
Low enough for solar-only operation
Software Stack
- Raspberry Pi OS Lite (64-bit)
No GUI needed — headless operation
- Python 3.11+
Primary language for sensor control and ML
- TensorFlow Lite
Optimized ML runtime for audio classification
- SQLite
Local data storage, zero configuration
Audio Monitoring
MVP uses a single INMP441 I2S MEMS microphone wired directly to Pi GPIO — no USB audio interface needed. Detects engine on/off via ML audio classification.
MVP: INMP441 I2S MEMS Mic
INMP441 breakout — $3
I2S digital output wired directly to Pi GPIO. No USB audio interface needed. 1 mic is enough for MVP.
Wiring to Pi 5 GPIO
VDD → 3.3V (pin 1)
GND → GND (pin 6)
SCK → GPIO18 (pin 12) — I2S BCLK
WS → GPIO19 (pin 35) — I2S LRCLK
SD → GPIO20 (pin 38) — I2S Data In
L/R → GND (left channel)
Software: dtparam=i2s=on in /boot/config.txt
Audio Capture
- I2S digital audio via GPIO (no USB)
- 16kHz sample rate, mono
- 1-second analysis windows
- MFCC features (13 coefficients)
Future Upgrade
4x Behringer ECM8000 mics ($170 each) + UMC404HD USB interface ($110) for multi-engine monitoring.
ML Classification
- Simple CNN classifier
- States: Running / Idle / Off
- TFLite model, under 5MB
- Inference: under 50ms per window
Anti-tamper
If audio goes silent for >30 min during expected operating hours, an alert is triggered.
Assay Station Sensors
On-site electrochemical assay hardware — load cell for sample weight, potentiostat for gold measurement, disposable electrode strips.
Load Cell (Sample Scoop)
- 2kg bar-type strain gauge ($5) with Adafruit NAU7802 24-bit ADC ($5.95)
- I2C connection (0x2A) — STEMMA QT plug-and-play, terminal block for load cell wires
- 24-bit resolution — better accuracy than HX711, no soldering required
- Buzzer beeps at target weight (e.g. 15g ± 1g)
Potentiostat (Electrochemical)
EVAL-AD5941BATZ eval board — ~$205
Official Analog Devices eval board. Connects to Pi via SPI (GPIO10/9/11/8). AD5941 chip does SWV natively — no external waveform generation. Reference firmware: FreiStat, AD5940 examples.
Alternative: IO Rodeo Rodeostat — $240
Open-source, USB connection, comes with alligator clips and Python library. Easier setup but USB-only.
- Square Wave Voltammetry (SWV): -0.2V to +0.8V sweep
- Gold reduction peak at +0.4V to +0.6V
- Peak current maps to concentration via calibration curve
Screen-Printed Electrodes (SPE)
Zimmer & Peacock Hyper Value Carbon SPEs — 100-pack for $160 ($1.60/strip) from IO Rodeo. 3-electrode disposable cells. The strip slides into the IO Rodeo card-edge connector adapter ($30) designed specifically for these electrodes (7.8mm slot, 0.1" spacing, 12" cable).
Working
Carbon
→ AD5941 WE pin
Reference
Ag/AgCl
→ AD5941 RE pin
Counter
Carbon
→ AD5941 CE pin
Connection: Pi → SPI → EVAL-AD5941BATZ → IO Rodeo adapter cable → SPE strip. Carbon SPEs work for gold detection via stripping voltammetry. Upgrade to gold SPEs (~$9.80/strip) later for better sensitivity.
Power System
Completely off-grid power with 2+ days autonomy. Designed for Guyana's equatorial sunshine.
Solar Panel
100W
Renogy Monocrystalline. Produces ~400-500Wh/day in Guyana (4-5 peak sun hours). ~$100.
Battery
12V 50Ah
LiFePO4 (Renogy) — 600Wh capacity. Heat tolerant, long cycle life, no fire risk. ~$180.
Controller
20A MPPT
Renogy Wanderer MPPT charge controller. 10-15% more efficient than PWM. ~$50.
Distribution
8-10W
12V→5V 5A USB-C buck converter for Pi and sensors. Total average draw 8-10W.
Power Budget
Daily Generation
~400-500 Wh
Daily Consumption
~200 Wh
(~8W avg x 24h)
Battery Autonomy
~4 days
without any sun
Anti-Tamper Measures
Multiple layers of physical and digital tamper protection ensure data integrity even in adversarial environments.
Physical Enclosure
IP65 rated junction box with padlock ($30-40). Weatherproof and resistant to dust and water jets.
Tamper Switch
Magnetic reed switch on enclosure door. Opens the circuit and triggers an alert if the case is opened.
GPS Tracking
Optional GPS module tracks if the unit is physically moved from the mining site. Geofence alerts.
Heartbeat Monitor
Pi sends periodic “alive” signals. If signal stops, an alert fires immediately. Detects power cuts and sabotage.
Audio Tamper Detection
If a mic is covered or disconnected, audio characteristics change detectably. ML model flags the anomaly.
Cryptographic Signing
All readings signed with Ed25519 device key. Each day's hash includes the previous day's hash (blockchain-lite chain of custody).
Deterrence
Physical labels on the enclosure: “Warning: Tamper Detection Active — GPS Tracked”. Often, the deterrent is more effective than the detection itself.
Bill of Materials
Complete parts list for one MineGuard monitoring unit. All components are commercially available.
| # | Component | Specification | Qty | Unit | Total |
|---|---|---|---|---|---|
| 1 | Raspberry Pi 5 | 4GB RAM | 1 | $75 | $75 |
| 2 | MicroSD Card | SanDisk MAX Endurance 64GB | 1 | $15 | $15 |
| 3 | DC-DC Converter | 12V→5V 5A USB-C | 1 | $10 | $10 |
| 4 | GPS Module | u-blox NEO-6M | 1 | $12 | $12 |
| 5 | Environment Sensor | BME280 I2C (0x76) | 1 | $8 | $8 |
| 6 | OLED Display | SH1106 1.3" I2C (0x3C) | 1 | $6 | $6 |
| 7 | 4G USB Modem | Huawei E3372h | 1 | $30 | $30 |
| 8 | MEMS Microphone | INMP441 I2S breakout | 1 | $3 | $3 |
| 9 | Mic Housing | ABS box + sound membrane | 1 | $5 | $5 |
| 10 | Potentiostat AFE | EVAL-AD5941BATZ (SPI, native SWV) | 1 | $205 | $205 |
| 11 | Carbon SPE Strips | Zimmer & Peacock Hyper Value (100-pack) | 1 | $160 | $160 |
| 12 | SPE Adapter | IO Rodeo card-edge connector | 1 | $30 | $30 |
| 13 | Load Cell ADC | Adafruit NAU7802 24-bit I2C (0x2A) | 1 | $6 | $6 |
| 14 | Load Cell | 2kg bar-type strain gauge | 1 | $5 | $5 |
| 15 | Laser ToF Sensor | Adafruit VL53L1X I2C (0x29) | 1 | $15 | $15 |
| 16 | Temp Probe | DS18B20 waterproof, 1-Wire | 1 | $5 | $5 |
| 17 | Solar Panel | 100W Mono (Renogy) | 1 | $100 | $100 |
| 18 | LiFePO4 Battery | 12V 50Ah (Renogy) | 1 | $180 | $180 |
| 19 | Charge Controller | 20A MPPT (Renogy Wanderer) | 1 | $50 | $50 |
| 20 | Wiring & Fuses | MC4 connectors, cable, fuses | 1 | $20 | $20 |
| 21 | IP67 Enclosure | Pi + electronics | 1 | $60 | $60 |
| 22 | IP65 Enclosure | Assay station | 1 | $30 | $30 |
| 23 | Mounting Hardware | Poles, clamps, brackets | 1 | $80 | $80 |
| 24 | Accelerometer | ADXL345 I2C (0x53) | 1 | $8 | $8 |
| 25 | Padlock | Weather-resistant | 1 | $15 | $15 |
| 26 | Tamper Seals | Pack of 100 | 1 | $12 | $12 |
| TOTAL | ~$1145 | ||||
Prices are approximate and based on common online retailers. Does not include chemicals (~$190-250) or calibration supplies (~$70-120). See the full SHOPPING-LIST.md for complete pricing with supplier links.
Ongoing Monthly Costs
SPE Strips
$48/mo
~30 strips @ $1.60
Daily Chemicals
$30-50/mo
Drum Chemicals
$20-40/mo
Total Monthly
~$100-150
I2C Bus & GPIO Pin Map
All sensors verified for pin and address compatibility. I2C, SPI, I2S, and 1-Wire use separate GPIO pins — no conflicts.
I2C Bus (GPIO2/GPIO3) — 5 Devices
| Device | Address | Function |
|---|---|---|
| NAU7802 | 0x2A | Load cell ADC |
| VL53L1X | 0x29 | Laser ToF distance |
| ADXL345 | 0x53 | Accelerometer (tamper) |
| BME280 | 0x76 | Temp/humidity/pressure |
| SH1106 | 0x3C | OLED display |
GPIO Pin Allocation
| Pin | GPIO | Protocol | Device |
|---|---|---|---|
| 3, 5 | 2, 3 | I2C | 5 sensors |
| 7 | 4 | 1-Wire | DS18B20 |
| 19,21,23,24 | 10,9,11,8 | SPI | AD5941 |
| 12 | 18 | I2S | INMP441 BCLK |
| 35 | 19 | I2S | INMP441 LRCLK |
| 38 | 20 | I2S | INMP441 DIN |
No Pin Conflicts
I2C (GPIO2/3), SPI (GPIO8/9/10/11), I2S (GPIO18/19/20), and 1-Wire (GPIO4) all use separate GPIO pins. All 5 I2C devices have unique addresses. STEMMA QT connectors allow daisy-chaining without soldering.
Raspberry Pi Setup Guide
Step-by-step instructions to configure a Raspberry Pi 5 as a MineGuard monitoring node.
OS Installation
# Flash Raspberry Pi OS Lite (64-bit) to microSD # Using Raspberry Pi Imager, set hostname: mineguard # Enable SSH, set WiFi credentials # After first boot: sudo apt update && sudo apt upgrade -y sudo apt install -y python3-pip python3-venv git alsa-utils
Python Environment
python3 -m venv /opt/mineguard/venv
source /opt/mineguard/venv/bin/activate
pip install numpy scipy tflite-runtime sounddevice \
adafruit-circuitpython-nau7802 adafruit-circuitpython-vl53l1x \
spidev RPi.GPIO flask sqlite-utils cryptographyAudio Setup
# Enable I2S audio in boot config echo "dtparam=i2s=on" | sudo tee -a /boot/firmware/config.txt echo "dtoverlay=w1-gpio" | sudo tee -a /boot/firmware/config.txt # Reboot to apply sudo reboot # After reboot, verify INMP441 I2S mic is detected arecord -l # Test recording from I2S mic arecord -D plughw:0,0 -f S32_LE -r 16000 -c 2 -d 5 test.wav
GPIO Wiring
I2C Bus (5 devices, SDA/SCL shared): SDA → GPIO 2 (Pin 3) SCL → GPIO 3 (Pin 5) ├── NAU7802 load cell ADC (0x2A) ├── VL53L1X laser ToF (0x29) ├── ADXL345 accelerometer (0x53) ├── BME280 environment (0x76) └── SH1106 OLED display (0x3C) SPI Bus (Potentiostat): MOSI → GPIO 10 (Pin 19) MISO → GPIO 9 (Pin 21) SCLK → GPIO 11 (Pin 23) CS → GPIO 8 (Pin 24) ← EVAL-AD5941BATZ I2S Audio (INMP441 MEMS Mic): BCLK → GPIO 18 (Pin 12) LRCLK → GPIO 19 (Pin 35) DIN → GPIO 20 (Pin 38) VDD → 3.3V (Pin 1) L/R → GND (left channel) 1-Wire (Temperature): DS18B20 data → GPIO 4 (Pin 7) 4.7kΩ pull-up between data and 3.3V
Calibration
# Calibrate NAU7802 load cell python3 calibrate_loadcell.py # Follow prompts with known weights # Calibrate VL53L1X laser distance python3 calibrate_level.py # Set jar height reference # Calibrate AD5941 potentiostat python3 calibrate_assay.py # Use gold standard solutions # Calibrate audio model (I2S mic) python3 calibrate_audio.py # Record engine on/off states
Systemd Service
# Create service file sudo tee /etc/systemd/system/mineguard.service << 'EOF' [Unit] Description=MineGuard Operations Monitor After=network.target [Service] Type=simple User=pi WorkingDirectory=/opt/mineguard ExecStart=/opt/mineguard/venv/bin/python main.py Restart=always RestartSec=10 [Install] WantedBy=multi-user.target EOF sudo systemctl enable mineguard sudo systemctl start mineguard
Sample Python Code
Realistic code snippets showing how MineGuard monitors sensors, runs ML inference, and signs data for tamper-proof logging.
Load Cell Scoop Detection
Monitors the load cell and beeps when the sample scoop reaches the target weight.
import time
import board
import adafruit_nau7802
i2c = board.I2C() # SDA=GPIO2, SCL=GPIO3
nau = adafruit_nau7802.NAU7802(i2c)
nau.gain = 128
SCALE_FACTOR = 2280 # From calibration
OFFSET = 0
TARGET_WEIGHT = 15.0 # grams
TOLERANCE = 1.0
def get_weight(samples=5):
readings = [nau.read() for _ in range(samples)]
raw = sum(readings) / len(readings)
return (raw - OFFSET) / SCALE_FACTOR
def monitor_scoop():
"""Beep when scoop reaches target weight."""
while True:
weight = get_weight(5)
if abs(weight - TARGET_WEIGHT) < TOLERANCE:
buzz(0.5) # 500ms beep
log_sample(weight, time.time())
time.sleep(0.2)Square Wave Voltammetry Measurement
Performs an SWV sweep and extracts the gold peak current to determine concentration.
import spidev
import numpy as np
spi = spidev.SpiDev()
spi.open(0, 0)
spi.max_speed_hz = 1000000
def run_swv(start_v=-0.2, end_v=0.8, step=0.004,
amplitude=0.025, freq=25):
"""Square Wave Voltammetry scan."""
voltages = np.arange(start_v, end_v, step)
currents = []
for v in voltages:
# Apply forward pulse (v + amplitude)
set_dac_voltage(v + amplitude)
time.sleep(1 / (2 * freq))
i_forward = read_adc_current()
# Apply reverse pulse (v - amplitude)
set_dac_voltage(v - amplitude)
time.sleep(1 / (2 * freq))
i_reverse = read_adc_current()
currents.append(i_forward - i_reverse)
return voltages, np.array(currents)
def measure_gold_concentration(voltages, currents):
"""Find gold peak and convert to concentration."""
# Gold peak expected at +0.4 to +0.6V
mask = (voltages >= 0.35) & (voltages <= 0.65)
peak_current = currents[mask].max()
# Apply calibration: concentration = a * peak_current + b
concentration_ppm = (
CALIB_SLOPE * peak_current + CALIB_INTERCEPT
)
return max(0, concentration_ppm)Audio Engine Classification
Records 1 second of audio from the I2S INMP441 mic and classifies the engine state using a TFLite model.
import sounddevice as sd
import numpy as np
import tflite_runtime.interpreter as tflite
interpreter = tflite.Interpreter(
model_path="engine_classifier.tflite"
)
interpreter.allocate_tensors()
def classify_audio(device_id, duration=1.0, sr=16000):
"""Classify engine state from audio."""
audio = sd.rec(
int(duration * sr), samplerate=sr,
channels=1, device=device_id, dtype='float32'
)
sd.wait()
# Extract MFCC features
mfccs = extract_mfcc(audio.flatten(), sr, n_mfcc=13)
# Run inference
input_details = interpreter.get_input_details()
interpreter.set_tensor(
input_details[0]['index'],
mfccs.reshape(1, -1, 13).astype(np.float32)
)
interpreter.invoke()
output = interpreter.get_tensor(
interpreter.get_output_details()[0]['index']
)
states = ['off', 'idle', 'running']
return states[np.argmax(output)]Tamper-Proof Daily Data Sync
Signs daily reports with Ed25519 keys and chains hashes for an immutable audit trail.
import json
import hashlib
import requests
from cryptography.hazmat.primitives.asymmetric.ed25519 \
import Ed25519PrivateKey
def sign_daily_report(data: dict,
private_key: Ed25519PrivateKey):
"""Sign daily report for tamper-proof custody."""
payload = json.dumps(
data, sort_keys=True
).encode()
signature = private_key.sign(payload)
return {
'data': data,
'signature': signature.hex(),
'hash': hashlib.sha256(payload).hexdigest(),
'prev_hash': get_previous_day_hash(),
}
def sync_to_cloud(report):
"""Sync signed report when connectivity available."""
try:
response = requests.post(
'https://api.mineguard.app/reports',
json=report, timeout=30
)
if response.ok:
mark_synced(report['data']['date'])
except requests.ConnectionError:
pass # Will retry next sync cycleReady to Build?
The full MVP hardware kit costs ~$1,400-1,500 with verified, purchasable components. See the dashboard demo to understand what the data looks like in practice.