A quick note about emergency lighting

I've been thinking about what would happen if the main battery went dead — the whole vehicle would go dark and silent. I had been thinking about adding separate markers on the steering tubes of the back wheels, but it would quite a bit of extra work. It dawned on me that I can set up emergency lighting with a relay and a couple batteries: as long as the power was on, the relay would stay on; if it shut off, the battery would connect to several of the lights on the string: i.e. far front, far rear, and the eyes … 6 lights at 20mA would be 120mA and would drain a 2200mAH battery in 18 hours, but if I got it down to say 10mA total, then it would last for 200 hours. If I went with green then it would be most visible. I dug up a very small relay with a 12-volt coil and it draws 15mA itself, but I found I could get it down to 7mA if I wired it in series with a capacitor (to let it latch) and a resistor (to keep it latched.)

I changed my mind and decided to make a pulse-width modulator with a low-power 555 timer and just hold the reset pin low via the control computer — if it failed, the 555 would start pulsing and drive the LED's.

Loading


Finally sounds like it's working

I'm using some DC-blocking capacitors to get the MP3 player output (which is grounded at -5V) to match the audio amplifier (grounded at -12V.) Unfortunately, I keep getting 1KHz noise from the switching supply. I tried going to the linear supply but that didn't work either. I even tried a big filter capacitor right at the MP3 player but no joy.

I figured out that the MP3 player was generating clean output but the speaker amplifier had issues with its ground being noisy. I tried a number of filtering techniques and such but came up dry. I decided to try with the LA4445 amplifier again: I figure I can bend the 2mm pins to fit the 0.10" spacing on the circuit boards I have. It dawned on me that I could probably make some kind of common-collector amplifier in a class A-B configuration.

I figure I can connect a resistor from emitter-to-base on each pole and one from base to a common input. The ratio of resistors defines the quiescent current and the values define the amplification. I may avan be able to do a push-pull with the 5-volt source for lower power and higher efficiency. I could set up the output to center around the -5V which is signal ground for the MP3 player. I thought about it for a while and decided to go with a common-emitter design with some biasing resistors and an op-amp — using the op-amp to compensate for the transistor switching.

First I tried the LA4445 because I thought it would be simpler. I spent an hour or so working, got everything wired up, but I took some shortcuts and the thing just won't work. Crap. Back to square one — again.

I decided to tinker with the transistors a little. I got to the point that I could generate output, but they won't stay on all the time in a true A-B configuration so it gets all noisy and such. I considered using some resistors and diodes to keep the transistors biased all the time.

I fianlly got a viable solution. I used the same crappy design I used for the amplifier I built years ago which just drives a couple opposed Darlington transistors with an op-amp as feedback, although I did a better job of fixing the high-frequency oscillation problem. It ends up drawing about 400 mA (5 watts) with the MP3 player in-circuit and the amplifier at volume with both speakers driven in parallel. I suspect that the output is around 2 watts total or so, based on around 2 volts RMS (as measured by the oscilloscope) into 2 ohms. If it hits 2.5 volts, it's at 3.1 watts which I think is about peak.

Based on the circuit I used, the input is already self-centering around the midpoint of the power supply. The transistors need 1.2 volts peak-to-peak to maintain quiescent current, so the theoretical maximum output (going rail-to-rail) is +/- 5.4 volts; RMS voltage is 3.8 volts or 3.6 watts into 4 ohms. I tried to get away with a single op-amp to do voltage gain and to power the main amplifier. It seems to work but is even more twitchy than before … although I guess the noisy volume level is so quiet that you'd have to be right next to the speaker to discern it. Here's the circuit:

I had an op-amp I was using to generate a solid signal ground, but I didn't need it so I took it out. Anyway, at the 12-volt source, the audio section (with the MP3 player draws about 50mA and when it's at full volume, it peaks around 200mA, so I assume the output power is around 1.8 watts total consuming some 2.4 watts at peak volume. It kind of sounds like crap with a bit of fuzzy distortion from the transistor switching noise — if you know circuits, it should be pretty evident why:

A simple but lousy amplifier.

I got the amplifier wired and it works okay from the linear power supply but it's not working off the battery and I'm not sure why. It dawned on me that I can just use one of the op-amp's as a differential amplifier off the MP3 player and feed that into the prefabricated amplifier? I ended up with this simplified circuit:

The op-amp tends to avoid power-supply noise.

The first experiment worked great so I rewired the circuit to take out all that extraneous crap to deal with the transistors and got it working again. It looks like I can get something like 3 watts of audio out of the thing, and the whole powered system typically takes around 2 watts at moderate volume.

It's just too bad I had to ditch the power transistors and heat sinks because they really looked cool.

Loading


The pretty-good 12V-5V DC-DC converter

I put the power supply on a board and wired it all up. I figure I'm getting around 60-65% efficiency — far better than the 42% efficiency of using a linear regulator. In other words, if my lighting stuff (the motivation for the 5-volt supply in the first place) outputs 1 watt, the battery will be hit with 1.5 watts whereas if I had used a linear regulator, it'd see 2.4 watts — the 84 watt-hour battery could run for 56 hours instead of 35 hours. Heck, it's almost half as much time as I put into making the fucking thing!

Loading


5 volt success on the breadboard

I got around to the basics of the circuit below. I set up the MOSFET in the configuration below and drove it from the op-amp. I added the PNP in a similar configuration to ensure that maximum current would get to the gate — I need to get that gate to 12 volts, and the 20 mA output on the op-amp wouldn't cut it. I got nice square square-waves but, using a simple pulse-width modulation to the capacitive output, I was getting the same problem of current-in equals current-out. I set up the buck configuration again and finally got some success: 6.6 watts in and 4.2 watts out for an efficiency of 63%.

At this point I realized the output-as-driven would end up as 5-volts from the positive battery rail. I remembered having 7905 negative-rail 5-volt regulators around (and always thinking, "what the hell will I ever use these for?") I switched to the terminology where the positive battery terminal was ground (calling it 0-volts) and the negative rail was -12 volts. I spent some time diagramming the circuit (using CADintosh from Lemke Software, GMBH.) I went back and set things up like I had drawn, made a few changes, and did some final tests on the breadboard. By varying resistors, and using the 51-ohm load I got 97mA out (4.95 volts at 470 mW) with 52 mA at the input (624 mW) for an efficiency of 75%. I tried the 8-ohm load and got 620mA out (4.96 volts at 3.08 watts) with an input current of 419 mA (5.03 watts) which gave me an efficiency of 61%. I think this looks pretty good.

So, after three days of slaving for a total of 20 hours or so, here's the circuit …

Here's the final (so far) circuit diagram for the inverter.

You can look up explanations for a twin-T oscillator and a buck converter for the oscillator and the inductor on the Internet, but one thing that I don't think is too obvious is that the diode after the op-amp is there so the base of the PNP transistor can actually go to the rail — the op-amp may not reach it, but the diode will be shut off so the 470-ohm resistor will shut the transistor down. The other thing is that the inductor has no value. I don't know what it is: it's a yellow torroid with red magnet wire that I pulled out of a dead computer UPS, so I don't know its value, but of the ones I had lying around, it worked best. I guess I should put parallel lines below it because it's iron-core … oh well.

Loading


DC-DC converters via the 10-potentiometer method

First, the "10-potentiometer method" is when you have the basic idea for a circuit but tune it by varying values until it works the way you want. That's basically where I started.

The general idea is that I wanted to make a high-current source for the 5-volts I'll need to run the logic circuits and LED's (I wired the LED's to expect 5-volts on the input resistor) that's pretty clean, but it doesn't have to be perfect. I knew I didn't want to start with a linear supply: if I went from 12 volts to 5 volts, the power efficiency is 42% (i.e. at 1 amp it's 12 watts in for 5 watts out and 5 watts / 12 watts = 42%.) However, I also didn't want to go with an off-the-shelf solution — mostly because I thought my requirements were really easy.

I got up on Monday, August 1 really early and got started. I dug through my transistor bin to find an NPN that could handle around 3 amps. When I started I figured I could go from 12 volts to half that (6-volts) and then drop the rest through a 7805 regulator to give a nicely cleaned-up output.

I got a buck-style converter set up. It was similar to the circuit above — using the twin-T oscillator as a source for pulse-width modulation on an op-amp — but I didn't use the 7905 and just had a couple 100K resistors on the input pin of the feedback op-amp to approximate 6 volts, I didn't have a high-pass filter on the feedback circuit, the oscillator was running from +12 volts to 0 (or 0 to -12 volts as I've got it diagrammed) and the output was just a current follower where I had an NPN set up with the base tied to the output of the PWM op-amp (top right) with its collector tied to battery-positive, and the emitter driving the diode/inductor/capacitor buck setup.

I ran 127mA through 51 ohms to get 6.7 volts (850 mW) and I was able to source 5 volts at 1 amp into 5 ohms (25 watts) although it seems to go linear. I suspect the transformer I'm was using as an inductor doesn't have enough current capacity. I tried 8 ohms and managed to source 800mA at 6 volts (2.4 watts) and that seemed to be the limit of the power source before going linear (the transistor was on at over a 90% duty cycle.) With that output current, I checked the input and it was drawing around 650mA at 12 volts or 7.8 watts — hardly efficient at all at 33%. With the 51-ohm load, it uses 130mA just like the output … then again, maybe my meter just isn't very good at measuring transient currents like the circuit is drawing from the battery. I used the oscilloscope instead so I could estimate the waveform (and actually calculate RMS voltages) with an 0.1 ohm resistor — a handy value for converting to current (volts times ten.)

I tried some differnet chokes and found one that would cause the circuit to input 700mA RMS (2A peak-to-peak) at 12 volts (8.4 watts) for an output of 1 amp into 8 ohms (8 watts) so that's pretty good (although for some reason it decides to output 8 volts instead of 6 volts.) I tried switching to another op-amp (now the LM324 which is what I stuck with throughout) figuring that it could get its output closer to the rails — that got me to around 65% at 8 ohms but only 24% at 51 ohms, but running that inefficiently, I would expect 2 watts dissipated on the bare transistor to get hot really fast … hmm … I'm concerned about my measuring efficiency. I tried estimating the waveform power levels with some calculations and got to a 45% efficient — worse than the 50% efficiency of just dropping half the voltage as a resistive load.

I kept switching coils, transistors, and resistors. Man am I sick of staring at breadboards and oscilloscopes. I got varying figures and even created perpetual motion machines: I had a 115% efficiency at one point. I was certain it was measurement error.

Up until now, I was using a linear power supply for the 12-volt input. When I switched to the battery, everything stopped working. I had to start all over again — I tried varying the frequency of the PWM oscillator then I tried removing the feedback loop to see if I could get something out unregulated and met with some success. I also floated the PWM oscillator (oh yeah: originally I had the emitter tied to ground, so the oscillator was running very close to the rails.) I added a filter capacitor at the input. All this helped but didn't get me any closer to something that could significantly beat a linear supply.

I decided to check my 0.1 ohm resistor to make sure it's good. Using the meter, I measured a 203 ohm resistor in series with the 0.1 ohm and measured 12.67 volts across it (when I hooked the two series resistors across the battery) for a current of 62.41mA. The 0.1 ohm resistor dropped 0.0123 V so the resistance is actually 0.197 ohms. Once I figured that out, all my efficiencies were twice as good. I took a break and enjoyed the catharsis, but I really didn't believe my measurements so I went back and did them again. Using a 303 ohm resistor, I get 12.74 volts across it which is 42mA and I measured 4.0 mV across the 0.1 ohm resistor, making it 0.095 ohms. Darn. I tried the other resistor: it now reads 205 ohms and dropped 12.70 volts or 61.95 mA. Given the 5.9mV drop on the test resistor, I get 0.095 ohms again.

I tried making a PNP current source to drive the NPN current follower off the op-amp … somewhat similar to what I've got above, but the PNP output goes to an NPN current follower. That gave me an efficiency of 42%. I stripped the circuit back to the point that the transistor is switching a full 12 volts on-and-off at a 50% duty cycle, and still it has a 50% efficiency. The collector-emitter voltage switches between 12-volts and 1.5 volts, but that only accounts for some of the inefficiency. I decided to try a MOSFET in the same configuration but got the same result.

Tuesday I got up early again and I figured the feedback loop was giving me trouble by switching off the resistors too soon regardless of the high-pass filter I added yesterday. I thought about using a sample-hold circuit on each pulse, but then thought that was stupid and would be a waste of time. Instead I figured that the output transistor can't get fully on or fully off based on the op-amp. I couldn't figure out what to do about it. I tried using a buck-boost configuration where the inductor is in parallel to the output but that didn't work. Heck, the inductors had no appreciable effect at all.

Once I did some measurements, I figured out the big problem. The MOSFET output was swinging from 0 volts to 8.1 volts when using the 8-ohm load. That 4 volts at 670 mA (6 ohms) with 50% duty cycle accounts for 1.3 watts of power loss (out of a total input of around 8 watts and an output of 3.5 watts, so there's still some 3.2 watts going somewhere I haven't found yet.) I tried the 51 ohm load and the peak is around 9.1 volts with a current of 120mA but with about a 30% duty cycle — 75 ohms this time accounting for 360 mW out of a total loss of 710 mW. I checked, and if I supply a full 12 volts to the gate of the MOSFET, the maximum output is only 9.1 volts into 51 ohms. Harumph.

I switched to some 2N277 PNP transistors I had lying around in the switch-configuration I have on the first stage of the output in the circuit above. However, that didn't work. I tried the more reliable small-signal PNP's but that didn't work either.

Loading


Making light tubes for real

I assembled all the LED blocks assembly-line style. I got a system down and it didn't take too long to get 10 pairs assembled (a total of 20 clusters with 2 LED's in each cluster capable of emitting 3 colors.) The three resistor leads were about the same length so I used a penny as a conductor and tested all the clusters, fixing the few that are dead.

On the 31st, I made a couple passes on how to get the LED's to light up the eyes. Each eye has a pipe angle welded on the back that extends to a hole in the front; I have pupils with a short length of tubing that is glued into a short length of pipe that threads into the angle. The other end of the angle is open and is just the right size to accomodate the 1/2" polyethylene tubing with a very snug fit. I eventually figured out that the LED clusters are small enough to snake through the interior of the pipe angle so I just put them on long pigtails and I'll shove them into the pupil tubing to light it up.

By spacing the clusters evenly, I end up with 5 pairs facing in opposite directions, and the middle pair is right at the apex of the curve of the frame. Perfect. I started wiring them up like I did with the spiral bike tubing, except with address lines too. I needed to address 11 common cathodes (the 10 lights in the tube plus the one for the eye) along with 3 anodes (red, green, and blue) so I decided to run two ribbon cables: 8-conductors and 6-conductors. The 8-conductor would run the whole way with the three anodes and the eye cathode on the middle 4 conductors and then I'd use the two outside pairs to address the next two clusters. Likewise, the 6-conductor wire would address the remaining 6 cathodes.

I soldered the wires onto each cluster and taped each to a short length of 1/4" polyethylene tubing with clear tape — I did this on the spiral bike because it tended to shove the ribbon cable to the edge of the larger tube so it wouldn't block the light. Once I got done, I had a length of flopsy segments of 1/4" tubing with LED's in between each segment, a lot of tape, and ribbon cables. However, once I tried to snake it through the tube, it was just a little too big. I couldn't get the thing through. I tried pushing it, pulling it with a wire snake, adding silicone lubricant, sucking it with the vacuum cleaner, sucking it with the vacuum pump I have (using a pig made from larger tubing), and finally pulling it really hard with a soldered loop using the wire snake. I got about halfway and couldn't get any further. I took it back apart and found that I had ripped out some of the wires and it would never have worked anyway. I got a little annoyed for a bit, but realized that I could use ribbon cable for the common red, green, and blue anodes and then use wire-wrapping wire for the cathodes as they'll only carry a maximum of 60mA — the farthest lights might get a little dim, but it'll fit in the tube.

I got the wire-wrap solution knocked off in less time than I thought (including the repairs to the broken LED's — I still didn't manage to permanently break any of them.) The new setup looked better and using a similar technique with the wire snake, it slid in place with a modest amount of effort. One of the clusters didn't light so I had to take it apart and fix a bad solder joint, but other than that, the whole thing is addressable.

Even a penny from when dinosaurs roamed the Earth was a great way to test each of the clusters and to demonstrate their small size.

Whew ... here's all the LED nodes.

Loading


Spiral bike and light test

I was unable to kick the welding-geek habit and I accidentally made a frame for a spiral bike out of one piece of pipe. I'll be bringing it to Burning Man, and I used the light tubes as a proof-of-concept for my lighting idea. It's somewhat different in that the lights are all wired together (I can't address each cluster) but I do have the ability to change the colors using a control box behind the seat. It also has little headlights and a tail light, so it's safe to ride on the road (har har.) The digital camera on the camcorder was pretty bad so they don't enlarge (there's no point … the resolution wasn't there — I need my film camera, but I don't want to pay for the developing for just a couple shots.)

Here's the little spiral bike with the tubing lights lit. You can see the headlights too a little.

The spread of light through the tubing is easier to see when it's darker but then you can't see the frame.

Loading


Lights, camera, action

I worked on doing some tests of the lighting circuits. I am working on a bike for Burning Man and I'm going to use the same lighting technique, so I got a chance to try out what I want to do. I started with the red/blue 3mm LED's and the green 3mm LED's from LSDiodes.com. I decided to wire them in opposing pairs so I wouldn't have to space them as close (I figure the glow from an LED travels about 1 foot down the polyethylene tubing, so I can get away with spacing them out every 2 feet if I make a pair that shine away from one another.) It really wasn't too bad at all … here's the photo essay:

Here's the LED's as they're shipped. The red/blue is on the top; the pin on the side that's flat on the lens is the red anode, the other side is the blue anode, and the middle is the common cathode. On the green, the flat indicates the cathode.

I cut the leads short on the LED so the resistors can be soldered close; this eliminates the need for using insulation because the leads can't be bent to short out anymore. Plus it's compact.

The red/blue LED's need two resistors; the red side gets a 180 ohm resistor and the blue gets 150 ohms.

The green only needs the one resistor.

Here's what the finished pair looks like. I'll have to remember that I want to address each cluster, not the whole thing, so I shouldn't solder the cathodes together.

A couple layers of tape diffuse the light so it blends better.

The next step was getting the ribbon cable inside the 3/8" inside-diameter tubing. Initially I tried just stuffing it in but it ended up being all floppy inside the tube. I bought some 1/4" outside-diameter tubing, taped the ribbon cable to it, and then stuffed it through. It works a lot better for two reasons: first, the ribbon cable lays flat, and second, the light assemblies are hard to push down the tube — I was using a piece of stiff wire, but with the additional small tubing, I can just guide it through without a push-rod.

Loading


Bought a new MP3 player

In the process of shopping around for more tubing stuff for the lights, I stopped at Goodwill Fashions (376 Jefferson Rd., in Jefferson Plaza) and found they had an MP3 player for $25 so I picked it up. It's a Memorex MMP8560 with 128MB RAM. With 4 times more RAM than the Digisette, I'll be able to put on more music stuff. However, the interface to get it to start is more complex so I'll probably need to use the computer chip to run it (whereas the old player needed one button to be pressed to start, the new one needs to be powered on first and then started with the play button.)

The good news is that it only draws 40 mA. If I use a linear regulator from 12 volts to get to 1.5 volts (it uses a single AAA alkaline, not a NiMH cell) I'll only have to get rid of around 450 mW of power as heat which was as good as I got with the buck converter anyway. (Remember that the rationale there was to pick a higher-than-audio frequency and the transistor tended to go linear. I might try the buck converter again anyway.)

Loading


Frying the stupid MP3 player

I spent about 3 hours working on the circuit to try and get a decent 1.2-volt output. I went through several transistors and some trial-and-error. Once I got to a point where I thought I'd see how things were working, I noted that the indicator light on the MP3 player was just staying on. I tried installing the battery but I got the same thing. Oddly, I can connect it to the computer and read the flash memory just fine. Hopefully it'll "heal" if I leave it disconnected for a while.

Loading