-   Open ReVolt: open source DC motor controller (
-   -   Inverter for single phase 230vac induction motor (A/C) (

jyanof 05-11-2013 10:08 PM

Inverter for single phase 230vac induction motor (A/C)
the purpose of this thread is to document the current state of an inverter i built and, to some extent, document my adventure with air conditioning which this inverter powers.

A quick history:
Once I realized that carrying around ice to try to keep cool in the hot AZ summers was pointless, I started to look into real air conditioning. my first attempt was inspired by a product I saw on ebay where a 5000 btu/hr compressor from a window unit was being sold. Turns out that unit was only 100 bucks at home depot, so I bought one, tore it apart, and built a small inverter to power it.

Here's some info on that at DIYecar:

Bottom line, 5000 btu/hr is not enough. 10,000+ would be required to get a more acceptable vent temperature.

Scroll compressors for hvac units in this size range all require 220vac and I didn't want to go through the process of adapting another hvac unit to the a/c system or build another inverter (which I ended up doing anyway). Also, it wouldn't be a guarantee to be enough thermal power and I could imagine problems getting the oils/refrigerants to play well together.

Then came the decision to go with the original a/c parts - compressor, condensor and all. I wanted to drive the compressor with an accessory motor for a couple of reasons - mostly, I didn't have room on the tail shaft to mount the compressor, but I also like the idea of remote starting the a/c.

I also wanted to stick with DC motors since building a DC motor controller is fairly straightforward. I found a 120v 20A 3HP motor treadmill motor and thought it was worth a try. I built a small DC controller - 20A is easy to manage - but the motor wasn't powerful enough to power the compressor. It was already maxed out at 20A and could barely keep the compressor turning when it was 80F outside. There's no way it could handle 115+ temperatures.

Here's a picture of the undersized motor before i got everything set up.

So, I looked for a bigger motor. Turns out the only DC motors larger than the one I had were for small EVs and were expensive, low voltage (required a high amperage controller like the open revolt), or really large and heavy. That's when I settled on a 5hp 220vac induction motor by WEG. It was inexpensive on ebay and could be tested by powering it with house voltage before building an inverter. Looks like there's a similar motor by Leeson on there too.

So, swapped it in, tightened up the belt, powered it up and the a/c worked! So, now that the mechanical aspect of the system was functional, I began work on an inverter to power the motor from the vehicle battery.

I tried to find some pictures of the new motor installation, but all i have are recent ones with some plastic guard to try to prevent hot air from the condensor going through the motor. So, these aren't the best.

jyanof 05-11-2013 10:25 PM

schematics and pictures
before we get too far, here are some pictures and schematics of the inverter.

The schematics and PCBs are in the ExpressPCB format. yeah, i don't really like the software and the boards aren't necessarily cheap, but the software is free and mostly easy to use and they're fast to manufacture and ship.

ok, so the file sizes for attachments are screwing things up. i'll figure out how to get those files somewhere soon.

here's the inverter being tested on a stove heating element and boiling some water.

this is the inverter installed in the vehicle without the cover

and this is with the cover installed

jyanof 05-12-2013 03:07 PM

Links to schematic
Alright, I posted the files on google drive. In the top left there's a down-arrow that can be clicked to download the file.

ExpressPCB schematic file

ExpressPCB PCB file

PDF of schematic

In the ExpressPCB schematic editor, you can get a BOM using the edit menu. All parts are from Mouser except the ones that begin with "ND"

jyanof 05-12-2013 03:33 PM

Power Section Components
Power Components:

The inverter is similar in concept to my previous inverter, but it has a boost stage on the front end to get the peak voltage output of the ac sine wave (~330V). The boost stage was actually built as two boost converters in parallel mostly because I already had one inductor wound that could handle 15 amps or so. Also, this stage would see higher currents (5HP is 25A from a 150VDC pack) and it worked out well with the chosen IGBT module.

The boost stage is followed by an H-bridge which is used to turn the high voltage DC into high voltage AC. Right now, the top IGBT on one side turns completely on while the lower IGBT on the other side PWMs one half of a sine wave. Then, the process is repeated with the other two IGBTs to get the other half of the sine wave.

In hindsight, I would've done this a little differently if I had to do it again. The more traditional way would be to use 'dead time' to alternately turn on and off the upper and lower IGBTs of each side of the bridge with each upper and lower IGBT never being on at the same time. Then, 50% duty cycle on each side of the bridge would be 0 voltage. A 40/60 ratio would be 20% voltage in one direction and a 60/40 ratio would be 20% voltage in the other direction. So, the duty cycle ratio just has to follow a sine wave and the output will follow suit. The advantage here is that switching losses get spread evenly among the four IGBTs at the expense of a little more complex circuitry and setup (mostly getting the dead time correct)

The IGBTs used are Microsemi H-bridge modules. There were two types available on Digikey - one optimized for low switching losses and higher switching frequency at the expense of higher conduction losses, and the other just the opposite - lower conduction losses but higher switching losses. Not sure the schematic reflects this, but the inverter ended up using one of each - the module optimized for lower switching losses for the boost converter (since the IGBT only conducts roughly half the time) and the other module for the h-bridge (since one of the top IGBT, in the current setup, conducts nearly all the time). Even though the module for the boost stage is designed as an h-bridge module, it works as a boost converter by using the middle rail as the input from the inductors and the V+ rail as the high voltage output. The upper IGBT gates are shorted so they never conduct. Both stages use a 15.6 khz switching frequency with 10 ohm gate resistors.

Each IGBT module has two film caps in parallel directly on top to serve as a low inductance path to absorb voltage spikes at turn off. The spikes on Vce were measured to be about 40V or so, putting the peak voltage more than 200V from the 600V rating.

In between the two stages is a large 2200 uF 450V electrolytic cap to serve as a buffer between the two stages. Despite this, I still measure a current from the batteries that oscillates with each AC half cycle, but that's no big deal.

Here's a closeup from the side of one of hte IGBT modules and the large cap:

The boost inductors are sendust cores (two stacked for each one) bought from cwsbytemark each hand wound with two strands of 18ga magnet wire. Talk about time consuming! There's some literature on there about estimating the inductance based on the chosen core, number of turns, and operating current. While these inductors may be about 1mH with no current, they're probably closer to 500 uH at operating current. so far, with 11A average for each inductor (22A total), they only get about 10C above ambient.

Here's a closeup of one of the cores. Ignore some of the wiring since this pic was taken during some early low voltage testing.

The IGBT drivers are avagado 2.5A combined opto-isolator/drivers. With 10 ohm gate resistors, these drivers were satisfactory and could handle the 24V output from the DCDC's and send +15V and -9V to the IGBT gates.

The DCDC's are powerex 15V input, +15V, -9V output. They work down to 12V input and since my vehicle's DCDC outputs 14.2V, I just feed that directly to the input of the DCDCs.

jyanof 05-12-2013 03:36 PM

Sensors and other Inputs/Outputs
Sensors for control feedback:

Boost current and h-bridge output current are measured with two hall effect sensors. Initially, only one current sensor was provisioned for, but another was added after a failure. Once in operation, the inverter operates within limits. However, during motor spool up and closing the compressor clutch, large transient currents can occur. The current sensors provide feedback to the controlling micro which can reduce output power or shutdown to save itself.

Boost-stage output voltage is measured with an isolated linear opamp. Designed for use with current shunts, this opamp also works with a very high ratio voltage divider on the input. Feed it 0-250mv on one side and get an isolated 2.5-5V signal on the other side. One potential issue is that this creates a little less than 2 ADC bits of resolution per volt, but the output voltage does not need to be tightly regulated - a little error in accuracy is ok.

Each IGBT module also has an internal thermistor to measure internal temperature. Initially, both module temperatures were planned to be measured, but I ended up using one of them as the input from the extra current sensor. Now, only the bridge temperature is monitored.

Other inputs/outputs

The control board has an opto isolated input signal to turn on or off the inverter. Additionally, there is an analog input from a thermistor in the a/c duct that could be used to cycle the clutch at low fan settings (though I haven't set this up yet) and there are two relay drivers - one is used for the condensor fans and clutch and the other is for the internal precharge circuit.

jyanof 05-12-2013 03:43 PM

Basic circuit operation / PCB comments
The micro has three main outputs - a PWM signal for the lower side of the bridge and a 'selector' to select which pair of IGBTs are in operation. The selector output goes through a series of NAND gates which passes the PWM signal to the correct lower IGBT while turning on the correct upper IGBT. The third output is a PWM signal to the boost stage. There's a hardware shutdown for overvoltage that will stop the boost PWM signal if it goes really high (400V or so).

The overall PCB layout is pretty poor and I would completely redo it if I have another opportunity. First, I forgot to put pull down resistors on the micro's PWM outputs. Unfortunately, it took me a pair of blown IGBT modules to figure that out. There's a couple other minor things like an LED status indicator would be nice and adding the pads for the 2nd current sensor.

The big issues involve separating the analog and digital circuits. Unfortunately, the voltage sensor output trace runs directly over the boost opto-LED PWM drive traces which results in little spikes every time the LED turns on or off. This isn't a big deal as far as voltage regulation goes, but the little spikes cause the hardware protection to trip at a lower output voltage. This is compounded by the fact that the desired output voltage produces a sensor output that is near the 5V rail so the reference voltage couldn't be adjusted high enough to avoid false trips. Adding RC filters helped reduce the spikes and hacking the reference voltage pot to use the 12V supply instead of the 5V supply solved this.

Here's a screenshot of the PCB. The top part is one of the power boards and the lower part is the control board.

jyanof 05-12-2013 03:52 PM

Some other challenges:
Some other challenges:

I blew up an IGBT module by slamming the motor with full output - it requires a soft start to spool up the motor slowly and keep the current low. So, the program now starts at a low frequency and spools up voltage and frequency slowly. The output current is constantly monitored and the voltage & frequency is reduced if the current goes too high.

Another issue with starting is dealing with the start capacitor. Initially, I would try to spool up the motor without any boost, so just 150V. However, as the motor spooled up and voltage was increased, the current rose really fast and caused the control loop to fight itself. The motor would never reach full speed and would eventually trip some other fault and shut down. This was solved by limiting the output voltage to 75V peak using PWM while spooling up to 60hz. Once 60hz is reached, the voltage is increased to the full desired output voltage.

This actually lead to another problem - something odd happens when the motor runs unloaded and the voltage is boosted beyond 310V. I think the motor begins to saturate which causes some weird current behavior and trips some fault and the motor stops. What's more weird is that it appears to lock up the micro. I'm not positive on that yet, but any fault should open the power relay which doesn't happen during this event. I also haven't let this happen since i've coded the diagnostic LED feedback which indicates which fault has tripped.

This also highlighted the need to spool the motor down slowly on shutdown. Another downside to the circuit is that all of the IGBTs cannot be shut off at once. Thus, when all the PWM output is stopped, one upper leg is still ON which allows current to flow in the motor and it screeches to a stop instantly. This doesn't seem good as there are likely high currents occuring. Fortunately, the modules survived this.

jyanof 05-12-2013 04:02 PM

basics of the code
1 Attachment(s)

The software is mostly interrupt based with a few fault checks occuring during the main loop.

The first part of the main routine begins with the array for storing the sine wave values. There were a few values that are really close to full on (100% duty cycle) so those values are replaced with 511 for full on.

The 'waitforprecharge' subroutine will wait for the voltage in the large cap to first rise to about 135V, then it waits until the change in ADC reading as a sample is read every second changes by less than 3.

The repeating part of the main routine first has some LED toggle code (I added an LED to one of the ISP pins) and then some code to start the motor when the user flips the switch. The start sequence initializes the frequency and voltage outputs, then waits for the boost voltage to nearly reach the boost voltage setting (while checking to make sure the battery didn't get disconnected or that the control switch went off, then turns on the clutch. lastly, there's a few fault checks.

The timer1 overflow interrupt handles all of the timing based stuff, mainly updating the output PWM to mimic a sine wave and selecting, reading, and processing ADC conversions.

The variable 'currentscalar' will change the frequency and magnitude of the output voltage (as a V/F relationship) depending on its value. the frequency is affected by modifying how the PWM array index is updated and the magnitude is affected by a simple scalar when calculating the actual OCR1B value.

The complete start sequence starts with a currentscalar of 24 (24 over 128, really). There is also a 'start' variable that forces the output ratio to start at 50% output (32 over 64). Also, the boost converter stays off at first, so the input voltage to the h-bridge is the pack voltage, about 150V. once the output has reached full frequency (currentscalar of 128), the start variable is incremented until the full output voltage is applied. Finally, once the start variable has finished incrementing, the boost voltage is set to the high voltage, about 315V.

To stop the motor, the clutch is commanded open at the same time the boost converter is turned off. Since the clutch doesn't open right away, this has the effect of draining the large cap for a few cycles. This is beneficial since the act of unloading the motor and slowing the motor down will actually charge the cap back up, so stopping the boost converter early will prevent the cap from over-volting.

This interrupt also handles the ADC conversions. With the way the clocks and timers are set up, an ADC conversion takes longer than one PWM cycle. Thus, ADC conversions are started every other time the interrupt occurs. The ADC channels cycle through the 2 current sensors and the boost output voltage. Twice a second, instead of the boost current, either the vent temp sensor or IGBT temp is measured.

the code is attached - change the file extension to .c instead of .zip

jyanof 05-12-2013 04:39 PM

Early video
Here's an early video of the motor spooling up and down.

MPaulHolmes 05-15-2013 02:10 PM

This is all just too awesome!!! Thank you for documenting the process. I'm going to read it all in detail. My solar panels are arriving tomorrow, and it's going to be fun getting them useful as fast as possible.

All times are GMT -4. The time now is 11:28 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Content Relevant URLs by vBSEO 3.5.2
All content copyright