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!

5 thoughts on “The Doom Box: Part I”

  1. Looks pretty neat! I’ve been considering a similar system for running a server and firewall. I’ve got a couple panels together, but don’t have many options for permanently mounting PVs right now at my current residence. I’m also planning to build a sine wave inverter soon, which should be an interesting project.

    Not sure what you’re planning with regards to your increased processing power, but one thing that might be kind of neat is to have the MCU count watt-hours in the battery and switch based on that, as opposed to voltage. It’s a little tricky, but you might want to have a look at this:'s_law

    Good article!

  2. Thanks for the comment Ben! I can relate to having few PV mounting options… attaching panels to lawn chairs weighed down by marble chips? Not my most robust project. I’d love to hear how your project turns out, particularly the pure sine inverter. What sort of topology do you plan on using?

    Also, I’m not sure if you noticed my second posting on this project, but I’ve implemented a lot of monitoring and control using an attached laptop. It does count watt-hours, although not using Peukert’s law (thanks for the link). I haven’t yet tried to account for rate-of-discharge, I just count assuming ideal capacity since I’m usually drawing very low currents. Then I reset my counter to “full” whenever the battery gets topped off at around 14.3V.

    If you’re looking into PV specifically for a server, you might also be interested in this article:,1693.html

    Thanks again!

    1. Mike,

      I didn’t notice your second post. Looks pretty neat! You can never have too much data (as long as it’s useful…). Nice VI too, I like how you have the Webcam there.

      The Peukert’s Law method I believe is used by commercial products that measure the energy you’ve stored in the battery. Your method should be fine too, especially seeing as you don’t discharge the battery that much on a regular basis.

      I did a similar thing with the lawn chairs back home (I’m at school now) with two 32 watt Uni-Solar panels, but I don’t like leaving them out when I’m not around (and I can’t exactly use them here all the time). I have an AGM battery too which I charge when I’m home.

      I wouldn’t mind building a small (300-500) watt sine wave inverter, and maybe integrate a homemade charger. I’ve been thinking about how to do it for a while, and will probably go with a class D amplifier. I’ve seen some similar designs on the Web, and it seems like the way to go. I just think it would be an interesting project; I would of course probably get a commercial inverter for the next step (no electric bill :)).

      Thanks for the Tom’s Hardware link, I’ll check it out in more depth when I get the chance. Renewable energy is fun, and very addicting. Great articles!


  3. Perhaps you could mount the solar panel to your roof on a stepper motor and have a microcontroller turn another stepper motor with an LDR on the end to gauge which area the brightest light source is and turn the solar panel’s stepper motor to face that position, which would optimize the energy collection.

Leave a Reply

Your email address will not be published. Required fields are marked *