Close

Spelling it out: Making pilot

A project log for Raspberry Pi EVSE Hat

Use a Raspberry Pi to build an EV charging station

nick-sayerNick Sayer 04/25/2022 at 07:250 Comments

To start with, make sure you've done the PWM overlay as described in previous logs. Either by adding it to /boot/config.txt or doing it manually at the command line with dtoverlay.

Next, as a preparatory step, open /sys/class/pwm/pwmchip0/export and write "0\n" to it.

When you want to activate the pilot, write "1000000\n" to /sys/class/pwm/pwmchip0/pwm0/period. That's one million nanoseconds, which is one millisecond - a 1 kHz period. Next, multiply the duty cycle in percent by 10,000 and write that (with a trailing newline) to /sys/class/pwm/pwmchip0/pwm0/duty_cycle. As an example, 10% (which would represent a pilot ampacity of 6A) would be a duty_cycle of 100,000 - which means that the high portion lasts 100,000 nanoseconds, or 100 microseconds. Lastly, write a "1\n" to /sys/class/pwm/pwmchip0/pwm0/enable.

To force the output high (solid +12v), set the duty cycle to 101%. To force the output low (solid -12v), set the duty cycle to 0%.

Normally, a solid -12 pilot is supposed to indicate a fatal error - because the pilot never exceeds 0v, the EVSE cannot detect the presence of a vehicle at all.

A solid +12 volts indicates that in principle the EVSE is willing to charge, but is not yet ready. Normally when there is no vehicle connected the pilot is pinned to +12v. In this state, the EVSE can detect the presence of a vehicle by seeing that the +12v is pulled down to +9v (the vehicle could, in principle pull to +6 or +3 volts, but that would be illegal, as the vehicle is required to wait for an "offer" first).

An oscillating pilot from an EVSE is an indication to offer the indicated number of amps to the vehicle, depending on the duty cycle.

Detecting the pilot feedback is done with the ADC, which was described in a different project log.

Discussions