Control Pilot calibration
Overview~
Control pilot calibration is performed by setting the right pilot.levels values in board.yaml.
These values are used for detection EVSE states and diode short error.
The following table descibes the J1772 specification pilot states. (source)
| State | High voltage | Low voltage | Frequency | Resistance |
|---|---|---|---|---|
| A | 12 V | N/A | N/A | N/A |
| B | 9 V | - 12 V | 1 kHz | 2.74 kΩ |
| C | 6 V | - 12V | 1 kHz | 882 Ω |
| D | 3 V | - 12V | 1 kHz | 246 Ω |
| E | 0 V | 0 V | N/A | |
| F | N/A | -12 V | N/A |
In our example circuit, sensing CP voltage is provided by a voltage divider with shift (R2, R4, R6).
Wire CP_OUT is connected to the EV, CP_SENS is connected to ESP32 ADC input.

For this circuit there is simulation with EV side.
Because state detection is performed only on high voltage on a real vehicle, a DC power supply can be used in the simulation.
State A~

State B~

State C~

State D~

Negative voltage~
For diode short detection, it's enough to just detect less than -6V.

Measurements~
Here are the measured values for the EV states:
| State | ADC voltage |
|---|---|
| A | 2560 mV |
| B | 2251 mV |
| C | 1948 mV |
| D | 1636 mV |
| Low voltage | 728 mV |
Calculated levels~
Based on the measurements, we calculate midpoint voltage between states, that will be used as down threshold. For state D, the value is calculated as a sequence of the difference B-C and C-D.
| State | Calculation | Down threshold |
|---|---|---|
| A-B | (2560 + 2251) / 2 | 2406 mV |
| B-C | (2251 + 1948) / 2 | 2100 mV |
| C-D | (1948 + 1636) / 2 | 1792 mV |
| D | 1792 - (2100 - 1792) | 1484 mV |
When the calculated values are displayed on the graph, they should have a linear course.

Based on these values, board.yaml should look like this:
NOTE
When designing a new voltage divider, remember the ESP32 adc suggested range (adc is configured for attenuation 11dB).