20090604

Neon oscillators

Neon lamps aren't just for lighting. They can actually be made to perform a variety of circuit functions. For example, a collection of interesting oscillators can be built using only neon lamps, resistors, and capacitors. No transistors, vacuum tubes, or such devices are required. The blinking neon bulbs in the goggles mentioned in the previous post are one such oscillator.

The GE manual on neon lamps contains a huge collection of neon lamp circuits and the detailed theory behind them. I'll discuss the relevant theory only briefly; for details, see the theory sections of that manual.

Here's a nice simple multivibrator built from a pair of neon lamps. Operation is explained with a simple model for lamp behavior: the lamp, in the off state, requires about 70V to turn on (for the NE2 types I'm using; others are different, and individual lamps vary noticeably). However, once on, the ionized gases improve conduction and the voltage required to maintain the operating current (of about 300uA) is reduced to approximately 55V.

Consider the case where N1 is on and N2 is off. Current flows through R1 and N1, and the junction between R1, N1, and C1 is maintained at 55V (N1's maintaining voltage). Since N2 is off, we know that the junction of C1, R2, and N2 is below 70V (N2's firing voltage), and no current is flowing through N2. Current flows through R2, into C1 (charging it), and through N1 to ground. The voltage on C1 rises toward the supply voltage as C1 charges. Eventually, C1 is sufficiently charged that the voltage on N2 passes its firing voltage and N2 turns on. As it does so, the voltage on its positive electrode rapidly falls to its maintaining voltage of approximately 55V. Since the process is rapid, the voltage across C1 is unchanged, dropping the voltage on N1 from its 55V maintaining voltage down to about 40V, which quenches N1. C1 begins to charge through R1 in the opposite direction, and the cycle repeats. Frequency is controlled by the supply voltage, the resistor and capacitor values, and the firing and maintaining voltages of the two bulbs.

Startup of the oscillator is straightforward: as the supply voltage rises, small component asymmetries cause one bulb to fire first. The first cycle begins with C1 at approximately 0V, and the oscillation described above begins at the second half cycle.

The ring oscillator shown here is only slightly more complicated. As N1 fires, the voltage on both N2 and N3 are reduced, inhibiting firing. C2 and C3 both charge until one of N2 or N3 fires. Assuming N2 is at a higher voltage than N3, it will be just below 70V before it fires, with N1 at 55V and N3 somewhere between the two (say 65V). As N2 fires, the voltage on it falls, and so do the voltages on the other two bulbs, thanks to the capacitors. The relative voltages, however, remain the same. N3 will still be at a higher voltage than N1. While N2 is on, the voltages on N1 and N3 are rising; N3, starting at a higher voltage, will fire before N1. The process will continue in a ring, with each bulb firing in sequence.

Obviously, the circuit can be extended. With five bulbs, operation becomes slightly more complex. Again assume that N1 is on, and the other bulbs off. Currents flow through R2-R5, charging the capacitors. R2's current flows through C1, and R5's through C5, and both flow to ground through N1. The current flowing through R3 and R4 head through C2 and C4, which also charge. Thus, C1 charges faster than C2; the voltage on N3, however, rises faster than voltage on N2, since the voltage on N2 is VM1 (N1's maintaining voltage) plus VC1, while the voltage on N3 is that plus VC2. N4 and N5 have the same relationship. As a result, one of N3 and N4 will fire first. Assuming it is N3, the same conditions apply as before, and the next bulb to fire will be either N1 or N5. However, since N1 was on most recently, the voltage on N5 was higher; it will fire after N3. Next will be N2, then N4, and then N1 again. This star patterned firing order will continue.

Both of the above oscillators are symmetric. They can oscillate in either direction. The determining factor will be component mismatches and startup conditions. In general, small ring oscillators will have a preferred direction, thanks to variations between the resistors and bulbs. Starting them with the capacitors partly charged, though (by briefly removing power to the circuit and then reapplying, for example) can sometimes cause oscillation to reverse.

Extending the circuit to greater numbers of stages will, with precisely matched components, keep the same star shaped pattern as the five-stage ring. However, unmatched components will break this pattern, and as the size of the ring increases the matching required becomes tighter. With slightly mismatched components, the pattern becomes chaotic — it is neither fully random nor fully ordered. With 9 bulbs and 5% tolerance resistors, the order was no longer rigidly preserved in my testing. For the goggles, I decided I liked the chaotic effect. In order to emphasize it, I intentionally varied the component values. I basically just pulled resistors at random out of the 1M-10M drawer. Some of the capacitors are 1uF, and some are 2uF — with all of them at 1uF, the oscillation was faster than I wanted. The resulting effect, where the bulbs fire without discernible pattern or rhythm, is one I like very much.

This is the circuit as constructed in the goggles. The central wiring is one supply rail, and the other supply rail is the loop of wire visible in front of the goggles in the video. In use, the power supply is placed in the left eye such that the neon lamp is in the right spot, the wires are folded up to fit, and it is taped in place with electrical tape. The exposed wiring on the right is also covered in electrical tape. Note that there is no connection between the capacitor lead and the common wires at the bridge of the goggles; that's covered by electrical normally as well.

Construction tips and modifications: Nothing in particular. The circuit works at a range of supply voltages (greater than the highest bulb firing voltage). Supply polarity can be reversed as well. The resistor values must be chosen to keep the bulbs within their rated current limit. If you make the resistors too large, with too little current flowing in the on bulb, it will cease to operate (details can be found in the GE manual). In general, values of a few hundred kOhms to a few MOhms are appropriate. With more stages, you'll need higher valued resistors, since current for the on bulb is flowing through all of them in parallel. Oscillation frequency can be tuned from a few kilohertz all the way down to below 1Hz with appropriate capacitors. The capacitors need to be ceramic or film types, not electrolytics, as they will be charged alternately in either direction. For the goggles, I used BC1162CT-ND 1uF ceramics.

20090603

Neon

Neon lamps are undeniably cool. These days, everyone seems to have forgotten them in favor of LEDs. However, for certain aesthetics, LEDs simply won't do. Neon produces a warm, glowing light; LEDs are rather harsh and sterile in comparison. Unfortunately, it takes a little bit of work to power a neon lamp -- they require a voltage source above 80V (exact number depends on the lamp), but very little current. The NE-2 bulb is common; it requires about 75V to start, and has a rated current of 0.3mA. They're readily available -- AllSpectrum stocks them at $0.35 (less in bulk).

By way of example, here are some goggles I built using neon lamps for aesthetic effect. The blinking is achieved with neon as well, no transistors or integrated circuits required -- but that's a subject for a later post. The subject of this post is just the power supply. A typical NE-2 power supply would be a 90V source, and a 100k resistor in series with the bulb. Neon lamps exhibit an odd characteristic -- though it takes 75V or so to strike the bulb and turn it on, once on it only takes 55V or so to keep it on. If you applied 75V once it was on, the current would rise rapidly until the bulb exploded. The 100k ballast resistor keeps the current to roughly the 0.3mA rated current once the bulb is on.

For the goggles, I wanted to power them from CR2032 coin cell batteries -- cheap, small, lightweight, and readily available. I ended up using two, for a 6V supply. Turning that into 90V takes some work -- a job for a boost converter. In serious design, a flyback converter with a transformer would be used, but those are hard for the hobbyist to get with appropriate specs. You can salvage them from disposable cameras, but I have a personal preference for parts I can order from Digikey and get a datasheet for. For this circuit, a boost converter is just fine.

In order to keep the circuit simple, I run the converter in discontinuous mode. That means inductor current falls to zero on each cycle. Timing is controlled by the venerable 555 timer IC. Any 555 will work, but the standard ones draw several mA -- a significant load for those poor coin cells. The TLC555 cmos part is much lower power draw, slightly faster, and higher output drive — resulting in faster switching and higher efficiency.

Q1 is the main switch for the boost converter; any small n-channel mosfet with appropriate ratings will do. The BS107A is a cheap, good option. Similarly, any fast diode will do for D1 — the MUR160 or its relative the MUR120 are good choices. 1N4004 types will die in a hurry. The 555 is arranged in normal astable mode. Q2 provides output regulation by varying the control voltage. Each cycle has constant off time; reducing the voltage on the control pin lowers the on time, reducing the current in the inductor, and hence the output current. As the output voltage rises above the setpoint, Q2 starts to turn on, reducing the control voltage and thus the output voltage. R3, R4, and Q2's Vbe control the output voltage. In my circuit, R3 is series combination of 100k and another NE-2 bulb. (R5 and N1 are replaced by the oscillator circuit.) The use of the NE-2 in the regulator divider is mostly for convenience and aesthetic effect, but it will also stabilize the circuit against variation in Q2's Vbe with temperature.

The circuit, completed, on perfboard:

The finished circuit gets good efficiency — about 80%. It fits in one eyepiece of the goggles. The pair of coin cells last for many hours; I think about 15, but I haven't actually measured. It's more than one evening wearing them, though.

Construction tips: This should be a very forgiving circuit. It's tuned to the load intended (roughly one neon lamp in the feedback path, and another on the output). It won't work well far outside that range. Adding a third lamp will work, too many more won't (though appropriate adjustment of component values, and higher current batteries, would fix this). It will work just fine on a breadboard. The only important consideration is that the loop formed by Q1-D1-C3, which is where all the fast switching events occur, should be kept as small as possible. Because the output is current limited to fairly low values (thanks to the discontinuous mode) it should be relatively safe — touching the output should tingle but not cause injury. That said, it is a high voltage, and those can always be dangerous, so use caution. Please don't kill yourself with my circuits. In general, part substitutions should be fine, but pay attention to ratings. Q1 and D1 should be fast; aside from that, details aren't critical (though changing Q2 will likely require changing the feedback divider).

Parts list (Digikey PNs):

  • U1: 296-1857-5-ND
  • Q1: BS107AGOS-ND
  • Q2: 2N5089BU-ND
  • C1: BC1162CT-ND
  • C2: BC1019CT-ND
  • C3: 399-4285-ND
  • L1: M10011-ND
  • B1: P189-ND (2x)
  • Battery holder: BH800S-ND
  • 20090528

    On compasses and cyborgs

    I find senses and perception fascinating. The human brain is amazingly plastic; it can take input in a variety of ways, and process it however is appropriate. What set of nerves the data arrives on is a seemingly secondary consideration. This makes adding new senses — a must for any discerning cyborg — surprisingly easy. Wired had a fascinating article on the matter. The belt mentioned in the article is discussed online. Eventually, I decided I had to try building such a belt. Why bother looking at a compass when you can simply know which way is North?

    (I'll discuss a bit about the high-level design of the belt in this post; schematics and other details about working with the sensor will be in a future post.)

    It turns out that electronic compass sensing is actually somewhat complicated. The sensors tend to be complex, expensive, or inaccurate. I'll try to document the belt in a manner that makes it clear how to use only the sensor portion, in case you wanted to add a compass to your robot or something. I eventually decided on the KMZ52 from NXP (datasheet), available from Digikey (568-2426-1-ND) for $7.39. This sensor is complicated and a little more expensive than I'd like, but easily accurate enough. It's only available as a surface mount SOIC-16, which is a little awkward for breadboard prototyping. I soldered it to a prototyping board for simplicity — a little pricey, but easy to work with (I don't like designing a PCB for a first prototype!).

    The first version of the belt was a purely analog device (there's a newer version in progress; more on that later). For sake of simplicity, I also didn't make use of all the features available in the sensor. The end result was, as expected, rather finicky, with many potential areas of improvement. However, it did work — after a little training with it, you have a sense of North!

    The feelSpace belt was too complicated for my tastes in a variety of ways. First, I didn't want to use a microprocessor if I could avoid it. Second, I was certain I didn't need anything like 13 motors (even inexpensive vibrator motors, like the ones I chose, are pricey when you have that many). Secondly, having a 13-state digital output seemed weird to me. Orientation is analog data, and your brain likes analog inputs. I decided to go with just four motors. They would be spaced evenly around the waist, and each of them would vibrate at full strength when it was pointing due North, not at all when due South, and vary sinusoidally in between. This was (not coincidentally) a good match for the sensor output. The KMZ52 is a two-axis electronic compass. Each axis outputs a signal proportional to the field strength along that axis. That means that one motor would be at full strength when on axis was pointed due North, and its opposite number would have an inverted response on the same axis. The other two motors would do the same on the other axis. All of this is done with op amps and a few drive transistors for the motors.

    For various reasons, I ended up building the prototype version for my brother. I'll close with his thoughts on wearing it:

    Being augmented is a surprising feeling.

    When I'm paying attention to navigating, I'm now always conscious of a buzzing feeling which, despite being produced by four motors at four fixed spots, seems to simply move around my waist, always coming from the north.

    Living in a city whose streets are laid out on a grid (in many places), I tend to navigate by knowing compass directions... but I'm often pretty bad at knowing which way is which, and have in the past solved this problem by staring at shadows and estimating based on the time and limited knowledge of sundials which way they should be going. This works quite well... except that I get lost sometimes on cloudy days.

    With the belt on, I simply know which way north is. It's not because I pay attention to the moving buzzy feeling - it's just always there, so I know which way it is without taking the time to think about it. Perhaps unexpectedly, if I'm facing in one direction constantly even for thirty seconds my brain quickly tunes it out and I have no extra sense of north. But as soon as I move, I'm aware of directions again and my sixth sense returns. This means standing up when I've been at my computer for a while feels a little strange.

    The weirdest part of the experience, though, has got to be my new nervous habit.

    The belt needs to be degaussed periodically. There's a switch which you flip the other way and then return to its normal state in order to do this. Any time something gets the belt a little bit off, this is particularly necessary - and I notice such a thing on a subconscious level, when it happens. So something will feel jarring, I'll degauss and it will go away, and then I'll realize it's because I was standing next to a refrigerator for a while. But now I'm degaussing myself whenever something feels odd. "This soup tastes funny! Time to degauss!" "Holy crap what was that noise? Degauss!" "It feels weird not having my belt on. Deg- um, huh. That's vaguely unsettling."

    20090527

    Introduction

    For some time now, I've been designing and building circuits as a hobby. They're documented to varying degrees, in a variety of forms (photos, napkin schematics, forum posts), and with varying quality. I've started this blog primarily as a way to organize that information. Not uncommonly, I find myself writing an explanation of a circuit I've built, and wished it was simpler to just give a URL to one of the previous explanations I wrote. I'll still document in varying degrees of detail, but hopefully it will mostly be in one place. I'll be posting some about some older projects, and also about new ones as they come along.

    I work with both analog and digital circuits, but I'll basically only post about the analog ones here. The design of digital circuits just isn't as interesting -- anything complicated is handled by a specialty chip or a microprocessor. There's nothing wrong with that, and it's very useful, but I don't find it as interesting -- and there are a lot more people posting about it on the internet already. Analog design, on the other hand, is more complex and subtle, just as important to the hobbyist, and there's less about it on the Web already.

    By far the most interesting circuits combine the two domains. They do so in myriad ways, driven by the wide ranging sets of requirements on different sorts of circuits. These days, it is rare to see a circuit that operates purely in the analog domain. Microprocessors are so cheap, and can do so much, that there really isn't much point. But the environment they operate in is decidedly and unavoidably analog, and ignoring that aspect of the circuit leads to more errors, and subtler ones, than many hobbyists realize.