Author Topic: Crazy idea: neon lamp random-number generator  (Read 2641 times)

0 Members and 3 Guests are viewing this topic.

Offline Analog KidTopic starter

  • Super Contributor
  • ***
  • Posts: 4940
  • Country: us
  • DANDY fan (Discretes Are Not Dead Yet)
Crazy idea: neon lamp random-number generator
« on: August 23, 2026, 03:22:23 am »
I like playing with neon bulbs. I've built a couple "nothing boxes", blinky lights, and am always struck by how ... random they seem.

Which gave me an idea: what if a guy strung together, oh, let's say 16 of them, let each one represent a bit of a number and use them as an actual randon-number generator?

This idea probably isn't original with me, but I haven't seen it described anywhere.

A small simulation shows the periodic waveform (.asc file attached below):



2882888-1

This would be one "cell", one bit of the number.
It would need either a Schmitt trigger or some other squaring mechanism to produce either a "1" or a "0".
That part of the circuit would be somewhat crucial, as it would need to be as "fair" as possible, not weighted towards either state. I don't know how to do that, but I'm sure others here do.

So you take 16 of these cells and combine them:



When you enable the latch you get what should be a pretty random number. Maybe.
 

Offline Andy Chee

  • Super Contributor
  • ***
  • Posts: 2099
  • Country: au
Re: Crazy idea: neon lamp random-number generator
« Reply #1 on: August 23, 2026, 03:58:49 am »
You don't need multiple neons or "cells".  A single neon can generate any arbitrary length random number.

The basic principle is illustrated here;

https://www.mtmscientific.com/rng.html

Your single neon would take the place of the 2N3904 noise source (the one with the collector lead disconnected).

Not as fancy as Cloudflare's lava lamp RNG though

https://en.wikipedia.org/wiki/Lavarand
 

Offline Analog KidTopic starter

  • Super Contributor
  • ***
  • Posts: 4940
  • Country: us
  • DANDY fan (Discretes Are Not Dead Yet)
Re: Crazy idea: neon lamp random-number generator
« Reply #2 on: August 23, 2026, 04:21:07 am »
Yes, thanks for that. However, my idea doesn't require a microprocessor to produce the random #s.
Of course, it would need to be connected to some kind of computah to capture those #s.

I'd be curious to see just how random those #s might be.

Anyone have an idea for how to square those waveforms? I need a very clean "1" or "0", equally weighted.
 

Offline Andy Chee

  • Super Contributor
  • ***
  • Posts: 2099
  • Country: au
Re: Crazy idea: neon lamp random-number generator
« Reply #3 on: August 23, 2026, 04:30:16 am »
Yes, thanks for that. However, my idea doesn't require a microprocessor to produce the random #s.
Of course, it would need to be connected to some kind of computah to capture those #s.

I'd be curious to see just how random those #s might be.

Anyone have an idea for how to square those waveforms? I need a very clean "1" or "0", equally weighted.
You need to examine the circuit again.  The uP is NOT the source of randomness.  The 2N3904 is the source of randomness.  The uP is simply converting the random noise to serial data format suitable for viewing in a VT100 or ASCII terminal or similar.

Basic principle is to feed the randomly fluctuating AC voltage through a capacitor, then bias the capacitor junction with, say 1V, so the voltage will randomly swing above and below 1V.  Then you use a comparator with one input connected to this bias point, and the other input connected to a solid 1V reference.  In this case, the comparator is within the uP.

This "random" signal from the comparator output then feeds the D input of an N-bit binary counter, the clock input of the counter is connected to a standard crystal oscillator or the local system clock.

Ultimately, to quantify the randomness you will need to test it with something like;

https://webhome.phy.duke.edu/~rgb/General/dieharder.php

FWIW, the bit length is irrelevant to randomness.  You can make a 1-bit random generator, and it would be equally as good as a 1024-bit RNG (or equally as bad).
« Last Edit: August 23, 2026, 05:02:59 am by Andy Chee »
 

Online ledtester

  • Super Contributor
  • ***
  • Posts: 4167
  • Country: us
Re: Crazy idea: neon lamp random-number generator
« Reply #4 on: August 23, 2026, 04:42:27 am »
This would be one "cell", one bit of the number.
It would need either a Schmitt trigger or some other squaring mechanism to produce either a "1" or a "0".
That part of the circuit would be somewhat crucial, as it would need to be as "fair" as possible, not weighted towards either state. I don't know how to do that, but I'm sure others here do.

Use the von Neumann algorithm:

https://raw.org/math/make-a-fair-coin-from-a-biased-coin/
 

Offline Andy Chee

  • Super Contributor
  • ***
  • Posts: 2099
  • Country: au
Re: Crazy idea: neon lamp random-number generator
« Reply #5 on: August 23, 2026, 05:07:41 am »
As a simple experiment, you could connect your neon to your soundcard input (via overvoltage protection if you wish).

Use Audacity sound recording software to record the noise.  Use Audacity to also do thresholding to convert the noise into binary.

You can use MATLAB/Octave to sample from the soundcard as well.
 

Offline abeyer

  • Frequent Contributor
  • **
  • Posts: 943
  • Country: us
Re: Crazy idea: neon lamp random-number generator
« Reply #6 on: August 23, 2026, 06:56:08 am »
Use the von Neumann algorithm:

Doesn't that still assume a fixed constant bias? I'm not sure that would necessarily be true... though perhaps close enough to not matter too much?
 

Offline MariuszD

  • Frequent Contributor
  • **
  • Posts: 685
  • Country: pl
Re: Crazy idea: neon lamp random-number generator
« Reply #7 on: August 23, 2026, 08:30:21 am »
You must ensure that nothing penetrates between the oscillators, both through power, and light. Oscillators have the property that even minuscule amounts of energy leaking between them lead to synchronization.
 
The following users thanked this post: Dave, voltsandjolts, Ian.M

Online ledtester

  • Super Contributor
  • ***
  • Posts: 4167
  • Country: us
Re: Crazy idea: neon lamp random-number generator
« Reply #8 on: August 23, 2026, 09:02:33 am »
Use the von Neumann algorithm:

Doesn't that still assume a fixed constant bias? I'm not sure that would necessarily be true... though perhaps close enough to not matter too much?

Well, bias is something that is measured over a large number of samples.

The algorithm doesn't have any memory. So if during one hour the probability of getting a heads is say p = 0.49 and the next hour the probability changes to p = 0.51, the algorithm will continue to produce, statistically, 50% heads and 50% tails.
 

Online Gyro

  • Super Contributor
  • ***
  • Posts: 11159
  • Country: gb
Re: Crazy idea: neon lamp random-number generator
« Reply #9 on: August 23, 2026, 09:55:41 am »
Neon lamps were used as the random source for the original UK Premium Bond draw computer (ERNIE) back in 1956.


Edit: Looking on Wikipedia, ERNIE 1, 2, and (uncertain) 3 used Neon. ERNIE 4 moved to transistor 'thermal' (VEB avalanche?) noise. The current ERNIE 5 has gone quantum.:scared:  Lots of statistical analysis has gone into each of the machines, on a regular basis.
« Last Edit: August 23, 2026, 10:59:11 am by Gyro »
Best Regards, Chris
 
The following users thanked this post: voltsandjolts

Offline Analog KidTopic starter

  • Super Contributor
  • ***
  • Posts: 4940
  • Country: us
  • DANDY fan (Discretes Are Not Dead Yet)
Re: Crazy idea: neon lamp random-number generator
« Reply #10 on: August 23, 2026, 06:57:42 pm »
It's still quite early for me in this "project". I'm still liking the idea of 16 separate neon bulb "cells" (for one thing, who among us doesn't like blinky lights?).

I think I might breadboard this up, see what kind of result I get.

I'm thinking of just using some hex inverters I happen to have to square things up, so I'll rig up a 5 volt supply from my 170 VDC source (voltage divider--> 7805 regulator).

The latch part is still unknown; have to look up some chips, then see if I can get them (hopefully from my fave supplier, Jameco).

What I don't like about using the von Neumann approach is that it requires computation.
I'm trying to make this a stand-alone module that only requires a computah to enable its register (latch) and get a 16-bit random value in return.

It all looks like fun to me.
 

Offline Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 5355
  • Country: nl
Re: Crazy idea: neon lamp random-number generator
« Reply #11 on: August 23, 2026, 09:44:55 pm »
This can be a fun / learning experience, but it's not really practical for real life applications.

There are also huge differences in the randomness of an RNG. A RNG that has to be proven to be random and cryptographic correct / secure is very different from a random number generator that for example adds delays when a whole network of microcontrollers boots up or playing gooseboard.

I don't like the idea of using 16 of those lights at all. It just adds a lot of hardware without adding anything to the function. I don't like the idea of playing around with 170V either.
« Last Edit: August 23, 2026, 09:54:22 pm by Doctorandus_P »
 

Offline Analog KidTopic starter

  • Super Contributor
  • ***
  • Posts: 4940
  • Country: us
  • DANDY fan (Discretes Are Not Dead Yet)
Re: Crazy idea: neon lamp random-number generator
« Reply #12 on: August 23, 2026, 09:59:48 pm »
Your objections have been noted.
And ignored.

I like blinky lights.
I like playing with high voltage.

You don't have to like any of it. I'm not seeking your approval here, thank you very much.
« Last Edit: August 23, 2026, 10:10:06 pm by Analog Kid »
 

Offline twospoons

  • Frequent Contributor
  • **
  • Posts: 327
  • Country: nz
Re: Crazy idea: neon lamp random-number generator
« Reply #13 on: August 23, 2026, 10:17:29 pm »

I like blinky lights.
I like playing with high voltage.


Me too!
Build it, and post some pics please.  Would love to see it running.
 

Offline Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 5355
  • Country: nl
Re: Crazy idea: neon lamp random-number generator
« Reply #14 on: August 23, 2026, 10:36:40 pm »
Your objections have been noted.
And ignored.

I did not really expect another reaction.
I am sort of curious what you will do do do it "safely" and/or whether that is any concern to you.

Some pictures of the finished / working project could be nice.
 

Offline Analog KidTopic starter

  • Super Contributor
  • ***
  • Posts: 4940
  • Country: us
  • DANDY fan (Discretes Are Not Dead Yet)
Re: Crazy idea: neon lamp random-number generator
« Reply #15 on: August 23, 2026, 11:31:28 pm »
I am sort of curious what you will do do do it "safely" and/or whether that is any concern to you.

What, do you think I'm going to willy-nilly wire up a HV supply, wires sprawling everywhere, oblivious to the danger?

IOW, do you think I'm a total idiot?

Maybe I should wear safety goggles like in all the OSHA-approved pictures we all see. And a respirator.
Maybe a Faraday cage too?
 

Offline Andy Chee

  • Super Contributor
  • ***
  • Posts: 2099
  • Country: au
Re: Crazy idea: neon lamp random-number generator
« Reply #16 on: August 24, 2026, 01:45:51 am »
What I don't like about using the von Neumann approach is that it requires computation.
I'm trying to make this a stand-alone module that only requires a computah to enable its register (latch) and get a 16-bit random value in return.
Do you even understand why Von Neumann correction is required?  All noise sources are biased, including your proposed neon.  The von Neumann correction debiases it.  You won't be able to debias it using strictly electronic hardware components, trimmer pots/capacitors and the like.  This is a statistical phenomenon inherent with imperfect hardware.

That said, if you don't mind a biased random number generator, you can forgo the correction.  Just don't be surprised if statistical analysis shows a systematic pattern to your numbers.  You are planning to analyse the output for randomness quality aren't you?  Otherwise what's the point of this exercise other than a lame excuse to light up neons.  Might as well just build a neon chaser.

Also how do you propose to get your 16-bit random value into a computer without using a microprocessor?  Are you planning to interface the 16-bit PCI/ISA bus directly by connecting to the slot on the PC motherboard?

Perhaps you'll just ignore these issues.
« Last Edit: August 24, 2026, 01:52:27 am by Andy Chee »
 

Offline Analog KidTopic starter

  • Super Contributor
  • ***
  • Posts: 4940
  • Country: us
  • DANDY fan (Discretes Are Not Dead Yet)
Re: Crazy idea: neon lamp random-number generator
« Reply #17 on: August 24, 2026, 02:19:13 am »
To be honest, I haven't thought all those things through.
I am permitted to dream up a project without dotting all my "i"s and crossing all my "t"s, aren't I?

Regarding how to get the data to a computah, yes, I suppose I'd need a microprocessor.
The last time I messed with something like this I did have one, a SX-28. Which I still have, but I have no programmer for it.

I guess I could try to serialize the data and use a RS-232 port, but that would be complicated.

I'll scratch my head some more, see what I can come up with. Sound card input might work (but would require serialized data).

I certainly would want to measure its randomness. I have my own software that can do that.

Any other criticisms while we're at it?
 

Offline Andy Chee

  • Super Contributor
  • ***
  • Posts: 2099
  • Country: au
Re: Crazy idea: neon lamp random-number generator
« Reply #18 on: August 24, 2026, 02:30:27 am »
To be honest, I haven't thought all those things through.
I am permitted to dream up a project without dotting all my "i"s and crossing all my "t"s, aren't I?

I certainly would want to measure its randomness. I have my own software that can do that.

Any other criticisms while we're at it?
You are not permitted to dismiss ideas until you have thought them through.

For example, you immediately dismissed the microprocessor at the beginning of the thread, but now realise you may need one!

Here's another thing to consider;  have you tested your software to ensure itself is not biased?  Have you tested it on a random number generator that is known to have high quality randomness? 

Given your immediate dismissal of von Neumann, I highly doubt your software is up for the task.
 

Offline Analog KidTopic starter

  • Super Contributor
  • ***
  • Posts: 4940
  • Country: us
  • DANDY fan (Discretes Are Not Dead Yet)
Re: Crazy idea: neon lamp random-number generator
« Reply #19 on: August 24, 2026, 02:38:00 am »
You are not permitted to dismiss ideas until you have thought them through.

For example, you immediately dismissed the microprocessor at the beginning of the thread, but now realise you may need one!

Alright, so I fucked up.
So sue me.
 

Online mawyatt

  • Super Contributor
  • ***
  • Posts: 6115
  • Country: us
Re: Crazy idea: neon lamp random-number generator
« Reply #20 on: August 24, 2026, 02:46:32 am »
The idea of neon based oscillators synching up is what led to Van der-Pol work with Non Linear Oscillator Analysis and Injection Locking.

https://www.eevblog.com/forum/projects/simple-sinusoidal-oscillators/msg4282486/#msg4282486

"Edit: Injection locking is a fascinating subject, dated back to the discovery by Van der Pol when experimenting with Neon bulb relaxation oscillators. He noted that two Neon oscillators became locked (same flashing rate) when they had a common connection thru the power supply (slight coupling). Much later Adler in 1946 derived the fundamental equations describing injection locking. What we discovered and patented based upon Van der Pol and Adlers work was that the injection locking concept also produces a demodulation of the injected signal, that can be utilized to perform AM, FM or PM demodulation, and subsequently developed a single (silicon) chip Microwave receiver based upon this technique."

Best
Curiosity killed the cat, also depleted my wallet!
~Wyatt Labs by Mike~
 
The following users thanked this post: Analog Kid

Online PCB.Wiz

  • Super Contributor
  • ***
  • Posts: 3352
  • Country: au
Re: Crazy idea: neon lamp random-number generator
« Reply #21 on: August 24, 2026, 03:27:10 am »
Regarding how to get the data to a computah, yes, I suppose I'd need a microprocessor.
The last time I messed with something like this I did have one, a SX-28. Which I still have, but I have no programmer for it.

The simplest way would be to use a AliExpress Logic Analyser module board like this
https://www.aliexpress.com/item/1005012902500329.html

You would use a series RC to AC couple the offset voltage of the Neon waveform, and read the capture patterns on the PC.
The ~ 20V p-p could be reduced either by clamping, or by attenuation.

Given the Neon light and voltage triggering effects, one would expect adjacent neons to seed each other optically, and any sharing  power supply or cables could seed each other electrically too.

Sounds like almost random would be the outcome.  Could be fun to plot. 8)

 

Online SteveThackery

  • Super Contributor
  • ***
  • Posts: 3362
  • Country: gb
  • 50 year novice
Re: Crazy idea: neon lamp random-number generator
« Reply #22 on: August 24, 2026, 09:26:28 am »
I guess I could try to serialize the data and use a RS-232 port, but that would be complicated.

Although, I guess if you serialised it, you could just use one neon again. Not nearly as much fun, though.
 

Offline geggi1

  • Frequent Contributor
  • **
  • Posts: 498
Re: Crazy idea: neon lamp random-number generator
« Reply #23 on: August 24, 2026, 10:18:30 am »
Basically you can use any noise-source as a random number generator together with ADC to make a random numbers generator.
Back in the 60 and 70s the US military used intergalactic or RF noise to generate cryptographic keys. It is a long time ago since i read the article about this but it might have been the frequency of the hydrogen line.

 
 

Offline Analog KidTopic starter

  • Super Contributor
  • ***
  • Posts: 4940
  • Country: us
  • DANDY fan (Discretes Are Not Dead Yet)
Re: Crazy idea: neon lamp random-number generator
« Reply #24 on: August 24, 2026, 07:45:41 pm »
The simplest way would be to use a AliExpress Logic Analyser module board like this
https://www.aliexpress.com/item/1005012902500329.html

I looked at that, and it's interesting (and $cheap$), but I'm not sure exactly what it does.

What does it do?

Looks like a dedicated microprocessor of some kind.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

-->