I don't know if I want to sit down and write the code for a Pi EVSE. But essentially what it amounts to is a giant service loop:
- If the pilot is on, then perform a hundred or so ADC conversions on channel 0 (pilot feedback) saving the highest and lowest value seen. If the lowest value seen does not correspond to -12V, that's an error. From the highest value you can figure out the state. If it's near 12v, that's A. 9 is B, 6 is C and 3 is D.
- If the pilot feedback state has changed, then you may have to do something in response. A->B or B->A is just informational (plug in or plug out). B->C or B->D is a request for power. C->B or D->B is a request to end power.
- For a request for power, you should perform a GFI self test and then turn the power on. For a request to end power, you should turn the power off.
- If the power is on, you must toggle the power watchdog pin regularly (recommended frequency is 1 kHz, but no more than 100 kHz and no less than 100 Hz).
- If the power is on, the relay test line must be high. If the power is off, the relay test line must be low. You should allow up to 100 ms of grace after power transitions. Otherwise, that's an error.
- If the GFI line is high, that's a ground fault. Turn the power off and report an error on the pilot (stop oscillating - leave it either 0% or 100% duty). If you intend to perform an automatic GFI clearance, you should not reset the GFI until the clearance interval is elapsed. Reset the GFI before attempting to turn the power back on.
- You can perform ADCs on channel 1 to observe the current drawn by the vehicle. Collect samples for two zero crossings (zero is 512), then perform an RMS on the samples and scale it to obtain an RMS current draw. You can also perform ADCs on channel 2 to figure out the AC voltage. Look for the peak and scale that to determine the voltage.
- If you wish to change the pilot, you must give the car 5 seconds of grace to respond. That includes withdrawing the pilot while the vehicle is charging.
- Other than in response to a GFI, you should not turn off the power other than in response to a [CD]->B state change. Yanking power away from the vehicle is bad for the contactor. The vehicle will arrange for current draw to be reduced to near zero before changing state. Other than in response to a B->[CD] transition, you should never turn the power on for rather obvious reasons.
- In state A (no vehicle) the pilot should be a steady +12v. Do not oscillate the pilot in state A. A vehicle transition directly from state A to state C or D is illegal. A transition from state B to C or D is illegal unless the pilot is oscillating (an EVSE can deny permission to charge by refusing to oscillate the pilot).
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.