Reviving a Failed Inverter

AIMS 180W InverterIn my last post I discussed the building of a solar-powered “reverse UPS” called the Doom Box (a name given for, really, no good reason). To briefly recap, its purpose was to capture, store, and convert solar energy into AC power. This AC output was provided by either a direct connection to the mains or, when solar power was available, an AIMS 180W pure sine wave inverter (specifically model number PWRI18012S, shown in the image at right).

Well after about six months of daily operation (with an average power output of 35W), my inverter bit the dust. To be precise, its 12VDC input suddenly turned into a dead short. Now, if you short out a big lead-acid battery, bad things can happen (burning insulation, melted wires, explosions). This is why I always (mostly) put fuses in series with my batteries. So because of these fuses, when this inverter failed, it wasn’t all that exciting. All I heard was a small pop from the fuse and that was it. Thinking that this was just a temporary problem, I replaced the fuse, removed the AC load, re-enabled the inverter, and pop – another fuse blown.

As a first test, I got my multimeter into the system and checked that the inverter’s input was in fact internally shorted. The next step was to remove it from the system. If you’ve seen the pictures from my last post, you’ll know this was no easy task. However, after disentangling it from the rest of the components, I popped it open and had a look:

AIMS 180W InverterAIMS 180W InverterYes, that assembly really is as sloppy as it looks. It appears that components were just shoved in at random. Seriously, it’s amazing that this thing ever worked. The two TO-220 package ICs (which are linear regulators) in the middle of the device are actually insulated from the toroidal inductor by a thin piece of paper. So much for build quality.

Well enough ranting – the question was, can this be fixed? I’d already likely voided my warranty by cutting off the cigarette-lighter plug, so returning the unit would be difficult. I started to poke around looking for anything that had obviously failed (e.g. burst capacitors – these are fairly common culprits). It turns out both of the input MOSFETs had shorted out. I’m not sure what caused this, but I suspect they were fairly low-quality components to begin with, and repeated thermal cycling led to failure.

AIMS 180W Inverter - Replaced MOSFETsSo to make a long story short, I replaced the failed MOSFETs (indicated by the red arrow in the image above) with similar, but higher-rated devices from Fairchild Semiconductor (FDP8860). By higher-rated I mean that these new transistors were rated for greater currents (80A) and had lower on-resistance (less than 3 mΩ). As a result the new MOSFETs should actually be more efficient and thus run cooler. So my messy little AIMS inverter is now up and running once more.

The Long Story: How to Identify Failed MOSFETS

You might be wondering, just how did I know which transistors had failed? Well many times, when a transistor fails and shorts out, it rapidly becomes very hot – so hot that its case can actually melt, crack, burst, glow red, or all of the above, as seen here:

Failed IC

(Note that the IC in the 14-DIP package shown above is not a MOSFET, but a dual MOSFET gate driver – I may discuss its failure in a future post.) Now, sometimes the damage to a failed device is much less obvious. I’ve seen a number of failed MOSFETs that appear to have one or two small droplets of water on their surface after failure. It’s not actually water, but some melted component of the package.

However, if you’re taking appropriate precautions and fusing your power source, it’s likely that your failed device will shown no physical signs of failure whatsoever. This is because after the device shorts, the fuse immediately blows and prevents catastrophic heating. This was the case with my inverter: the MOSFETs I replaced did not appear damaged in any way. So how did I find them, out of the multitude of devices crammed into that tiny case? Simple, actually – I measured the drain-source resistance on each device:

MOSFET SymbolBefore I continue, a little background is in order. A MOSFET (Metal Oxide Semiconductor Field Effect Transistor) works because voltage applied between the gate and source (Vgs) creates a small electric field inside the device. This electric field causes charge carriers to be pulled into the region between the drain and source. As a result, the resistance between drain and source drops as Vgs increases. So, if there is no voltage applied between the gate and source, and if the gate has been discharged (this happens over time, but can be accelerated by a short to the source), the resistance between drain and source should be infinite (or at least in the megaohm range).

So one way to verify that a MOSFET is working properly is to touch the positive probe of your multimeter to the drain pin (typically the middle pin on a TO-220 package) and the negative lead to the source pin (typically the rightmost pin). The meter should register at least several tens of kΩ, if not MΩ. If you’re getting a low resistance, try shorting the gate and source pins to remove and residual gate charge. If the resistance is still low (typically less than 100 ohms), the MOSFET is likely dead shorted. Of course, if the MOSFET is still in a circuit, your meter may be measuring the resistance of some other component. One thing you might try with the TO-220 package (pictured above) is to clip only the source lead before you test the device. Then you should be able to safely test the device. If it seems to be working, just dab a bit of solder over the cut lead.

One last thing you may wish to verify is the internal body diode (seen in the schematic symbol above) between the source and drain. Many multimeters have settings to measure the voltage drop across diodes. However, if your meter does not have this function, a simple resistance check will do. Our earlier test of resistance between the drain and source should have indicated very high resistance. However, if you reverse the polarity of your meter’s leads (positive → source and negative → drain), you should now read a very low resistance due to the body diode (if all is well).

Well, that’s my preferred technique for testing MOSFETs – if you have further suggestions or tips please feel free to comment! Thanks!

ΩΩ

The Doom Box: Part I

I’ve long had a fascination for renewable energy – be it from wind, solar, or hydro-electric sources. Perhaps it’s just my penchant for penny-pinching, but the idea of free and (virtually) unlimited energy is something I find quite appealing. So, in February of 2009 (wow, has it been that long?) I bought my first SUN 90W, 18VDC photovoltaic (PV) panel:

Solar Panel (with voltmeter)

(As a side note, if that looks like a stock image, that’s because it is. However, it really is a picture of my very own panel and voltmeter. Stock photography is another hobby of mine which I may post on later.)

So, what did I have in mind for this 90W powerhouse? A reverse-UPS of course! What is a UPS, you ask? Well first off, UPS stands for uninterruptible power supply. You typically find these connected to computers, particularly server computers. Their purpose is to continue supplying power in the event of an outage. Essentially they’re fancy battery backup systems that can be switched on almost instantly in the event of a main power failure. Actually, some UPS systems run their inverters continuously and only rely on the mains input to keep their internal batteries charged.

Now most uninterruptible power supplies power their loads via a connection to the mains (120VAC) until an outage occurs. At this point the load is switched over to battery power. My plan for a reverse-UPS was just the opposite. I intended to power loads via solar and battery power until the battery reached a certain level of discharge (~70% of full charge so as to extend the life of my battery), then automatically switch over to mains power.

To accomplish this, I first bought a 63Ah deep-cycle lead acid battery and a SunSaver 15A MPPT charge controller from the Alternative Energy Store. While the MPPT feature on the charge controller did cost me a bit more, I think it’s a big plus, particularly for cloudy winter weather. So far I’ve been very impressed with the SunSaver’s performance:

SunSaver 15A MPPTThe next step was to obtain an AC inverter. I considered making one myself (as well as the charge controller), but opted to go COTS for convenience and safety. I may have it backwards, but I generally feel more comfortable using professionally-made devices when it comes to dealing with high voltage and current. (But of course I also fused just about every wire in the system – a very good choice, as you’ll see later.) I also wanted a pure sine-wave inverter for efficiency and smooth SSR switching (discussed later).

So with my battery-backed solar-powered AC source, all I needed was a means of switching between that and line AC. Paralell solid-state relays (SSRs) seemed to be the best solution because of their speed and easy of use. All I needed was an accurate and reliable way of controlling them. For that, I chose a simple 8-bit AVR microcontroller, the ATMega48. This is a great little MCU that can handle plenty of digital I/O and up to eight analog inputs. One of those inputs was wired up to monitor the battery. Several digital inputs went to switches and buttons, and two digital outputs went to the SSRs.

Switching from line AC to inverter AC was actually quite simple. Once you remove the digital “ON” signal from the SSR, it takes at most half an AC cycle to turn off (this is because its current must reach zero before turn-off occurs; see TRIAC). So, for a 60Hz AC source (standard here in the US), that means 8.3ms. To be safe, I went ahead and doubled that figure. So, to switch between relays, the MCU only needs to turn one off, wait about 16ms, then turn another on. Of course, the consequences of getting that timing wrong could be painful, so I was sure to thoroughly stress-test my code and electronics before running a powered test. So far, no fuses have been blown by crossed sources.

Here are a few images of the original completed system (before any revisions):

Doom Box (1)

Doom Box (2)

Yes, it’s made of wood. Pine, if I recall correctly. And yes, wood is flammable. I don’t plan on taking advantage of that fact. The cooling fan is there to keep everything well below flash point. It’s also intended to vent any hydrogen gas that may be given off by the lead-acid battery. Wood does have one plus though: it’s non-conductive.

Below is a close-up of the front panel, where all the user interaction happens. The large switch on the top left connects the solar panel to the charger. The bottom left connects the battery to the rest of the system (inverter, microcontroller, etc.). The left black button allows the user to force the battery to operate even if it’s below 70% of full charge. The right button allows the user to manually command line AC output if desired.

Doom Box (3)

Here are a couple shots with the lid removed. The system measures about 16″ x 12″ x 14″ and, with battery in place, weighs about 40lbs. I don’t remember exactly why we started calling it the “Doom Box” – perhaps it just sounded amusing. I suppose it is a potentially dangerous box to go sticking your hands in…

Doom Box (4)

Doom Box (5)I’m happy to report that the doom box worked quite well for a number of months. I strapped my 90W solar panel to a lawn chair, weighed that down with a cheap sack of marble chips, and put the whole thing out on my east-facing balcony. The AC output was connected up to an old laptop I run as a server. It draws about 35W continuously. So whenever the sun was out and the battery fresh, the laptop was powered entirely by the doom box. Once the sun moved out of view and the battery discharged to 70%, the box automatically switched the laptop over to line AC.

Unfortunately, given its location, the solar panel only saw direct sunlight for a few hours each morning, but that’s the best I could do at the time. As such the laptop was only off the grid for about 6-8 hours each day. I was also quite surprised at the difference in performance between direct sunlight and cloudy days. Very cloudy days cut down my power input by about 80-90%.

Well since this initial build I’ve modified the MCU to support a greater level of monitoring. Current sensors are now in place and the entire system is programmed to log and report its status via website. I’ve also added a second solar panel and battery. But that’s another post for another time. Stick around for dramatic stories of inverter failure!

Part II of this article may be found here!

Measuring Projectile Velocity

(Updated 9/6/2010 – scroll down for final results)

I’ve got a couple friends who enjoy building spud guns and other sorts of “just for fun” air rifles. They’re pretty nifty to shoot, especially since ammo is flexible. Even a wad of paper towels wrapped in tape will do the trick. All you need is something that forms a relatively good seal with the inside of the barrel.

So being the EE that I am, this got me to thinking: wouldn’t this be even more fun if we could measure muzzle velocity? It shouldn’t be all that hard; we could just hook up a couple LEDs and photo-detectors, fire through the beams, time it with a microcontroller, and voilà! So, that’s precisely what I did, except that I decided to go with a couple cheap laser diodes instead of LEDs. Here’s the end-product in all its wooden glory:

The Box

Top View

In the first image you can see one of the two laser diodes poking through the right side of the wooden enclosure (and held precisely in place by hot glue). The two lasers are aimed at PIN-type photodiodes which are mounted on the other side of the box, spaced 2″ apart, and covered with IR-blocking film (to prevent difficulties with ambient light):

Photodiodes Plus IR-Blocking Film

The two photodiodes are wired in reverse-bias as shown in the following schematic:

Sensor Schematic

Now if you’re unfamiliar with photodiodes, you can essentially think of them as light-dependent resistors. (Although to be precise, they should really be modeled using a light-dependent current source as discussed here.) In total darkness, they’ll exhibit very high resistance when reverse-biased. However, expose them to light, particularly infrared light (at least in this case), and their resistance drops substantially. Thus, whenever the laser beam is striking a photodiode, its resistance is quite low. When this happens to D1 in the schematic above, the voltage at point A rises closer to the 5V supply. However, if the beam is broken, the photodiode’s resistance rises, causing the voltage at point A to drop towards 0V (GND).

We can use this change in voltage to determine when the laser is being blocked by a projectile. This is done using a high-speed operational amplifier (op-amp) wired as a comparator. The potentiometer (POT) shown in the schematic above is tuned so that its output voltage is just between the “blocked” and “unblocked” voltages of the photodiodes. The outputs from the op-amp then saturate at 5V whenever the lasers are unblocked. However, if the lasers are blocked, the op-amps will output approximately 0V. This change from 5V to 0V then represents the entry of a projectile and is detected by an AVR microcontroller, the ATMega128. It’s part of a development board I’ve had for several years now, the Olimex AVR-MT-128 (details here). The development board really isn’t important at all – it simply provides screw terminals for easy connection to the AVR’s I/O.

So once the microcontroller powers up and initializes its LCD display, it sits and waits for its two inputs to change state. If the leading photodiode goes low (0V), an interrupt is triggered that starts an internal counter. The counter runs until the trailing photodiode goes low, at which point the counter is stopped, the projectile’s velocity is calculated based on the known separation between photodiodes, and the LCD display is updated like so:

Display Closeup

The “mode” you see displayed above indicates the speed of the MCU’s internal 16-bit counter. If a slow-moving projectile (less than ~150ft/s) is expected, you can use the pushbuttons to specify slow mode, which causes the internal timer to count at a much lower frequency. This allows slow-moving projectiles to be measured without counter overflow. However, if you’re firing high-speed projectiles, you’ll want to use fast mode. This will kick up the counter’s frequency to 16Mhz to provide better speed resolution.

My initial testing was performed by shooting rubber-bands through the lasers. It turns out they fly at between 40 and 80 ft/s depending on how much you initially stretch them. I also tested out the timing accuracy of the system by using an arbitrary waveform generator in place of the photodiodes. Results looked very good: fast mode accuracy should be less than 0.1% at speeds of about 1000 ft/s. Max speed is limited to 10,000ft/s.

Code for the ATMega128 can be downloaded here: fps_meter_code.zip.

Finally, the following is a fairly complete bill of materials in case you want to try this out:

  • PIN photodiodes: BPW34
  • Operational Amplifier: EL5444
  • 5V switching regulator (to power development board): V7805-500
  • Linear 3.3V regulator (to power lasers): UA78M33C
  • 1k resistors (in series with photodiodes)
  • 10k potentiometer (to set the photodiode “trigger” threshold)
  • Laser diode modules (pulled from two cheap laser pointers)
  • AVR development board: AVR-MT-128 (but really, a single ATMega will do)
  • IR-blocking film: Wowfil samples
  • Some scrap wood and screws

Update (8/29/2010): I have now tested the meter successfully with two different air rifles – a .20 and a .22 caliber pellet gun. The .22 was tested first and proved rather anemic. Initially it couldn’t even break through the cardboard box we were using to catch the pellets. With a few extra pumps its rounds reached 140ft/s, but that’s still rather slow. The rifle seems to have difficulty holding pressure. We had better luck with the 0.20 cal – its pellets reached a top speed of 590ft/s – this was enough to penetrate two layers of cardboard and nearly the full thickness of a piece of 1×6 pine wood. I should also note that using such small rounds made it slightly difficult to trip the laser sensors. However, once we had the rifle lined up properly and leveled, everything worked great!

Update the Second (9/6/2010): This afternoon I took the meter out to my uncles’ shooting range for a bit of live-fire testing. The first thing I learned is that the device I’ve made is called a chronograph and that apparently you can buy these for not much money. No doubt the store-bought varieties provide many additional features and are easier to use; but where’s the fun in that?

Well, we started out “testing” with a .45 ACP using standard Remington FMJ rounds (230 Grain). The chronograph was setup about eight feet in front of the table from which we were firing. I had considered firing at point-blank range, and while this would have been much easier, the smoke and flames from the barrel may have presented a problem for my electronics (i.e. inaccuracies, melted plastic, etc). Of course, the long-distance alternative could have led to my blasting my poor development board into oblivion. Thankfully, I’m a better shot than that; although just barely. To perform the test, I pinned a little black target to the back of the device, then aimed for the center of the dot. After a few tries, the round passed through both beams and registered about 850 ft/s – pretty much what you would expect for this type of ammunition (see this Wikipedia entry on the .45 ACP).

Range Test: .45 ACP SetupNext up, we tried out some Magtech Auto+P rounds – 185 Grain, JHP. As promised, these provided substantially more power. You could certainly hear and feel the difference. That is, when they would fire – a number of them were just a bit too long to fit completely in the chamber. I’m not sure whether this was a defect or if they were just too big for this particular gun. But anyway, a couple different shots both registered about 1150 ft/s:

Range Test: .45 ACP ReadoutSo after all of this testing, I’m thinking about making a couple of changes to the system. For one thing, having to adjust the threshold potentiometer for changing lighting conditions is a little frustrating. The IR-blocking film just isn’t quite cutting it, although I’m sure it helps. But I’d like to try using the AVR to dynamically generate one or two analog outputs for use as thresholds. I’ve actually done something very similar in the past with the same photodiodes. I simply programmed the AVR to ramp up its output voltage until the comparator switched state. Then it automatically reduced the output voltage a little to give some room for noise. This varying analog output, by the way, was created by adjusting the duty cycle of a low-pass filtered PWM output. Setting the filter’s cutoff frequency to less than 1/100th of the PWM frequency nicely converts a square wave into a DC value (and the lower the cutoff frequency, the smoother your final output will be).

To compensate for changing lighting conditions, I might also try connecting the two photodiodes directly to the analog inputs of the ATMega128. I’d still use the external comparator for timing measurements, but this would allow me to directly determine the best analog threshold to be generated by the AVR without the need for scanning. I could also add transistors to the lasers so that the AVR could turn them off briefly for calibration. I might also just high-pass filter the photodiode output to completely eliminate any shifting DC offset. I’ve tried this before on a similar project with good success.

The other thing I’d like to do is make the sensing area a little wider. It’s pretty tough to reliably hit two 1/8″ laser beams. Perhaps a couple of line lasers and photodiode arrays would do the trick. Or maybe there’s a better non-optical sensing option out there I haven’t heard of yet…?

DreamSpark Plug

Microsoft DreamSparkWhat do you think about when you think of Microsoft? An evil corporate giant? Frustrating software? Viruses and worms? Or perhaps you’re actually a fan of M$?

Well regardless of your opinion, if you’re a student in high school or college, Microsoft wants to give you some of their software – free. Indeed, full versions of Windows Server 2008 R2, Visual Studio 2010 Professional, and more, are free to download with no strings attached. The program is called DreamSpark, and was announced over two years ago by Bill Gates himself during a speech at Stanford University. Somehow I didn’t catch word of this until just a few months ago when I started to look into building a new server.

So why am I mentioning this? Well, to be honest, I am a bit of a Microsoft fan. I’ve been using their operating systems and software ever since the arrival of the 486. But I’ve also now taken advantage of the DreamSpark program to download and install Windows Server 2008 R2 Standard (an OS that would normally set you back more than $500). In fact, it’s now hosting this blog (and playing a few other roles as well).

In the future I’ll probably comment on my experience with Windows Server, but for now I’ll just say the setup was pretty painless. I’ve toyed with Linux servers in the past, and configuring 2008 was, by comparison, approximately one million times easier. So, thank you Microsoft! (And please, Linux users, be nice to my new server. K? Thx!)

Fun with FLIR

A little while back I posted about testing a Nichrome heater using a FLIR thermal camera. While I had the opportunity, I snapped a couple other pictures. First off, my laptop, a Lenovo Thinkpad T61p. As you may have guessed, the top image of the following composite was taken with the FLIR camera. The orange areas indicate high temperatures while the blue areas indicate lower temperatures.

Lenovo T61p Thermal Image

While it may look like flames are shooting out the left side of the laptop, that’s actually just the desk being heated by the CPU fan. And I’m sure you can guess where the processor is located – just under the caps lock. On the lower right part of the hand rest, you can also see the outline of my three fingers in blue. But those aren’t my fingers – what you’re seeing is merely a thermal “shadow” left by a brief touch that slightly cooled the plastic.

You’ll also notice that the screen is warmest right along the bottom edge. I’m guessing that’s where the back-light is located. And in case you’re wondering, the highest temperature in this image is approximately 95F.

Soldering Iron Thermal Image

This second and final image is, you guessed it, a soldering iron. And as you can see, the hottest part of this particular iron (indicated by white) isn’t the tip, but just above the tip. I also noticed that the iron’s temperature controller wasn’t all that accurate. The hottest point in this image is just over 600C, while the iron’s controller claimed 800C. Perhaps I hadn’t given it time to ready a steady-state temperature distribution?