Introduction: Arduino EV J1772 Charging Station

Based on the OpenEVSE project

OpenEVSE

OpenEVSE Store

Arduino Electric Vehicle Charging Station "Electric Vehicle Supply Equipment" (EVSE) implementing the J1772 protocol.

J1772 is used in the current generation of Electric Vehicles and Plug ins such as the Nissan LEAF and Chevy Volt.

The EVSE advertises the Maximum current available to the EV with a 1khz pilot signal. The Duty Cycle of the pilot sets the available current the EV may draw. The EVSE also functions as a safety device, the 240V AC lines of the J1772 plug are not hot until the EVSE and EV command the start of charging. The EVSE also functions as A ground fault interrupt device (GFCI).

Parts list and Schematics are attached as images.

Step 1: Setup ARDUINO Shield

Build and ARDUINO proto shield.

I used the Shield from Adafruit. http://www.adafruit.com/products/55

Solder 2 x 8pin and 2 x 6pin headers to the outside holes.

Solder 2 x 5mm 2 Position Terminal headers to the protoboard for the Relay and J1772 Pilot

Step 2: Status LEDs

Solder Common Cathode RGB LED to proto board and 1 x 330 Ohm resistor each for Red, Green and Blue.

Solder the Common Cathode to Ground.

Solder Signal Wires:
Red - D5
Blue - D8
Green - D13

LED pinout (CC RGB LED from Sparkfun)
Blue - Green - GND (longest lead) - RED

Step 3: Relay Driver

2N2222A NPN transister connects to R11 (330 ohm) then to D8 (also connects to LED blue), GND and the Relay Output.

Step 4: Pilot DC/DC Converter

The J1772 Pilot requires a 1khz signal that swings from -12V to +12V. A D107E DC\DC converter from MicroPower Direct converts 5VDC to both positive 12V and negitive 12V. The converter requires a minimum draw so a 2.4k resistor and 1uf capacitor is added from each output to ground.

I connected the MPD D107E such that the 5V and GND pin lined up with the central 5V and ground rails on the proto board.

Step 5: Pilot Opamp

The Opamp for the pilot is a LF353 which is powered by the DC/DC converter from the last step. The positive +12V output connects to pin8 and negitive -12V connects to pin 4.

A voltage divider with 2 100K (R8 and R9) resistors is connected to +5V Gnd and Pin 2 of the LF353.

Pin 3 or the Opamp connects to the ARDUINO D10 on the protoshield.

The output, pin 1 connects to a 1% 1k ohm resistor and then to the pilot output.

A P6KE16CA bidirectional TVS diode is also connected to the pilot output and then to ground.

Pins 5, 6 and 7 are not used.

Step 6: Pilot Voltage Measurement

The Charging station and the car communicate witht he pilot. The Charging station must read the voltage so it can correctly respond.

1. Solder R5 (56k) from 5v to Arduino Analog 1 (A1).

2. Solder R6 (100k) from Gnd to Arduino Analog 1 (A1).

3. Solder  R7 (200k) from Pilot output to Arduino Analog 1 (A1).

This circuit workis by providing a voltage divider (R6 and R7) to scale down the -12V to -12V levels. R5 provides a bias to keep the voltage positive, the Arduino does not tolerate negitive voltages on the analog inputs. -12v will be 1V on A1 and +12V will be 4.5V on A1.

Step 7: GFCI

Ground Fault Inturupt (GFCI) is an important part of a charging station. GFCI works by measuring the differance of current out verses current in. If there is a differance the circuit trips. Standard GFCI trips at 5mA, however EVs need a less sensitive trip point. Most comercial EVSEs use 20mA.

This Circuit work by using a Ground Fault Current Transformer (CT) from CRMagnetics (CR8420-1000-G). THe CT creates a small voltage when there is a fault. The small voltage from the CT is first amplified in the first stage then compared to a referance voltage in the second. If the amplified CT voltage is higher than the referance the Opamp goes high and causes the Arduino to register an inurupt on Arduino pin D2.

1. On another protoshield solder a 8pin socket.

2. Solder power wires, pin 4 to 5v and pin 8 to Ground

3. Solder Diodes 1N4148 to the Op-amp outputs pins 3 and 5.

Opamp Output A

4. Solder header pins for CT coil.

5. Solder zener diodes to the header.

6. Solder 330 ohm resistor R17 to the header. (the value of this resistor can be changed to change the GFCI trip point)

7. Solder R16 from the CT coil header to Opamp pin2

8. R17, and a .1uf Capacitor from Opamp pin 2 to the diode on pin 1.

Opamp Output B

9. Solder R15 (20k) to Gnd and R14 (100k) to 5V, connect resistors together then to Opamp pin 6.

10. Connect Opamp Output pin 7 diode to 10K resistor and the to Arduino Digital 2 (D2), connect other end of resistor to Gnd.

Step 8: Load EVSE Firmware

Use the Arduino IDE to load "Open EVSE" firmware to the Arduino board.

Step 9: RGB LCD (optional)

If the Adruino and 2 shields is not tall enough for you, add an RGB LCD shield from Adafruit.

Assemble according to the guide on the adafruit site...

Add LCD code to Open EVSE code...

#include <Adafruit_MCP23017.h>
#include <Adafruit_RGBLCDShield.h>

#define RED 0x1
#define YELLOW 0x3
#define GREEN 0x2
#define BLUE 0x6
time_t elapsedTime;

void OnboardDisplay::Update()
{
  uint8_t curstate = g_EvseController.GetState();
  int i;

  if (g_EvseController.StateTransition()) {
    switch(curstate) {
    case EVSE_STATE_A: // not connected
      lcd.setBacklight(GREEN);
      lcd.setCursor(0, 0);
      lcd.print("EVSE Ready  ");
      lcd.setCursor(13,0);
      lcd.print((int)g_EvseController.GetCurrentCapacity());
      lcd.print("A");
      lcd.setCursor(0, 1);
      lcd.print("Not Connected  ");
      break;
    case EVSE_STATE_B: // connected/not charging
      lcd.setBacklight(YELLOW);
      lcd.setCursor(0, 0);
      lcd.print("EVSE Ready      ");
      lcd.setCursor(13,0);
      lcd.print((int)g_EvseController.GetCurrentCapacity());
      lcd.print("A");
      lcd.setCursor(0, 1);
      lcd.print("Waiting for EV   ");
      break;
    case EVSE_STATE_C: // charging
      lcd.setBacklight(BLUE);
      lcd.setCursor(0, 0);
      lcd.print("Charging     ");
      lcd.print((int)g_EvseController.GetCurrentCapacity());
      lcd.print ("A");
      break;
    case EVSE_STATE_D: // vent required
      lcd.setBacklight(RED);
      lcd.setCursor(0, 0);
      lcd.print("EVSE Error      ");
      lcd.setCursor(0, 1);
      lcd.print("VENT REQUIRED   ");
      break;
    case EVSE_STATE_DIODE_CHK_FAILED:
      lcd.setBacklight(RED);
      lcd.setCursor(0, 0);
      lcd.print("EVSE Error      ");
      lcd.setCursor(0, 1);
      lcd.print("DIODE CHK FAILED");
      break;
    case EVSE_STATE_GFCI_FAULT:
      lcd.setBacklight(RED);
      lcd.setCursor(0, 0);
      lcd.print("EVSE Error      ");
      lcd.setCursor(0, 1);
      lcd.print("GFCI FAULT      ");
      break;
        }
  }
if (curstate == EVSE_STATE_C) {
      lcd.setCursor(0, 1);
      elapsedTime = now();    
      if (hour(elapsedTime) < 10) {
      lcd.print("0");
      }
    lcd.print(hour(elapsedTime));
    lcd.print(":");
    if (minute(elapsedTime) < 10) {
      lcd.print("0");
      }
    lcd.print(minute(elapsedTime));
    lcd.print(":");
    if (second(elapsedTime) < 10) {
      lcd.print("0");
      }
    lcd.print(second(elapsedTime));
    lcd.print("        ");
  }
}



Step 10: Testing

The J1772 Pilot is a 1khz +12V to -12V square wave, the voltage defines the state and the duty cycle defines the current available to the EV. The EVSE sets the duty cycle and the EV adds resistance from the pilot the Ground to vary the voltage. The EVSE reads the voltage and changes state accordingly.

State     Pilot Voltage           EV Resistance       Description 
State A        12                             N/A                      Not Connected 
State B         9                             2.74k                   Connected 
State C         6                              882                     Charging 
State D         3                              246                     Ventilation Required 
State E         0                               N/A                     No power 
State F       -12                              N/A                     EVSE Error 

State A - To test State A, power up the EVSE. The EVSE should go to the ready state. LED should light Green. 
State B - To test State B, with the EVSE powered connect the EV Simulator (or diode and resistor) with a resistance of 2.74k Ohms. The EVSE should go to the EV Connected - EVSE ready state. LED should light Yellow. 
State C - To test State C, with the EVSE powered connect the EV Simulator (or diode and resistor) with a resistance of 882 Ohms. The EVSE should go to the EV Connected - EVSE ready state. LED should light Blue. 
State D - To test State D, with the EVSE powered connect the EV Simulator (or diode and resistor) with a resistance of 246 Ohms. The EVSE should go to the Error Vent required. LED should light Red. 
State E - To test State F, the EVSE should be disconnected from power. The EVSE should turn off, the LED should go out. 
State F -To test State F, with the EVSE powered connect the EV Simulator (just a resistor) with a resistance of 2.74k Ohms. The EVSE should go to the Error Diode Check Failed. LED should light Red. 

Frequency -The Pilot should have a frequancy of 1kHz(1000Hz). The acceptible J1772 tolerance is from 980-1020Hz. Test Frequency by attaching the EV simulator in State C "Charging Mode) (or diode and 882 Ohm resistor). Attach a multimeter or occiloscope from pilot to EVSE Ground. 

Pilot Duty Cycle - The Pilot Duty Cycle is dependant on the Max current setting of the EVSE. Test Duty Cycle by attaching the EV simulator in State C (Charging Mode). Attach an occiloscope from pilot to EVSE Ground. Duty cycle should match the chart below.

Up to 51A Amps = Duty cycle x 0.6 Duty cycle = Amps / 0.6
51 - 80A Amps = (Duty Cycle - 64) 2.5

Duty Cycle  Max Current 
< 3%  Error 
3% - 7%  Digitial Com Required 
10%  6A 
20%  12A 
30%  18A 
40%  24A 
50%  30A 
60%  36A 
70%  42A 
80%  48A 
86%  55A 
88%  60A 
90%  65A 
92%  70A 
94%  75A 
96%  80A 

Step 11: High Voltage

The Arduino EVSE can charge at any J1772 rate from 6 Amps to 80 Amps. I chose to use a 240V 30A J1772 cable along with a 30A relay and L6-30 twistlock plug. The max charge rate of the Nissan Leaf is 16 Amps so that leaves plenty of margin.

WARNING - please do not play with 240V if you are not qualified...

1. L6-30 Strip about 6 inches of outer insulation back to expose Hot (black), Neutral/Hot2 (white or red) and Ground (green) wires. Strip each wire back and solder or crimp the appropriate connectors on the Hot and Neutral wires for your relay. (optional) Add a second set of wires if required to power your Ardrinos power supply.

2. Prepare the J1772 plug by removing about 6 inches of outer insulation exposing 4 or 5 wires. If the 5th wire for proximity is present just fold it over and shrink wrap over it so it cannot short anywhere it is not required for the charging station. strip back about 1/2 inch of the 4 wires Hot (black), Neutral/Hot2 (white or red), Ground (green) and pilot (Orange on my cable but some are blue). Solder or crimp the correct connectors for your relay on the Hot and Neutral wire.

3. Tie all ground wires together.

4. Place both the Hot and Neutral wire of the J1772 cable through the Current Transformer and connect wires to relay.

5. Connect power supply. Note power supply must be 12V output and Input should be universal (from about 90 - 260V).

6. Connect the Pilot Wire to the Arduino shield Pilot output.

7. Connect Relay coil to the shields Relay output.

8. Connect the Power Supply to the Arduino.

Step 12: Charging

After testing its time to charge.... plug in power and test again. Check your relay, did you get the high voltage wiring correct?

Plug in the J1772 and your EV should start charging.

Future plans... clean up the low voltage wires and put Arduino in proper enclosure.

Arduino Challenge

Participated in the
Arduino Challenge

Make It Real Challenge

Participated in the
Make It Real Challenge