Wednesday, January 21, 2015

Final designs for OpenEVSE II & Hydra 4.0 are on their way

I've placed the order for what I hope will be the final versions of the OpenEVSE II and Hydra boards. I'm taking a bit of a chance in ordering them both at once, since I had planned to use one to validate the design of the other. But I've done enough testing with the OpenEVSE II prototype (0.3) boards that I'm fairly confident at this point.

New for the Hydra 4.0 design is ground impedance monitoring and relay testing. This brings the Hydra if not into full UL compliance, then at least asymptotically close. Originally, I had intended to leave the GMI system out of the "splitter" variant, but in adding a 1 mA current limit to the ground monitor circuit, I'm fairly confident that the test can be present and still not trip the GFI in the host EVSE - even if it's the ultra sensitive 5 mA type. If it turns out to be problematic, it can always be a "no-stuff" option on the AC board. Unlike OpenEVSE II, there won't be a voltmeter in the Hydra. There simply aren't any remaining analog pins on the controller. Even if that weren't true, there isn't enough room on the AC board for more HV components with sufficient creepage space around them.

OpenEVSE II is a reimagining of OpenEVSE. It changes completely the ADVPWR functionality. Automatic L1/L2 selection is done with an isolated analog voltmeter. The ground monitoring and relay testing systems can be done continuously rather than in isolation, as in the OpenEVSE base design.

Recent work has been done to add temperature monitoring to OpenEVSE. There isn't enough room on the logic/display board for an added sensor, but I did hedge my bets by adding an i2c header to the logic/display board. That can be used to add a remote i2c temperature sensor that can be placed in an interesting spot. But the ATMega controller chip has a built-in thermometer. It isn't tremendously accurate, and it can be affected by the controller's own activity. This has been particularly noted in testing with OpenEVSE, but in that case, the controller is mounted on the opposite side of the board from the main AC/DC power supply, which likely is responsible for quite a bit of conductive heating. OpenEVSE II's controller is well isolated from other nearby heat sources, so it should do much better. In any event, the temperature sensor is supposed to be a safety limiter rather than a critical measure of temperature (such as for a thermostat or the like), so its absolute accuracy is relatively unimportant. The real purpose is to attempt to shut down charging before the ambient temperature causes the controller to fail.

Saturday, January 10, 2015

OpenEVSE II logic/display board theory of operation

The OpenEVSE II design for the logic/display board is fairly well set by this point. All of the iteration lately has been on the feature set of the various types of HV/power boards. I thought I'd set down exactly how the various parts of the logic/display system operate.

I'll do this by showing one sheet at a time of the schematic and explaining all of what's there.

The first sheet is the power supply and GFI subsystems. The HV board has an isolated AC/DC power supply that feeds 12 volts to the logic/display system. EVSEs need +/- 12 volts and +5 volts to operate, so -12 volts and +5 are made with two DC/DC converters built from the venerable MC34063 DC/DC converter module. This chip can be used in buck, boost or inverting topologies, and we use the inverting topology to make a -12 volt supply rated for 50 mA max and the buck topology for a +5V @ 500 mA supply.

The GFI system is largely copied from a CR Magnetics application note. A capacitor is added to the amplifier stage to act as a low-pass filter, which adds some noise immunity. Rather than a second amplifier stage, the output from the first is simply fed into a comparator with a peak detector. That line is fed into an interrupt input pin of the ATMega chip that watches for a rising level. An interrupt service routine will quickly turn all of the relay output pins off.

There is a GFI test system, which simply consists of a current limiting resistor. A wire will go from that output and take 3 or 4 wraps around the GFI coil and then connect to ground. The code will pulse this line at approximately 60 Hz to simulate a ground fault. The expectation is that during this test the GFI will detect the pulses. The software will note a GFI failure if it doesn't.

The second sheet consists of the ammeter and the pilot generation and read-back circuitry. The pilot generator converts TTL output from the controller into +/- 12 volts. It does this using two pairs of transistors that make up a modified H bridge architecture. Two transistors are used to switch +12 or -12 volts onto the pilot output, and those two transistors are themselves switched on and off by transistors that are intended to translate the TTL levels into current flow to trigger the other two. Since the circuit is acting as an H bridge, it is critical to insure that the input is either TTL high or low and never a voltage that's in between. That could result in both output transistors being switched on, which would short +12 to -12 volts. R4 acts as a pull-up resistor to protect the pilot generator whenever the pilot output pin is in a high impedance state (which happens when the controller is being programmed or during and shortly after power-up reset).

The 1k resistor on the pilot output is required by spec to set the output impedance. The three resistors after that form a feedback network that scales the +/- 12 volt pilot to 0-5 volts to feed into one of the controller's A/D pins. The firmware will use this feedback to detect a missing pilot diode and the J1772 state requested by the attached car.

The ammeter is quite simple. It's a current transformer with a burden resistor and one leg offset to 2.5 volts. This is intended to keep the entire AC signal within the controller's input A/D range of 0-5 volts. Two zener diodes form a clamp to protect the controller from excursions beyond the acceptable range. The burden resistor must be carefully chosen. Too small and the ammeter's resolution will be poor. Too large and its range won't be high enough. The capacitor to ground on the anchored leg reduces noise in the readings.

The controller/display sheet includes the controller itself, which is clocked with a 16 MHz external crystal, the real-time clock chip and its backup battery, and the display. The display is the same design as the AdaFruit i2c RGB backlit LCD Arduino shield. JP3 is a bit tricky. It's not actually a separate connector, it's just the extra two pins for the RGB backlit LCD (the standard EAGLE part library only has a standard backlit LCD, which has only 16 pins).An i2c GPIO chip is used so that the I/O pins on the controller can be dedicated to EVSE functions rather than the display. The real-time clock chip also shares the i2c bus and has a CR1220 battery to keep the clock running during power outages or storage. The SPI bus pins of the controller are unused, and so can simply be connected directly to the AVR ISP connector for reprogramming. There are two solder jumpers present, One allows selection of the polarity of the backlight common pin for the LCD module. By default it's wired for common anode backlight LEDs, but changing the jumper (and the software) can allow use of a common cathode LED backlight instead. The other solder jumper connects the serial port's DTR pin through a capacitor to RESET. Closing that jumper will mean that transitions on the DTR pin will reset the controller. This is required if you want to upload new code over serial using an Arduino style bootloader, but is not recommended in any other context.

The FFC connector to the HV board has two otherwise unused pins (RELAY_B and AUX) that can be used for additional expansion functions in the future.

Saturday, January 3, 2015

OpenEVSE II design progress

The good news is that the design of the logic/display board has not really changed significantly since July. I have moved a couple of components around very slightly, but in general the separation of functions has really been quite a boon for the design.

When I last checked in, I had decided that the relay test functionality wasn't worth the trouble, so I converted it into a ground impedance test - which I knew was required by UL. I also replaced the original OpenEVSE L1/L2 test system (which also performed the ground test and the stuck relay test) with what I hope to be a reasonable isolated voltmeter.

Chris H corrected me, however. I thought a stuck relay test was unnecessary, but he said that UL actually requires one. So it's back in play.

What I've come up with is that the ground test circuitry is going to be replicated for a relay test line. The difference is that, while the ground test circuit has two diodes from each hot line and runs to ground, the relay test will simply run between the two hot lines on the load side, much like the voltmeter does on the line side of the relays/contactor.

OpenEVSE II relay board. This board works on both 120v and 208/240v, but is only rated for up to 24A charging.

OpenEVSE II contactor board. This board uses an external AC line powered contactor. The only limit on charge current is the contactor, but contactors generally only work at either L1 or L2 (not both).

Both variants have an isolated AC/DC power supply to produce 12 volts for the entire system. The relay variant has a 10 watt module and the contactor version has a 3 watt module. The difference is that the two relays draw 2 watts from the 12 VDC supply when energized, while the contactor is the equivalent of just an LED on the low voltage side.

Both the ground test and relay test hardware is nothing more than a comparator that feeds into a very basic peak-hold circuit so that the AC zero-crossing intervals don't count as "failures." The ground test is designed to insure that current will flow from at least one hot line to ground (for hot-neutral systems one of the hot lines will actually be a neutral line, so current flow will not be expected in that case). The test is a little trickier than it sounds. You can't naively put a pair of optoisolators in place - one for each hot line - from the hot line to ground, since a circuit path would exist from one hot line through its optoisolator to ground, and from there through the second optoisolator to the opposite hot line. That test would "pass" regardless of whether the ground impedance is high or low. You can, however, use a pair of (beefy) diodes so that, effectively, only one hot line at a time is presented with an opportunity to conduct through the optoisolator to ground.

The optoisolators are LTV-844S, which have AC emitters - each of the 4 independent optoisolators has a pair of diodes in inverted parallel (this is not shown in the schematic, which shows the unidirectional LTV-846S instead). Effectively, this means that the transistors see light proportional to the absolute value of the input voltage. The series resistors chosen are intended to try and keep the optoisolators in their linear range (if possible), and are also sized based on the power equation: P=E^2/R. Note that for the ground-fault system, the math is deceptive. The actual voltage is never more than 120 volts because the measurements are always relative to ground. In addition, each resistor only gets a 50% duty cycle, as the negative half of the cycle is blocked by the diode. For the 91k resistors, the worst case is 240 volts, which comes out to just under 2/3 watt. Lastly, all four resistors are flame-proof, so that they act like fuses and burn themselves out harmlessly if stressed.

The output side of each optoisolator is set up, more or less, with a classic voltage divider configuration. For the ground test and relay test systems, the result is simply compared to 1 volt by a comparator and peak-hold circuit. For the voltmeter, the result is fed into a non-inverting amplifier. As supplied, the amplifier is configured as a voltage-following buffer (unity gain), but gain can be added by altering the components without re-spinning the board.

The relay board has a simple common emitter switch with a flyback diode to switch the relay coils on and off. The contactor board has an optoisolated triac that's used to drive a (slightly) larger triac to switch the contactor on and off. Both the main triac and the driver triac are provisioned with snubber circuits which serve the same purpose as the flyback diode on the relay board: they provide a path for the coil collapse voltage to go when the contactor is switched off.