Advertisements

Avalanche Noise Amp

This lashes a pretty good avalanche noise source to an absolute dog of an op amp:

Noise Source - Schematic

Noise Source – Schematic

It’s built into the formerly vacant space on the 8×8 LED matrix board last seen generating random numbers by timing Geiger detector pulses:

Reverse-bias noise amplifier - overview

Reverse-bias noise amplifier – overview

The LM317 tweaks the reverse bias voltage to ram about 10 µA of DC current through the 2N2907A base-emitter junction; I picked that transistor because it has a 5.0 V breakdown spec that translates into about +8 V in reality, plus I have a few hundred lying around.

The 4.7 kΩ collector resistor sets the operating point of the 2N3904 NPN transistor at a bit over 6 V with a collector current of 1.6 mA, around which there appears ±500 mV of pure noise:

Noise - NPN C inv - op amp

Noise – NPN C inv – op amp

The 2N3904 spec says hFE > 100 and, indeed, I measure 200: 8 µA in, 1.6 mA out.

The bottom trace is the output of the first LM324. With a GBW of 1 MHz and a voltage gain of 10, it should have a cutoff at 100 kHz, but that’s obviously not true; the 0.5 V/µs large-signal slew rate just kills the response. The flat tops at 3.8 V show that it’s definitely not a rail-to-rail op amp.

The horizontal cursors mark the ATmega 328 minimum VIH and maximum VIL; the actual thresholds lie somewhere between those limits. What you don’t get is the crisp transition from a comparator.

The trimpot setting the logic level lets you tune for best picture; in this case, that means balancing the number of 0 and 1 bits. It’s a bit more complex, of course, about which, more later.

I picked the LM324 for pedagogic reasons; it’s a Circuit Cellar column and I get to explain how a nominally good analog circuit can unexpectedly ruin the results, unless you know what to look for…

Advertisements
  1. #1 by madbodger on 2015-09-28 - 10:48

    Ah, this is a subject that interests me on several fronts. While I doubt you’re going for cryptographic-quality random numbers, the subtleties that go into producing them are myriad and fascinating. I’m also fond of creative abuse of analog electronics, and when to do things like use op-amps as comparators and when not to. As an aside, I needed a sort-of random number recently for a project I’m working on, and discovered that the bluetooth interface (of all things) had a command to return one, meaning I could skip this sort of fun.

    • #2 by Red County Pete on 2015-09-28 - 11:30

      creative abuse/op-amps as comparators

      If Vin-diff is OK and you don’t mind the speed issues, go ahead. (Some opamps have limiting diodes that need respect.) We did stuff like that in the late ’70s on a millisecond resolution test box. 20 years later, I did the same thing elsewhere on a $150K automatic tester. Progress!

    • #3 by Ed on 2015-09-28 - 13:09

      Definitely not crypto-grade results from this one! The random numbers serve as a MacGuffin to talk about op amp parameters and why they matter, plus why stuffing a random circuit from the Interwebs with random components might produce, uh, non-random results.

      Not to mention: I get a show-n-tell object out of it…

  2. #4 by Red County Pete on 2015-09-28 - 10:57

    flat tops at 3.8 V

    Gotta watch those specs. When it’s in the electrical characteristics table as a min or max, it’s a hard limit. (Looks like max-Vout is 2 Vbe below Vcc. JFET/bipolar circuitry, I think.) For the GBW and slew rate, with typicals, I take a “trust but verify” attitude, and watch out for how they interact with the others.

    Are you putting a variation of RTFM in your article? I hope so. I’ve had a few experiences where the blurb in the first page on a sheet makes a part look attractive, only to find an issue that makes it non-suitable for the application. (Case in point, the LM395 aka “blow-out-proof transistor”, but with a 2V sat. In the small power amp project it would have been shutting down all the time…)

    • #5 by Ed on 2015-09-28 - 13:15

      a variation of RTFM

      Aye! My favorite was the MAX4372 high-side current monitor’s ±300 mV max differential input voltage across the sense resistor. I proved that a transient was perfectly capable of blowing the amp, before figuring out a decent protection circuit…

  3. #6 by David Pilling on 2015-09-28 - 21:05

    Could using the analogue comparator contained in the ATmega 328 make things simpler.

    • #7 by Ed on 2015-09-29 - 07:14

      Absolutely!

      It has lots of input offset and a surprising amount of delay, but should support a much higher sample rate. Biasing the AC-coupled noise from the 2N3904 at VCC/2 on AIN0 and feeding the DC bias into AIN1 should do the trick.

      I should tinker up something around that just to see how it works. The LED array might turn into a diffuse blur, though.

      I’ll add that as a homework assignment in the CC column… [grin]

      Thanks for reminding me…

  4. #8 by David Pilling on 2015-09-29 - 08:51

    Another idea would be to use the AT mega’s analogue outputs (pwm) do any “pot twiddling”. I recall back in the 70’s someone brought out a diode specifically to generate noise. Seems you can also use zeners (https://www.maximintegrated.com/en/app-notes/index.mvp/id/3469). I’d be tempted to calculate the value of Pi as a check on the randomness.

    • #9 by Ed on 2015-09-29 - 09:07

      Having wrestled with getting “real DC” from those low-resolution PWM outputs, I’d rather throw a real DAC at the problem and eliminate a whole class of annoyance.

      But you’re right about automating the pot twiddling. The code should monitor the long-term bias between the 00 and 11 sequences, then tweak the offset voltage to make the answer come out right.

      calculate the value of Pi

      Hmmm…

      Having a plotter draw the circle and ink the points as they’re calculated sounds a lot like an art installation!

      • #10 by madbodger on 2015-09-29 - 09:52

        I’d probably go with SPI controlled potentiometers instead of PWM or DACs. It would be nice to put the feedback loop in the microcontroller, and have it servo the values until the bias produced the desired distribution. Having done several electronic art projects, I love the idea of using the a plotter! They’re just satisfying devices to watch.

    • #11 by madbodger on 2015-09-29 - 10:03

      Noise sources are interesting. Zeners are easy to use and do a decent job (they’re actually noisier than gas tube voltage references at high voltages, but the gas tubes are prettier all lit up). Then again, you can make a dandy noise source out of a different gas tube: a small thyratron in a magnetic field produces gorgeous broadband noise – that’s what’s inside those old General Radio noise sources: a 6D4 and a magnet. Of course, Ed’s already done the fancy radioactivity-based source of randomness.

      • #12 by Red County Pete on 2015-09-30 - 09:44

        I worked on a project to build radiation hardened op-amps for a Jupiter probe. That approach failed, but the amps were great shot-noise sources… [wince]

      • #13 by Ed on 2015-09-30 - 10:30

        a 6D4 and a magnet

        There’s a box labeled “Hollow State Electronics” with some regulator tubes in the 0D3 family that should become art projects. They run at 100-ish volts and 5 mA (= 500 mW) after they’re warmed up, but need a 150-ish V / 100 mA kick for 10 seconds to start.

        Screwing an old transformer to the case would be cheating…

        • #14 by madbodger on 2015-09-30 - 11:35

          There are lots of fun ways to come up with a couple hundred volts…

          • #15 by Ed on 2015-09-30 - 13:13

            Some of which might not kill me stone cold dead, too!

  1. 0D3 Voltage Regulator Tube | The Smell of Molten Projects in the Morning