Start here if you're new to the project.
The VR Simulator is an ESP32 firmware that generates realistic automotive variable reluctance crank sensor signals. It outputs authentic Subaru 36-2-2-2 waveforms that can be used for ECU testing, signal conditioning validation, or sensor simulation.
┌─────────────────────────────────────────────────────┐
│ ESP32 VR Simulator │
├─────────────────────────────────────────────────────┤
│ │
│ GPIO4 (PWM Input) ──→ Frequency Detector │
│ ↓ │
│ Waveform Generator │
│ ↓ │
│ GPIO25 (VR+) ◄──────── DMA Pipeline ──→ GPIO26 │
│ (48 kHz, 8-bit) (VR-) │
│ │
│ UART0 ──→ Serial Console (115200 baud) │
└─────────────────────────────────────────────────────┘
pio runpio run -t uploadpio device monitor --baud 115200
You should see RPM updates every second:
[FREQ] 50.00 Hz | RPM: 1500 [FREQ] 50.00 Hz | RPM: 1500 [FREQ] 50.00 Hz | RPM: 1500
Connect an oscilloscope to GPIO25 (VR+) and GPIO26 (VR-) to see the differential signals. The waveform shows realistic sinusoidal teeth with compression-based modulation.
Connect a PWM signal generator to GPIO4:
The simulator will automatically regenerate the waveform to match the input frequency.
python plot_vr_signals.py
Creates a comparison plot of signals at 1500 and 3000 RPM.
| Problem | Solution |
|---|---|
| Build fails with "esp-idf not found" | Run pio run -c -e esp32 to rebuild everything |
| No signal on GPIO25/26 | Check oscilloscope ground connection and ESP32 power |
| RPM not updating from GPIO4 | Verify PWM frequency is 20-200 Hz and signal is 3.3V compatible |
| Serial monitor shows garbage | Ensure baud rate is set to 115200 |
Once you have the basic firmware running: