ADC Design¶
The ADC (Analog-to-Digital Converter) on OSECHI measures analog signals from the MPPC sensor on one detection channel.
Physical Configuration¶
| Item | Value |
|---|---|
| ADC Input Pin | GPIO32 |
| Resolution | 12-bit (0–4095) |
| Input Voltage Range | 0–3.3V |
| Sampling | Event-driven (triggered on detection only) |
Hardware Jumper¶
The ADC input (GPIO32) is physically connected to one of the three detection channels via a hardware jumper on the PCB.
| Jumper Position | Connected Channel | ADC outputs non-zero when |
|---|---|---|
| CH1 (default) | Channel 1 (GPIO12) | CH1 detects |
| CH2 | Channel 2 (GPIO19) | CH2 detects |
| CH3 | Channel 3 (GPIO27) | CH3 detects |
The firmware reads the ADC_JUMPER_CHANNEL build flag (defined in platformio.ini) to know which channel the jumper is connected to. If the dependent channel has no detection in a given event, the ADC value is reported as 0.
If you move the jumper to a different channel, update the build flag to match:
; platformio.override.ini
[env:esp32dev-v2]
build_flags =
-DADC_JUMPER_CHANNEL=2 ; match physical jumper position
Serial Output¶
The adc field appears in every detection event. With ENABLE_ADCMV=1 (default), adc_raw and adc_mv are also included:
{"type":"event","status":"ok","sent_us":1748012345678901,"hit1":85,"hit2":0,"hit3":91,"adc":2048,"adc_raw":2048,"adc_mv":1960,"detected_us":1748012345678456}
adc— raw 12-bit value (0–4095);0if the dependent channel has no detectionadc_mv— converted to millivolts (0–3300 mV)
Troubleshooting¶
| Symptom | Likely Cause | Action |
|---|---|---|
adc always 0 |
Dependent channel not detecting | Check that the jumpered channel is receiving signals |
adc always 0 |
Jumper position doesn't match ADC_JUMPER_CHANNEL |
Update build flag to match physical jumper |
adc_mv missing |
ENABLE_ADCMV=0 in build |
Enable ENABLE_ADCMV=1 in platformio.override.ini |
Related Documentation¶
- GPIO Pinout — Pin allocation and connections
- Hardware Overview — General hardware description
- V2 API Reference — Event output field reference