Inverters and Isolation

Take a look at the picture blow, of a 400 watt inverter I garbage picked a while ago:

Common mode voltage on the inverter output.

The inverter is running off a 12 volt battery, and is switched on.  Notice anything interesting, particularly with how the meter is connected and what it’s reading?  (You may have to click to embiggen, so you can see the display.)

The meter is connected between the negative (black) battery post, and one of the legs of the 120 volt output, and is reading about 67 volts AC.  This works between that post and either leg of the output, as well.  Going between the two legs gives 117 volts, which is the output we want.

So what’s going on here?  The problem has to do with grounding and isolation.  Inside the inverter, there’s a circuit that looks something like this:

Simple H-bridge inverterThat’s an H-bridge, a switching arrangement that lets you supply a load (on what I have labeled here as the AC out wires) with either normal or reversed polarity, or none at all.  This is very simplified; you’d want to drive the switches (MOSFETs in this case, could be something else like an IGBT) with some sort of switching scheme of some sort.  However, this is the basic mechanism by which the inverter makes alternating current.  (There are other ways to do this, including one with just two switches, but this is the basic idea.)

Notice the ground symbol on the low-side of the H-bridge?  That’s our problem – imagine that the MOSFET just above it (the lower left-hand one) is on, as is the one diagonal from it in the upper-right.  The other two are off.  If we measured between the AC out leg from the left-hand side of the bridge to the ground node, we’d see 0 volts, because it’s the same node – the transistor shorted that leg to ground.  But, milliseconds later (about 8.3 if we’re at the beginning of the cycle) the transistors switch – now, that same leg of the AC out is at the voltage of the DC source (could be battery voltage, or could be from a DC-DC converter), and that’s what we’d read on the meter.  It would be in this state half the time, and with the meter set to AC voltage we’d read something like the 67 volts in the first picture.  The AC output is floating with respect to the ground point.

The problem, then, is if at any point in your AC wiring the ‘neutral’ conductor is tied to ground, and that ground is also tied to Battery-, you have a short-circuit path!  This depends on the design of the inverter as far as whether or not it’s a pure short circuit (the DC source would have some impedance to it, so it might not necessarily be like a dead short on the battery), but it could still damage your inverter.  Not to mention that having a voltage between Battery- and the AC neutral or ground would be a safety hazard.

So, how much of a problem is this, really?  Well, in the picture the inverter is running a laptop charger, which is encased in plastic and I think actually provides isolation between its input and the laptop.   So, here I’m not worried about it.  However, say you wanted to provide some backup power to your house in a power failure.  It’s not uncommon for people with a generator to backfeed their circuit breaker panel (either with into a normal outlet with an aptly-named suicide cable or with a proper receptacle and transfer switch).  So what if we did this with this inverter instead?

In the US homes typically have the neutral and ground bonded together in the circuit breaker panel.  Now, say you have a little system with some solar panels and a big battery to run the inverter, and you happen to have the negative side of the battery grounded on a watter pipe in your basement, or maybe even the ground wire in your house wiring…  Even if you drive in a separate ground rod for the DC side, you’ll wind up with a current path, and a potential safety issue.

Now, a 400 watt inverter is a little small for backing up your whole house, but there are larger, cheapy inverters like this one that probably have a similar design.  If you find a 2000-3000 watt inverter at your local hardware store for a few hundred dollars, this is probably the case.

So, how can this be fixed?  Take a look at this update to the schematic from above:

Inverter with a transformerNotice that there’s a transformer on the output of the bridge – now the AC output is isolated from the DC side!  So you can use the same ground on the DC and AC sides.  There isn’t an electrical connection, there’s a magnetic one, so we just transfer the energy across.  There is a small section where the AC is floating, but it can be safely enclosed in the inverter chassis, and insulated appropriately.  Of course, there are other solutions; the DC source could be fully isolated itself, and the low-side of the H-bridge could remain ungrounded.  This way you could still reference the output to the inverter’s DC input safely.

You could also get an isolation transformer and put it between the inverter and your loads.  This would solve the problem, but would give you a little drop in efficiency – it’s not the same as if the transformer is designed into the inverter.  Also, the cheap inverters that don’t isolate input from output tend to be modified sine wave (really modified square wave), and so could cause an off-the-shelf isolation transformer to run with even less efficiency.  (A true sine wave inverter could also have this problem; the difference is in how the switching is done.  But, a lot of high-end sine wave inverters tend to take the isolation problem into account, it seems.)

On another note, those working with renewable energy will tell you that building a solar power system just for the off chance your grid power is out for a few hours a few times a year isn’t very economical.  This is true, but I imagine that there are people out there who will think of attaching a big, cheap inverter to their home’s wiring, which is why I threw this together.  The moral of the story is, if you’re going to distribute the AC from your inverter in a more complex fashion than an extension cord and power strip, check for voltage between each AC leg and the negative DC input.  If you’re looking at buying an inverter, see if you can go to the store and try this with a multimeter.  Or, call the manufacturer, and see what they say about hardwiring it.  If it’s designed to be wired into an electrical system, there’s a good chance they’ve thought of this problem.

Power Inverter

I have a terrible habit of thinking of projects that would be neat, starting to work on them, then forgetting about them or otherwise leaving them until some point in the future at which I remember them, and then the cycle repeats.  Well, I’ve been mulling one particular project over in my head for a couple years, and now I’m going to declare my intention to start it and hopefully share it with the world: I am planning to build a power inverter.

Now, the truth is I have started on this project a little bit, mostly by sketches on paper and in LTspice, an excellent,  free (but not open source) circuit simulator.  For those unaware (and who didn’t feel like reading the Wikipedia entry), a power inverter (I’ll probably just refer to it as an ‘inverter’) is a device that converts direct current (DC) to alternating current (AC).  There are a number of applications for this…

  • Running household appliances in your car (shave while you drive!)
  • Backing up servers, medical equipment, or whatever else you want to keep running when the power goes out (UPS)
  • Running normal household appliances on a small renewable energy system
  • Connecting your small renewable energy system to the grid

And so on.  Inverters range from small ones you get at a hardware store, to big ones that can run small villages.  I’m not trying to run a village with this project, nor am I trying to power a significant portion of my apartment.  I would, however, like a small, high-quality inverter, and to really learn how it works.  And, I would like to publish instructions for this online, so that hopefully they will be useful to other people and the design can possibly evolve.

Here are my objectives for this project:

  • Output of 120 VAC, 60 Hz (nominal), 300 watts
  • Input of 12 VDC (nominal)
  • Sine wave output
  • Bidirectional: can also function as a battery charger with a transfer relay, similar to an uninterruptible power supply (UPS)

Now, this isn’t really anything novel.  As I mentioned, there are smaller inverters around, and you might be wondering why this would be worthwhile compared to say buying a small inverter at the hardware store for less than $100.  Well, as I mentioned, I’d like to learn, but that’s not all.  Note the ‘Sine wave output’ requirement.  Most of those cheap inverters won’t have this and will thus produce dirtier power.  Also, I haven’t really found a smaller unit that can act as an inverter/charger, which is something that would come in handy for me – while I do have a largish battery with some solar, it would be nice to be able to charge from the grid with this unit and essentially have a UPS.  Of course, I could get a UPS too, but they’re not really designed for continuous usage, they tend to have dirty outputs, and are designed for charging smaller batteries (usually big enough to allow you to shutdown your equipment, or start up generators or whatever).  Also, for safety reasons, I will NOT being setting this up as a grid tie inverter, meaning it won’t sell power back to the power company.

Now, I would also like to point out that I am not sure how well the design I’m considering will scale.  By this, I mean that were I to build a bigger unit (>1kw), I might approach it differently – this is kind of an experiment.  So, if you’re thinking of building something that you can use to power a chunk of your house when the power’s out in the next hurricane, I’d advise pursuing other options at this point.  (Hey, hopefully this can evolve…)  There are actually several commercial manufacturers that make products (inverter/chargers) that are similar to what I’m building, but work at higher power levels.  I have not used any of those companies’ products, but they do have decent reputations.  Also, if your power doesn’t go out very often, and you just want some quick, cheap backup, a normal gas-powered generator isn’t a bad idea.

I should note that I would not consider this the ideal beginning electronics project; while not impossible it will be somewhat challenging, and will involve high (lethal) voltages.  If you’re unsure of things, feel free to ask here (I’ll try to answer as best I can), and go brush up on power electronics (there are plenty of books on this subject, as well as college classes).  I’ll be saying this again, but whatever you try must be at your own risk.  I’ll try to keep up with this and post more as I go, so stay tuned.  It should be fun.

Projects

I’ve mentioned before that I’m into solar power, and that there are a couple projects I’m getting into.  Well, I’ve been thinking about a couple things for a long time, but I’m just now starting to get into serious development.  There are two things: a maximum powerpoint tracking (MPPT) charge controller, and a sine wave inverter/charger.  The first of these is a good tool for extracting extra power out of solar panels, while the second is instrumental in interfacing the DC and AC sides of a power system.  That is, the inverter/charger will allow you to get clean AC from your batteries, or charge them from a source already available.  Think computer UPS, but designed for a slightly different purpose.

There are various homebrew projects like these floating around the Internet, and I hope to contribute something.  By posting about these here, I hope that I remain focused on them :).  This should be interesting, and maybe even useful to someone.  I’ll try to give an update here and there as I come up with more of a solid design for both.

G530 Flicker Saga: The End?

Well, I hope everyone has had a great Solstice, and will continue having a wonderful holiday season with Christmas in a couple days.  Up here in NY it’s been pretty rainy and a little on the warm side, with little snow.  Hopefully we’ll have some for the 25th, as that would be fairly appropriate.  And hopefully when the inevitable lake effect comes we’ll all be safe.  If you’re reading this from somewhere out in the western US where they seem to be getting our winter weather, I wish you the best.

Anyway, as you may have seen me post here in the past, I’ve had some interesting issues with my Lenovo G530 laptop.  First, the screen became wobbly and shaky.  Then, it started to flicker.  The first of these was easy to fix, the second very annoying, and almost as easy to fix.  Well, I write now because the dreaded LCD flickering has returned.  Now, it’s been a while since I posted about it last, but in truth the fix lasted for maybe three weeks.  Figuring the cable had come loose, I repeated it, giving me another couple weeks.  Finally, a couple weeks ago I reseated the video cable only to have reliable operation for maybe a few hours before the flashing came back.  It seemed that the work around involved slapping the display repeatedly in certain locations along the sides, which served to jostle the wiring back into place, as well as relieve some of my frustration.  Then last week, after doing this for a while, I got fed up with this.  Here was the result:

Now, you might think that that was a little bit harsh.  But, I disassembled part of the screen and put it back together again.  I figured that somewhere in there something was in a bad position, and just needed to be tweaked a little.  And, it worked!  Since doing this I’ve had no flickering.  You might be wondering what, specifically was the problem.  Well, I still am too – all I did was take it apart and put it back together again, and it seems fine.

Now, given the popularity of previous posts a nice guide is in order.  However, there are a few things to keep in mind before going through this and attempting it yourself:

  • After taking pictures, I realized that I probably could have gotten some better ones for illustrative purposes.  So, I recommend that you take a look at Lenovo’s page with take-apart instructions for this unit.  Also, look over the entire graphic carefully before attempting anything, just to get a general idea.
  • You need to first follow the instructions for getting at the screen hinges, as well as reseating the video cables.  The first of these is more important.  Use it to get at the hinges; don’t tighten them as we’ll be unscrewing them.  The second is less necessary, but I recommend it to have easier access to the cables, and because you may as well reseat those while you’re tearing this thing apart.
  • There are a tone of small screws and such in this.  You probably already know this if you’ve taken it apart before, but it bears restating.  Find a clear, hard surface like a kitchen table to work on this, and keep track of your screws.  It should go without saying that an appropriate screwdriver set is a must (though you’re probably good if you’ve done this before).
  • Be careful when removing the screen bevel (after unscrewing the screws under the little rubber feet).  Use a small, flathead screwdriver and beware of power and data cables, as well as the camera up top.
  • This isn’t a bad time to clean the laptop screen while you’re at it.  I used a paper towel I dampened, and added a drop of dish detergent to it.  Try not to get and soap or water into the sides of the display.  Take another damp paper towel to rinse it.
  • Finally, this procedure is a bit more involved than ones before.  So, BE CAREFUL.  If you aren’t comfortable doing this, seek assistance.  And of course, do this at your own risk; I am not responsible for any damage to your laptop, yourself, or any other possession.

So, here it is:

Good luck.  This may help you, or it may not, but if the flickering has really been getting to you it’s worth a shot.  Overall, if you’re thinking of buying a G530, I’d recommend against it.  It’s pretty nice for a crappy machine, but it is a crappy machine.  But if you’re stuck with one, at least it’s not impossible to take apart.

Lenovo G530 Suspend Problem

It seems that my most popular posts here deal with fixing some common issues with the Lenovo G530 laptop, namely with the screen hinges, as well as the screen flickering.  Well, judging by the comments it seems that these have helped people (even though you will probably have to repeat the screen flickering one, as the cable can come lose repeatedly).  I am glad they are of use to people; the G530 isn’t the fanciest laptop, but if you can deal with some of these things it certainly gets the job done.

I am having a particular problem with this machine, though, that I have not been able to sort out.  It deals with suspending to RAM, or I should say, the inability to do so.  What is supposed to happen is that I activate suspend, and the machine almost completely shuts off save for a blinking, blue LED.  Opening the lid then resumes the machine almost instantly, bringing me back to where I was.  (Yes, I’m sure most of you know what suspending to RAM is, but I’m just trying to be complete.)  However, when I actually try to do this, the machine shuts off, instantly.  No flashing light, no shutdown sequence, it just turns off as if I removed power and/or battery.  Turning it on again makes it boot up as if I had opted to reboot.  After a while I got used to just turning the machine off when I didn’t need it, but this is kind of annoying, and I would like to fix it.

Now, first things first.  As you can probably tell from this site I am a GNU/Linux user, and do in fact run Ubuntu on this laptop.  In fact, overall it runs well.  I bring this up because of many suspend issues which have plagued many of the distros, however for about the first year of having this laptop suspend to RAM worked beautifully.  (Hibernate did and still does, but suspend is more convenient.)  But to verify this I tried installing Windows XP (along with the hardware-specific drivers supplied by Lenovo on their site), but encountered the same behavior.  Same with other distributions.

Next, I figured on a lark that maybe this would have something to do with the battery, which when I first noticed this behavior was on its last leg (ie, 20 minutes of power).  I replaced the battery, but this did not help anything.  I tired looking in the BIOS, but couldn’t find anything that suggested a problem.  I tried updating the BIOS, but this didn’t work either.  I even tried alternating the RAM sticks, as well as using only one at a time.  (It is suspend to RAM, so I figured there might be something there.)

So, how about it, anyone else seen this sort of thing before, shutting down cold instead of suspending?  Maybe not even with this particular laptop?  Any ideas, thoughts, something I may have overlooked?  I will try to make something of an effort to look into this again myself, probably starting with running memtest86 on the machine (something which I did not do, and may reveal something more about the memory).  But, I would appreciate any input.  And if I come to a solution, I will of course do my best to report it here, with a nice pictorial guide if applicable.

DIY

If you’ve flipped through my previous posts here, you’ve probably seen that I am a bit of a renewable energy buff.  I like messing with solar power, for a variety of reasons.  I like the idea of not blatantly stabbing the environment and contributing to global climate change*, but I also like the idea of making your own power and being independent – electricity is something most people in this country are addicted to without realizing it.  There’s the idea of a quiet, easy source of portable power for fun and for emergencies, and then there’s just the fact that it’s cool.

(*Note: Please don’t start a holy war in the comments over the climate change thing.  There are plenty of places on the Internet you can go to debate/argue/flame for and against this, and so it does not need to happen here.)

Now, some time ago I came upon a magazine called Home Power – I think I may have been in middle school.  This magazine is a journal dedicated to small scale renewable energy, mostly residential.  Its founders purchased land off the grid in the 70s, and turned to solar as a way to not have to run a lawn mower engine to power the car tail light bulbs they used for light.  Because the small-scale renewable energy (RE) industry (responsible for the sale and production of photovoltaic panels, wind generators, control electronics, etc.) was in its infancy when they started publishing the magazine (late 80s), a lot of the articles focused on DIY.  Sure, small operations started creeping up where people offered installation and consultation for RE, but nothing like what you can find now.  A fair amount of progress was made by people playing around with the equipment on their own, sometimes even building their own.  And the Home Power articles often reflected this.

I thought this period in the magazine’s history was awesome.  I loved learning about the various problems these early pioneers had, and how they went about solving them.  I liked seeing what some people did with small systems, and the big systems others built.  It was awesome to see these people working toward solutions to some of the problems faced in the world (and which we still face).

Sometime in the early 2000s the magazine’s tone changed, however.  It was focusing less on the DIY aspect, and more on the ‘turn-key’ aspect – more and more of the systems showcased were belonging to people who didn’t fully understand the technology nor have the desire to.  Rather, due to factors such the cost (and reliability) of electricity in their area, environmental benefits, and maybe the presence of tax incentives, they paid a professional to design and install a system on their homes.  (Note that the last factor I mentioned may also provoke flames; see my climate change note above.)  Not much of a DIY aspect is present anymore.  In fact, it seems that quite a few articles in recent issues are not written by the system owners themselves, but by the system installers/designers, or even third parties.

Now, the truth is that I don’t have anything against people who simply want to make use of RE and don’t want to worry about designing and wiring their system, hoisting panels onto their roof, etc.  Honestly, it would be hypocritical of me.  I mean, I’m a Linux user, and even use Gentoo on my desktop.  And yet I also love Ubuntu for the fact that it presents GNU/Linux as an alternative for normal computer users who don’t care about recompiling their kernel.  (I’m actually typing this on an Ubuntu laptop right now.)  I guess I just miss the old format of the magazine, the one I kind of, well, grew up with.

Now, Home Power is still a good magazine; it’s not like you won’t learn about renewable energy from reading it.  In fact, it’s usually pretty descriptive even if it doesn’t discuss all sorts of homebrew solutions.  You’ll learn about solar power, and if you don’t get as in depth as you’d like you’ll have a good jump-off point for learning more.  They’ll respond to your letters if you have questions, too.  And, their magazine is just well-produced: it’s easy to read, no advertisements in the middle of articles, etc.

What I do encourage you to do, however, is go the extra step.  Yes, you don’t need to be an electrical engineer to use renewable energy, or do anything with electricity.  But there is value in going the extra step and being aware of what is going on with your renewable energy system, or anything.  And guess what: most of the information is out there.  If you’re curious, just go Google-crazy.  Buy some parts or system components, and experiment.  You never know what you might learn.

Fun with Solar Power

I normally charge an 18 AH sealed lead-acid battery to run small things like lights, and to charge my cell phone, radio, etc.  Well a couple months ago this battery died.  It was old, and sulfation had set in. I decided to upgrade to an AGM battery (the old one was a gel cell), and picked out the 49 AH version.  Since I am away at school most of the time, and don’t have the space to take the battery and set up a solar panel I had to wait until this week to go and start solar charging it.  So, here is my temporary setup:

This is just temporary.  I eventually want to get the panel mounted somewhere, and the battery inside.  But this is great for the time being.  The battery does well in cold temperatures (I’ll bring it in at night, of course), and should be able to hold enough that I can rely on the system a little more heavily once it’s more permanent.  This is just one 32 watt panel too, with the other one added it will be even better.

The Flicker Circuit

A while back I posted about a circuit I had devised that would make a lightbulb flicker such that the light it cast would resemble a candle flame. You see, last Halloween I was living in my apartment on RIT, where fire is not permitted. So I began to comb around a look for a circuit online that would make a normal light bulb flicker in this way. There are some floating around, but after a while I decided I wanted to build my own. I did, and it works pretty well. I was going to post a schematic, but it was something I kind of put together on a breadboard, and didn’t have a diagram handy. I was going to make one and post it, but I forgot about it. For a while. Well, now I do indeed have a schematic, having just thrown one together. I am posting it here, and you may use it for personal or educational, non-commercial use. Here it is:

The Pseudorandom Flicker Circuit

The circuit is meant to run on 12 volts; if you’ve checked out some other posts you’ll find I’m a bit of a solar power nut.   I figured low voltage is relatively safe for this sort of thing, and I had 12 volts handy anyway from a gel cell, so it works out.  (A wall cube supply would also be great.)  The light also must be 12 volts; I’m just using a small 1/4 amp bayonette bulb I found at an electronics store (it works well in a Jack ‘O Lantern).  The bulb is driven by MOSFET Q1, an IRF720.  It can handle a lot more, probably a couple amps, but you’ll need a heatsink for it.  The bulb I use doesn’t make it heat up all that much. Basically this circuit is kind of like a light dimmer.  You’ll notice it uses three 555 timers, that tried-and-true timer IC that’s been around since forever (the 1970s).  These have lots of pages associated with them scattered around the Internet, so check Google for the fine details.  But basically timer U1 is a PWM light dimmer – we use it to turn Q1 on and off really, really, fast (around 1 kHz), and we change the duty cycle (the percentage of the time it’s on) according to how bright or dim we want the light.

To control the dimmer, we use two other 555 timer driver circuits.  These control it via Q2 and Q3, which add resistance and thus change the brightness.  Q2 and Q3 are controlled by U2 and U3, which turn them on and off.  By doing this at much slower rates (they must not be exactly the same, but close), different levels of brightness are acheived.  Because the rates are different the light cycles through the pattern.  It’s not truely random, but it looks close enough to the casual observer, making it pseudorandom.

Now, you could play with R5, R6, R7, and R8 to get different rates, and maybe make it a little more realistic.  You could even stick potentiometers in there if you wanted to adjust it.  But you’ll probably be fine with just experimenting with different values until you find something you like.  (Again, I won’t go into it too much, as plenty of info is available on the Web.  Also, it’s late, I’m tired, and I don’t feel like thinking about it too hard.)  I suppose you could also build upon this concept and use it to drive something like a thyristor and control an AC bulb.  (Be careful when working with high voltages; you do it at your own risk.)  If the one bulb’s not bright enough, you could also add more in parallel.  They would all flash the same, so it would work.  You could add more dimmers and more driver circuits for different combinations, if you wanted to drive a bunch of pumpkins and not have them all mysteriously flicker in unison.

Or, you could just use a real candle.