Scotty, I need more power!

Today is Monday, October 11, 2010. What does this mean for you? I’m not sure really… how are you? For me, it means entering my seventh week of job hunting. Actually I’ve been looking for longer than that, but I’ve only been out of school and intensely searching for about seven weeks. Now if you’ve ever been in this situation, you know it gets pretty boring pretty fast. So to help break up the monotony, I’ve been blogging quite a bit and, recently, thinking about all the cool stuff I can buy once I’ve got income again. 😛

You know what I’d really like? A quality benchtop power supply. So far I’ve been working with a simple linear supply which I inherited about four years ago. I think it actually came from a DIY kit. It’s got one fixed 5V, 2A output and two adjustable ±1.5V to ±15V, 1A outputs. Being a linear supply, it’s fairly inefficient. It also can’t do current control, although it does provide over-current and short-circuit protection.

My Current Power Supply (Art Supplied by Author)Now don’t get me wrong, I love this supply. It’s performed with gusto and with fervor, and I certainly couldn’t have accomplished much without it. But as I said, it lacks the ability to perform current control – something I’ve found very useful. It would also be nice to have digital readouts showing voltage and current (since those adjustable knobs aren’t terribly accurate). Now I know I could modify it to perform most of these tasks, but I’d rather use a power supply than build one (despite all the street cred that would get me).

With that in mind, here’s what I’m looking for in my next benchtop power supply:

  • Voltage range of 0-40VDC (or greater)
  • Current supply rated to 5A (or greater)
  • Adjustable current control
  • Digital displays of voltage and current
  • Single output
  • Switching supply preferred for efficiency (but linear is alright)
  • Cost should be under $500

I’ve already located a few suitable candidates; first up is the B&K Precision Model 9110:

B&K Precision 9110

This supply meets all of my requirements, and costs just $275 at Digi-Key. The only exception is that it does not supply its full current (5A) at all output voltages. The diagram above illustrates how this supply is power-limited instead of fully current-limited. So if I want full voltage output (60V), I’ll only be able to draw about 1.7A. This I could probably live with. I also find it interesting that this claims to be a “mixed-mode” supply. So in some ranges it operates as a linear supply, but in others as a switching supply.

Next up is another B&K Precision supply, the new Model 1550 (now with USB charger!):

B&K Precision 1550

This $139 switching supply is good for just 36V and 3A, so it’s a little shy on power. But I had to mention it because of its iPod-like front panel. That new touch pad design and glossy finish make it look remarkably like the iPod Nano (which, conveniently, you could charge with this supply’s USB port). Somehow I doubt I’d use that feature though.

Now here’s yet another B&K Precision PSU, the Model 1743B – a little pricey at $539:

B&K Precision 1743B

This supply provides up to 6A throughout its 35V range and includes two four-digit LED displays. It’s a pretty nice supply, albeit expensive. I’m not sure whether this is a linear or a switching supply, but I’d guess it’s probably linear. That 6A output sure sounds nice…

How about something non-B&K for a change? Here’s the PWS2326 from Tektronix:

Tektronix PWS2326While its voltage rating is a little lower than I’d like (32V), I do appreciate one thing: buttons. No need to fiddle with knobs to get the right voltage and current settings – just type them in! Plus it’ll source 6A, and for $449 it certainly beats the B&K 1743B. It also allows you to return to sixteen different preset voltage and current settings. Again, I kindof doubt I’d ever use that feature, but maybe someday.

One final supply worth mentioning is this beefy Protek model 75005M:

Protek 75005M

This supply certainly meets all of my specs and then some. The prices I’ve found online tend to vary a bit though , from $530 to $630 – either way, it’s definitely on the high side. Plus, I can’t say I’ve ever heard of Protek anywhere. Anyone out there use Protek?


Comparison TableWell right now I’m learning towards either the B&K 9110 or the Tektronix PWS2326. I really like the buttons provided on the Tektronix, but I also appreciate the higher voltage provided by the B&K as well as its substantially lower cost. Of course, until I find work, they’re all out of my price range.

If anyone out there has experience with any of these supplies or would like to suggest another, please leave a comment! Thanks!

Probably just one output would do fine

Supercaps For The Win!

A couple of years ago my parents bought themselves a LifeFitness R3 electronic exercise bike. It’s a pretty slick little machine, albeit expensive. The R3 has a plethora of workout and intensity options, a built-in heart-rate monitor, and displays that show distance traveled, calories burned, etc. What’s really cool is that all of the electronics are pedal-powered; who really wants to suck energy from the grid just to get a workout?

LifeFitness R3 Exercise BikeBut I’m not writing this post just to tell you about a neat exercise bike. I’m writing because I’ve figured out a way to make it even neater. Err, more neat. Whatever. Anyway, there’s one thing about the LifeFitness R3 that we’ve found slightly annoying: because it’s pedal-powered, whenever you stop riding, the display shuts off and the electronics reset. So if you’re in the middle of a 30-minute ride and get distracted by, let’s say, a Justin Bieber commercial, you’ll lose all of your stats and will have to re-start.

So since I hold degrees in electrical engineering, my parents asked me to make use of my education and remedy this inconvenience. My first step was to [carefully] crack open the display panel so that I could assess my options (scroll down for the full label legend):

LifeFitness R3 Circuit Board
It turns out this bike is controlled by our old friend the AVR ATMega128 (Label #1). This is the same chip found in the development board I used for my chronograph. It’s also very closely related to the AVR microcontroller used in the Arduino Mega. I tell you, it warms my heart to see this chip out in real products. Ah, but I digress…

Well having located the brains of the operation, I started looking for their power source. I quickly spotted two TO-220 package 5V linear regulators (labeled “R” in the image above). However, my multimeter (the only tool I had available at the time) indicated that neither of these were connected to the AVR. Eventually I located a tiny 8-SOIC regulator (Label #2) just beneath a pair of 2200uF power supply filter capacitors. A check of its pins indicated that this was in fact the device powering the AVR. And this regulator was fed by a set of wires that led down into the generator electronics. Interestingly, the generator appeared to be brushless, but I couldn’t get a good look at it or its electronics because of large panels I did not wish to damage (well, I thought about it).

I was also very excited to find a 2×5 ISP header on the main circuit board (Label #8). This meant that I might be able to reprogram the AVR to do my bidding. (Update: I’ve confirmed that this is possible; scroll down for details.) Perhaps I could have it enter power-save mode whenever the pedals stopped. Of course, this wouldn’t eliminate the power consumption of other devices on the board (display drivers, regulators, op-amps, etc). Plus, trying to reverse-engineer and modify machine code is no picnic (at least not to my knowledge). I decided to avoid this rabbit-hole and keep things simple.

NessCap 5V, 2.5F SupercapacitorsMy best option seemed to be the addition of supercapacitors. I could just tie them in parallel with the supply line filter caps. That way, the AVR’s regulator would continue to get stored power even after the user stopped biking. Adding capacitance to the regulator’s output was another option. However, the high initial charging current required by a large capacitor could be damaging to a device only rated to supply 100mA.

So I had two questions: how much capacitance do I need, and how much voltage will it have to handle? The second question was answered simply – I hooked my voltmeter up to the supply lines while pedaling and measured about 10.5VDC. To determine the amount of capacitance required, I used the following formula:

Ic = C*(dV/dT)

The ATMega128’s datasheet says it draws a current (Ic) of 19mA at 8Mhz and 5V, so let’s roughly double that figure just to be safe (to account for losses in the regulator and consumption by additional components). If the regulator can safely operate down to 5.5V, then our dV value will be 10.5 – 5.5 = 5V. Finally, let’s say we want to operate for 90 seconds. This means we need a capacitance of at least 0.72F. When I looked at Digi-Key (at the time), my best option was to purchase three 5V, 2.5F capacitors. Put in series, they’d be able to handle up to 15V, but their total capacitance would be reduced to 0.83F – still more than was necessary. Here’s a closeup image which shows the three supercaps linked together and soldered across one of the power supply filter capacitors:

Closeup of the supercapacitor fun-pack
So how did it all work? Splendidly. It turns out the AVR circuitry only drew about 30mA, giving approximately 120 seconds before full discharge. So now, whenever you hop off the bike to get water, adjust the stereo, or pet the dog, the bike’s display turns off (since it’s powered by a separate regulator), but the AVR continues to run, and will hold your current program and position for up to two minutes. A nifty feature added for about $20.

LifeFitness R3 Circuit Board
While I’m on the subject, I also found it interesting that the LifeFitness R3’s circuit board includes connections for a serial port (Label #9) as well as pins for a safety switch (Label #10). I suppose these were intended for other features not included with this model, but were left in place to reduce PCB manufacturing costs. For instance, the safety switch must have been meant for use with treadmills (I can’t see the need for this on a stationary bike). Perhaps the serial port is for a computer link of some sort? I’m tempted to test it out…

So finally, here’s the complete legend for the circuit board pictured above:

  1. ATMega128 microcontroller
  2. Linear regulator (8-SOIC) supplying the microcontroller
  3. Supercapacitor fun pack (3x 2.5F, 5V caps)
  4. Pushbutton circuit board
  5. Display driver IC (Holtek HT1647, 4-level grayscale, 64×16 LCD controller)
  6. Main I/O connector (includes power connections)
  7. Beeper (or, if you prefer, the annunciator)
  8. ISP header (for AVR programming)
  9. Serial port connections
  10. Safe switch connections

And because the quality of one’s post is directly related to the number of images contained therein, here’s a picture of my yellow lab. He’s not too sure about cameras just yet…

Marti (the Dog)

Update (10/8/2010): So I pulled out my old serial AVRISP with its 2×5 connector this afternoon, just to see if I could talk with the bike’s ATMega128. As it turns out, none of the chip’s lock bits were set, so I was able to download the HEX file with no problem (except for the strain on my arms while I kept the pedals turning). This means it is entirely possible for me to make modifications to the R3’s firmware. Of course, I’d have to figure out how to convert HEX back into ASM (which seems to be a questionable practice). If anyone else out there is interested in looking into this, feel free to leave a comment.

Anyone For An Electric Shower?

I must confess, I love Wikipedia. 😀

Now I know what some people are going to say; and yes, those articles could have been written by a six-year-old in Yugoslavia. But who’s to say a six-year-old can’t contribute to an article on stochastic processes? Alright, granted, not all of the information you find on the internet is accurate, Wikipedia included. But for the most part, it’s still pretty good reading. Next to the “Random Article” button, what I like most about Wikipedia is that everything is linked. One minute you’ll be reading an article on syncrotrons, then ten minutes and three clicks later you can find yourself on a page about slinkies.

Lightning Courtesy Photoshop and the "Difference Clouds" Filter
I’m telling you all of this because, while reading Wikipedia’s page on energy conversion efficiency, I noticed a reference to the “electric shower.” I’d never heard of such a thing before, and my first thoughts ran to this one very important principle:

Water and electricity don’t mix.

So how could an electric shower be anything positive? Perhaps this was slang for some kind of strange torture device. “Yes, send Mr. Bond to the electric shower!” Or maybe it wasn’t so malevolent. Possibly a futuristic Jetsons-type shower? Well strangely, WikiPedia didn’t have a full article on electric showers, so instead I tried the Google.

Mira Advance ATL (9.8kW)As it turns out, the electric shower is essentially just a normal shower, but with its own built-in heating elements. Now I’ve heard of tankless and on-demand water heaters before, but never ones built right into a shower head. Apparently they’re more common in the UK (where they’re no doubt safe and effective) as well as in parts of South America, Costa Rica, and Puerto Rico (where they’re often considered a health hazard).

If you overlook the inherent safety issues involved here, this isn’t such a bad idea. Putting the heater right where it’s needed certainly cuts down on wasted water and energy. But wow, these things do suck a lot of power. Models here are rated from 7,500W to 10,800W. Operating the latter would be equivalent to leaving seven clothes irons running simultaneously. But hey, unlike a tank water heater, the heating element only operates briefly, so long-term your energy usage should be lower. Plus, Wikipedia claims that the energy conversion efficiency of an electric shower is between 90 and 95%, which is impressive. Some models even work with low water pressures because they contain their own pumps. I must say, it’s pretty cool what you can discover online.

Current Sensing Made Easy

Current ShuntIt’s been said that engineers aren’t boring people, we just get excited about boring things. Well, that may be true, but I’m not so sure. How could anyone not get excited about measuring hundreds of amps worth of electrical current?
All those electrons, zipping by at less than 0.1mph…

Thrilling, I tell you, thrilling!

But seriously, do you know what you can do with hundreds of amps? Welding is one thing, and that’s pretty hip to be sure. Plus, everybody’s making coil guns these days. And what do all good impulse weapons need? Current! Well, strong magnetic fields to be precise, but currents produce magnetic fields. So, more current!

Anyway, if you’ve ever needed to measure currents of tens or hundreds of amps, you’ve probably used a current shunt (pictured above right) or something similar. These devices simply take advantage of Ohm’s law, which states that the voltage measured across a resistor (the shunt) is equal to the product of current and resistance:

Ohm's Law (Voltage = Current * Resistance)

So, we put our precisely-known resistance in-line with the current we wish to quantify, then simply measure voltage (which is typically a substantially easier task) and OLPCcompute current. Now there are going to be a few problems with this. First, putting additional resistance into your circuit is going to waste a bit of power. A typical 100A current shunt introduces a resistance of 1mΩ. Pretty small, right? Well at full current, it’ll be dissipating 10W of power. Admittedly, yes, 10W is pretty small. But still, that’s 10W which could be put to better use powering laptops in Africa. Plus, this 10W causes the shunt to heat, which could cause inaccuracy and even damage over time.

The second issue with current shunts is their need for amplification. With the 100A shunt I mentioned previously, you only get 1mV per ampere. With a 12-bit ADC using a 3.3V reference, that’s only a resolution of 0.8A. To get better resolution you’ll need an op-amp of some sort. And if you’re measuring bidirectional currents, you’ve then got to worry about how to deal with negative voltages. All of this just means more cost, more parts.

Today, I’d like to introduce you to another one of my favorite integrated circuits: the Allegro Hall-Effect Current Sensor. I first found these ICs on DigiKey while looking for a current sensing solution for my Doom Box solar power system. I’ve since used them in several iterations of that project as well as my fuel cell demonstration system, and have been very impressed with their performance. A few varieties are pictured here:

Allegro Hall-Effect SensorsAnd just what do they do, you ask? Well, they measure currents using the Hall effect. But you figured that out from the title. The result of this method is a significantly lower series resistance. And what’s really nice about these chips is their built-in amplification circuitry. They provide a voltage output which is proportional to measured current on a 0-5V scale (even for bidirectional currents, where 0A is represented by a 2.5V output).

So how does this compare to our old friend the shunt resistance? Allegro’s 100A ACS758 sensor provides an output of 40mV per ampere with a series resistance of just 0.0001Ω. That reduces our maximum power dissipation, by a factor of ten, to just 1W. How about cost? A 100A shunt goes for around $24. The ACS758 costs $7. So to summarize: this solution offers forty times more resolution, ten times lower power dissipation, three times lower cost, and requires fewer external components. Now you see why this excites me?

No no, you’ve got it backwards.

A lot of things in this world just aren’t easily reversible. And no, I’m not referring to the strict definition of thermodynamic reversible processes. What I mean is that many conversions (energy, chemical, etc.) and systems cannot be readily reversed. Your hairdryer likely can’t turn heat into electricity. You can’t very well make oranges out of orange juice. And I’m pretty sure your car won’t turn carbon dioxide back into gasoline.

Converting OJ Into Oranges: It Just Can't Be Done

Motors and Generators

Now of course, some processes can be reversed. For instance, many people know that DC electric motors can also be used as generators. Such motors work because of the forces generated through the interaction of two magnetic fields. One of these fields is brought about by the flow of current through coils of wire; the other is created by permanent magnets attached within the motor housing. See this HowStuffWorks article for more details. This same DC motor can also be used as an electrical generator.

NRC Steam Turbine Driven Electrical Generator
Generators work because of Faraday’s Law of Induction, which states that “The induced electromotive force (emf) in any closed circuit is equal to the time rate of change of the magnetic flux through the circuit.” In other words, a changing magnetic flux (e.g. a moving permanent magnet) will induce an electromotive force (a voltage) in a nearby electrical circuit (e.g. the motor’s windings). This Wikipedia entry on electrical generators is quite an interesting read and includes some history of generators such as the one pictured above.

Light-Emitting Diodes (LEDs)

Optek High-Intensity LEDsNow here’s something a bit more curious. I’m sure you’ve heard of or at least seen an LED. They’re everywhere: from alarm clocks to cell phones to outdoor lighting. As their name says, they emit light. But did you know that LEDs can also be used as light sensors? It’s true! While LEDs are optimized to emit light, they are, physically, not that different from photodiodes. Thus, instead of operating them in a forward bias, you can reverse bias them just as you would a photodiode. The following schematic comes from an Altera white paper and illustrates how the same the same LED can be used as both a sensor and an emitter:

Altera LED Emitter/Detector Design SchematicThis white paper also describes how, with two pins on a CPLD, microcontroller, or FPGA, the same LED can be used as both a sensor and an emitter without rewiring. This type of dual-purpose use could result in significant cost savings for devices produced on a large scale. In addition, it’s also possible to transmit and receive data using single LEDs. At RPI and other universities, research is proceeding on high-speed data transmission using ambient LED lighting – “Smart Lighting,” it’s called. In the future, when incandescent and fluorescent lights are replaced by high-intensity LEDs, your laptop might actually connect to networks via the lights in a room. They’ll be doing double duty: lighting the room and transmitting data via high-frequency modulation. Pretty cool, right?

The Speakers are Listening

A Typical SpeakerFinally, one of the most interesting and practical reversible technologies is the speaker. Just the ordinary, magnet-and-coil cone speaker. Did you know that a speaker can be used as a microphone? Interestingly, the reason this works is precisely the same reason that DC motors can be used as generators. Normally, speakers produce sound through vibrations created using coils and magnets. Just as with the motor discussed earlier, a magnetic field is created by passing current (the audio signal) through a coil of wire. This field will cause the coil to either be pulled towards or pushed away from the permanent magnet. This motion, when done very rapidly, results in sound. Check out this HowStuffWorks article for a brilliant animated illustration of this effect as well as further details on speaker operation.

Now, the great thing about the way in which speakers operate is that it’s entirely reversible. Instead of passing a current through the coil and causing it to move, we move the coil using sound and then amplify the resulting current. Again, this works because of Faraday’s Law of Induction (see above). But how does this work practically? Well, not too bad actually. Some people say that an average speaker may sound better than a cheap microphone. If you’d like to give it a try, just find an old speaker, then wire it into the microphone jack on your stereo, laptop, etc. To test, just speak into the speaker!