How to build an electric vehicle EV charger
Source: InternetPublisher:无人共我 Keywords: Car Charger Updated: 2023/12/22
In this project I built my own 7.2kW EV charger and mounted it inside a Zappi enclosure. The two goals are simplicity and security. This article documents the build. I wrote the Arduino software for it, and all the design files, software, and parts list can be found on the GitHub page.
Background of the project
In the UK, it costs around £900 to have an electric car charger installed by an electrician. This prompted a desire to do it myself, and while researching the topic further I discovered an open source charger (EVSE) with good documentation. This gave me the confidence to build myself up.
Disclaimer
I'm not a professional electrician I learned about grounding systems, PEN faults, RCD, cable current capacity, etc. I think I've educated myself enough and have a secure enough system in place. But my design below is for reference only. And to be safe, during my actual use, I would have to remove the charger when I left the house. I'm sure there are countless people out there who will question this project of mine, but building your own switchable 240V32A outdoor charger can be dangerous if not done correctly. Nonetheless, I welcome constructive criticism and discussion.
Step 1: Start Preparing
EV chargers use a simple "bootstrap" signal to detect when they are plugged into the car and tell the car how much current it is allowed to draw from the charger. They don't modify the power supply at all, they just turn it on/off to the car via some relays. In addition to this, they also contain the functionality of RCD. But honestly, that’s it!
I managed to buy a second hand Zappi charger. It doesn't have any electronics inside, but it gave me a case, cables, and plugs to work with. I paid £120 including postage.
I purchased 5 meters of 6mm² SWA cable to run from my consumer unit to my desired charger location. I added a 50AMCB to the consumer unit on the non-RCD side and routed the SWA cable using cleats and stainless steel screws.
The SWA cable enters the Zappi enclosure through an outdoor waterproof gland. The live and neutral wires pass together through a current transformer before being connected to the PCB.
Step 2: Ground Current Detection
One of the most important safety mechanisms is the ground current detection system. The car chassis is grounded via the ground wire through the charging plug. Ground power comes from the consumer unit (we have TN-CS power).
. John Ward has some instructional YouTube videos on topics I've watched. He discussed issues such as PEN failures. If you do any electrical work, it's worth taking the time to educate yourself about grounding.
Although unlikely, it is possible that a malfunction could occur, such as a live wire coming into contact with the car's chassis. Maybe it's loose somewhere in the car and is contacting the chassis, or maybe a wet connector is bridging the path to the chassis.
Either way, the live wire will provide current to the chassis, which will go directly to ground (in a TN-CS power supply, the ground and neutral wires are connected to the consuming unit). The amount of current will depend on the resistance of the faulty bridge. (Water is unlikely to allow many amps to flow). Given that the chassis is well grounded, its voltage should not rise high enough to create a shock hazard to anyone touching it.
However, this is a failure condition that should be detected and handled. If some water would have a live connection to the chassis, it might flow a few amps (not enough to trip the charger's 50AMCB), but enough to cause localized heating and further damage.
So we need to measure the current flowing to ground (which should be zero in normal operation). If it exceeds 20mA we want to isolate the car by opening the relay. The reason RCDs usually trip at 5-30mA is that the amount of current for a few hundred milliseconds will not cause permanent damage to the human body. Here is the Wikipedia article on electrical injuries.
AC-1: imperceptible, AC-2: perceptible but no muscle response, AC-3: muscle contraction with reversible effect, AC-4: possible irreversible effect, AC-4.1: probability of ventricular fibrillation up to 5%, AC-4.2: 5–50% probability of fibrillation, AC-4.3: more than 50% probability of fibrillation
The method of measuring current to ground is simple. We use current transformers to measure the common mode current in the live and neutral wires. All current should be differential (all current from the hot wire should go through the load and back through the neutral). If there is a fault and some current does not return, it must be connected to ground. This is a common mode current and we want to measure it!
Step 2: Schematic Part
The following electronic equipment is necessary:
Generate DC voltage for arduino, op amps, relays and more
Install the 40A250VL&N relay to switch power to the charging plug
Generate +/-12V1kHzPWM signal for pilot
Amplify and rectify the signal of the current transformer before the Arduino's ADC
Step 3: Power
I used the RAC10-15DK/277AC/DC power module. This results in a +/-15V voltage rail. Adjustable positive/negative linear regulators (LM317 and LM337) generate +/-12V voltage rails. I know the outputs of the op amps may not swing all the way to their supply rails, so I'm hoping to gain some flexibility by using an adjustable voltage regulator.
The regulator requires a minimum load of approximately 5mA to maintain regulation. Therefore, R3 and R17 provide a small load on them. Regulators operate uncomfortably close to their dropout voltage. According to the datasheet, the dropout voltage at 0°C is about 1.6V at 20mA load, which allows us to boost the op amp voltage to about 13.4V if necessary.
Due to the current chip/stock shortage, I purchased a Pro-Mini module that conveniently houses an Atmega328PArduino with a 5V regulator. But please note that the maximum input voltage of this onboard regulator is 10V, so I used a 4.3V Zener diode to reduce the regulated 12V and then feed it to the Pro-Mini's RAW input.
All communication with the car is done through a single wire, called a pilot signal, that is referenced to the ground. Read here and here for an explanation of how this signal works. In short, the car puts different resistors on the pilot signal depending on whether it is connected/ready to charge etc. This results in a change in the voltage of the pilot signal.
The LM358 op amp takes the 0-5VPWM signal from the Arduino and converts it into a +/-12V signal to form the pilot. simple.
We use a voltage divider network to regulate the pilot voltage and then feed it into the ADC channel for measurement. The 13.6V600W bidirectional TVS ensures that no abnormal voltage will appear on the boot line.
Relay operation
I initially thought I should share the load between the 2 power rails of the SMPS. So one relay will be powered by the +ve rail and the other by the -ve rail. However, doing so adds a few extra pieces to the design and slightly increases the overall complexity. To keep things simple, I had both relays powered by the +ve rail, which ended up working very well.
The T9VV1K15-12S relay specifications report a coil holding voltage of only 4.7V. This can save a lot of power. As you can see from the schematic, we are charging the 100uF capacitor from the +15V rail through the 1W47R resistors (R13 and R14). When the relays are activated, they initially but briefly gain 15V. But the steady state voltage decays to about 9V. I should choose a 68R or even 100R resistor to save more power.
The BC337 transistor gets about 2mA base current through the 2.2K resistor. This is enough to switch the transistor fully.
Current Transformer
Current transformers are similar to voltage transformers. We make 1 turn of the transformer primary by passing the live and neutral wires through the ferrite core once. On level two we have a lot of turns - 100 turns. Therefore, the current on the primary is induced on the secondary, although its magnitude is proportional to the turns ratio. If the primary current is 20mA and the turns ratio is 1:400, the secondary current is 50uA.
Just like voltage transformers don't like short circuits. Current transformers don't like open circuits. The best way to measure secondary current is to use a transimpedance amplifier.
U2 is an OP07 low offset op amp. The V+ terminal is connected to ground, and in this configuration the output will swing from side to side to always keep V- at the same voltage as V+ (i.e. 0V). Imagine if a current transformer applied 50uA to the V terminal of U2. The op amp will drop its output voltage to -5V so that 50uA is pulled entirely through R2 (V=IxR=50uAx100K). Therefore, the V- terminal remains exactly at 0V. So you can see in this configuration that the current from the transformer is converted into voltage at the output of the op amp. C1 only helps reduce high frequency gain and acts as a low pass filter. If the transimpedance amplifier saturates, D1 and D2 prevent any voltage excursion beyond about 0.7V.
We may not need the low offset feature of OP07. C2 will remove any DC offset anyway. U3B is configured to act as a further amplification stage and precision rectifier. The 4.3V Zener diode used also clamps the output to ~4V maximum. R12 and C3 add a final low pass filter before entering the ADC channel.
To summarize, the AC current from the ground fault current transformer is converted to voltage, amplified, rectified, limited and filtered before being passed to the Arduino ADC for measurement. This circuit worked and made sense to me, so I chose it. But you can probably simplify it further.
Step 4: PCB Design
I use KiCad to design the PCB. I chose KiCad because it is open source and you can make multi-layer PCBs if needed. SnapEDA is the key to importing part PCB packages. There isn't much to say about PCB design. I left 4mm clearance around the high voltage traces.
Step 5: Assembly and Welding
I soldered the PCB using parts I got from Mouser. I realized that one of the op amps in my design had the wrong pins, so you can see an ugly little goof to fix the problem! I also didn't realize that the Pro-Mini's voltage regulator couldn't handle >10V, so I burned one while adjusting the rail voltage. Luckily I bought a pack of 3 Pro-Mini's... I made the mistake of adding a Zener diode to reduce the voltage before feeding it to the Pro-Mini. I have corrected these issues on the schematic and PCB on github and called PCBV2.0.
Step 6: Software and Testing
I'm not a software expert. Hopefully the code is well commented enough to make sense. Find it in the GitHub repository.
There is a self-test coil on the current transformer. The software performs self-test by passing a 50Hz5mA square wave through 5 turns of the test coil. This basically simulates a 25mA ground fault. We calculate the time required to detect a fault. The test passes if the fault is detected within 100 milliseconds.
test
Out of interest, I measured the voltage across the relay coil at startup. The blue trace is the coil voltage and the red trace is the switch AC output. It seems to take about 5ms to activate the relay. They obviously bounced a little when they came into contact.
Again, the relay seems to take about 10 milliseconds to release.
The boot voltages are exactly as they should be. The SAE_J1772 specification does allow +/-0.5V for +12V and +/-1V for +9V, 6V and 3V levels, so we're comfortable.
This trace shows what happens when a car is detected. The +12VDC pilot is pulled down by the car's 2.74K resistor. After 200 milliseconds of interruption, the software switches to "State B" and starts 1kHzPWM.
This is the pilot while the car is charging. -12V to +6V. The software is measuring the voltage at the center of the low and high zones.
It is important to test the ground fault detection circuit. I tested it tripping at 6mA. Here is a trace showing the tripping speed when a 22K resistor draws 11mA through a 240V live ground. The detection time is 12ms (from the beginning of the AC waveform to the rising edge of the blue waveform. Therefore, a relay release time of 10ms will cut off the power supply in 22ms. This is within the national specifications for EV chargers.
in conclusion
I'm very happy with the end result. Although it doesn't have an LCD screen, my car tells me how fast it's charging and allows me to configure charging times, etc. I don't need any smart features. I have a smart meter so I also know how much electricity I use. The total cost was around £200. Plus a few days of hard thinking, soldering, and coding. Although it does take a lot of effort in the process, I think it is worth it.
- Smart Farm Design Solution Based on LoRa
- Secret code lock circuit
- Computer host overheating alarm circuit
- One control three constant pressure water supply frequency conversion speed control circuit a
- 220V AC mains directly drives small relay circuit_3
- SCR control buzzer circuit
- Stapler control circuit
- Electronic ventriloquist circuit
- Chinese learning machine disk drive interface card circuit diagram circuit
- Wire break tester