Random Signal Generator for 14 Segment Display

Thread Starter

SamuelInca

Joined Jan 23, 2019
8
Greetings everyone!

I'm working on a personal project, but I'm having some trouble designing a random signal generator, so I figured this forum was a good place to start.

I need to construct a (pseudo)random signal generator connected to a 18 DIP alphanumeric LED display. The process would as follows:
1. Press a button
2. Generate a random arrangement of segments (not numbers or characters)
3. Keep the generated arrangement on the screen until the button is pressed again

I've found several designs for random signal generators online:
https://electronicsclub.info/p_random.htm
https://makezine.com/projects/really-really-random-number-generator/

but none that I can use. I'm hoping to fit all the circuitry into a tiny 2x2x2 in cube, but I admit that it may be a pipe dream...

I know next to nothing when it comes to circuits (I've never even owned a breadboard), but I've wanted to build this contraption for a long time, so I'd appreciate any and all ideas on how to make this thing.

Thanks!
 

Thread Starter

SamuelInca

Joined Jan 23, 2019
8
https://electronicsclub.info/p_random.htm

I was under the impression that the creator said it wasn't actually random, and that circuit generated a continuous random signal to the LED's, which seemed similar, but I'm not sure how I would modify it.

When I was looking at it, I figured I could just link the pins of the display where it has the LED's, but I don't know what the added resistance would do to the circuit. I'm sorry, I'm not familiar with any of this really...

How hard would it be to modify the circuit to generate a random signal when the button is held, and sustain it once released? Or is that already taken care of in the display itself?
 

Thread Starter

SamuelInca

Joined Jan 23, 2019
8
I'm also trying to figure out if I could use a 3V watch battery instead. I think I could recalculate the resistors, but would the circuit even function at that power?
But I could just use like, 3 right? In a string would increase the voltage enough I think.
 

AnalogKid

Joined Aug 1, 2013
10,986
https://electronicsclub.info/p_random.htm

I vote for this one. Technically it is a non-random repeating pattern, but it repeats so quickly compared to human finger pushing that it is an excellent approximation of an RNG without way fewer parts and complexity. A CD4060 can replace both ICs for even fewer parts. If the oscillator is running a little over 1 MHz and the display is a standard 7-segment type, the slowest segment is changing 8 times per *millisecond*. When controlled by a person pressing a bouncy pushbutton, that's very random.

What do you mean by "18 DIP alphanumeric LED display"? How many segments? Part number? Datasheet?

ak
 

MisterBill2

Joined Jan 23, 2018
18,167
Definitely a CD4060 driving the pins of a display would create random patterns if it were clocked fast and not reset. And with contact bounce not prevented it would not be guessable. Use one of those clock oscillator devices and forget designing an oscillator. Not truly random numbers but certainly non-predictable. It would need to run on at least 5 volts, to have an adequate drive for the display.
 

MisterBill2

Joined Jan 23, 2018
18,167
OK, that device has a common anode,(+ terminal), so it will need pull-downs to light the segments. That will require CD4049 hex inverters, which have good sinking ability. two digits with 14 segments each is 28 segments and 2 decimal points total of 30, if all are driven independently. That will require 5 of the six-inverter packages, and probably two of the binary counter IC's. But it will still be a simple system. And the other good news is that a single resistor for each anode connection makes that part simpler. Probably the device can run on a string of three "D"batteries, if a CMOS clock oscillator is used.
 

AnalogKid

Joined Aug 1, 2013
10,986
(Ignoring the decimal points) The simple high-speed counter method will not work with this display. With 28 segments, you would need a 27 GHz clock to have 10 ms changes of the slowest segment. A 32-bit LFSR (linear feedback shift register) will give the best results with a much more reasonable clock freq. An expanded version of the makezine link is another option.

Because of the relatively high output pin count, a uC probably doesn't get you anything. Either circuit would fit in a small CPLD.

ak
 

MisterBill2

Joined Jan 23, 2018
18,167
OK, but the two counters could be clocked in parallel and reduce the count frequency, or possibly use more binary counters. If the counters did not get reset then it would be more random.
 

djsfantasi

Joined Apr 11, 2010
9,156
(Ignoring the decimal points) The simple high-speed counter method will not work with this display. With 28 segments, you would need a 27 GHz clock to have 10 ms changes of the slowest segment. A 32-bit LFSR (linear feedback shift register) will give the best results with a much more reasonable clock freq. An expanded version of the makezine link is another option.

Because of the relatively high output pin count, a uC probably doesn't get you anything. Either circuit would fit in a small CPLD.

ak
Four 74HC595 serial to parallel shift registers would work with a uC...

Use a random() function in the uC to continuously generate an unsigned long value. Program it to interrupt on an edge of a button press. The ISR would then save the last random value and clock/shift it out to the 74HC595 shift registers. With 32 bits available, there are sufficient outputs available to drive the 28 segments of the two displays.
 
Last edited:

Thread Starter

SamuelInca

Joined Jan 23, 2019
8
Ok, there's a lot to unpack here...

Either circuit would fit in a small CPLD
It sounds like you are saying I could design a PCB to house all the circuitry for me instead of free-handing it, which would allow me to fit it into my 2x2x2 in cube. I've downloaded a simulator called EasyEDA to map out some of these circuits.


The simple high-speed counter method will not work with this display. With 28 segments, you would need a 27 GHz clock to have 10 ms changes of the slowest segment. A 32-bit LFSR (linear feedback shift register) will give the best results with a much more reasonable clock freq. An expanded version of the makezine link is another option.
So I would need to replace the 555 timer and the 4026 counter because the clock frequency is too high or too low? Are would 32-bit LFSR provide the 27 GHz you mentioned earlier? and which part does it replace, the 555, 4026, or both?


Four 74HC595 serial to parallel shift registers would work with a uC...

Use a random() function in the uC to continuously generate an unsigned long value. Program it to interrupt on an edge of a button press. The ISR would then save the last random value and clock/shift it out to the 74HC595 shift registers. With 32 bits available, there are sufficient outputs available to drive the 28 segments of the two displays.
What would the Four 74HC595 be replacing? and if using a random() function uC refers to programming of the microcontroller, I'm not sure how to do that... it that something I could do with this EDA application, or would it be something I do after the Chip has been manufactured? Also, how random is the random() function in this uC?

There is a lot of this that I still don't understand, I spent 2 hours cullling through the internet just to process these responses... Thank you all so much for the feedback, even if I don't know all these terms yet :)
 

djsfantasi

Joined Apr 11, 2010
9,156
What would the Four 74HC595 be replacing? and if using a random() function uC refers to programming of the microcontroller, I'm not sure how to do that... it that something I could do with this EDA application, or would it be something I do after the Chip has been manufactured? Also, how random is the random() function in this uC?
The 74HC595 chips would replace whatever you are planning on connecting the segments to.

The uP replaces everything else (except the push button).

How this works is that you test a value from the random() function and set a bit to “1” or “0”, depending on the value. This is where your programming skill comes in.

The random() function is an unsigned long integer. 32 bits. In Arduino C, you can specify a min and max value. If the max were 2^28, you’d have all your segments.

Then, you would check for a button press while continuing to generate random numbers.

Once the button is pressed, save the random value and do the following.

Mask out the rightmost bit and save it. Shift the entire value right by one bit. That is, divide by 2. Send the saved bit (by writing to a pin on the uP) to the ‘595. The chip is a shift register. That means that you shift the previous set of random bits left by “clocking” the ‘595. This is another write to a different pin. Repeat 28 times for all 28 bits.

Then resume generating random numbers as fast as the uP can.

The ‘595 chips can be connected together, so that as a bit is shifted out of one, it appears on the next. And so on.

There are 32 bits in the four shift registers, so you have enough for your 28 segments.

I use Arduini uP. They have their limitations, but one is NOT being easy to use. The Nano would be a good fit for you.

You write the code with the free development environment on your computer. Then, a USB cable is used to transfer your code to the Nano. It supports a provided, free serial console, that you can display values and steps in order to debug your code.

The Nano is small enough to fit in your space, with enough room for a circuit board containing the shift registers.
 

Thread Starter

SamuelInca

Joined Jan 23, 2019
8
OK, This is starting to make sense, I think.

Thank you for the very clear explanation djsfantasi, Its just what I needed.

The Nano look like it would be a good fit for this. I think that will be my next step. It's on Amazon at 2 for 15.99 which I will probably need, as my first ever circuitry project, I'm bound to brick one of them.

That takes care of the μP and USB to MicroB USB connections to get it programmed in my computer, the next step would be attaching the 74HC595 chips in series, which I assume I'll need a good soldering set to do.

After that, I'll need 2 3V Watch batteries to power it internally, as well as an on off switch, and some way to connect it to the μP.

Then I need a small push button, and the actual LED display.

and finally, the casing to house all the parts, which I can make with my 3d printer.

So the item list is as follows:
Do these items look right, Do you think they will all fit in a 2x2x2 in cube, and are there any extraneous wires you think I'll need? I am starting with literally zero parts to my name.
 

djsfantasi

Joined Apr 11, 2010
9,156
A Nano is 1.7”x0.73”. It’ll fit into a cube.

The shift registers are 0.394”x0.157”. Four won’t take up much space.

Now it depends on the batteries, display and push button. I think you can get it to fit b

You look like you’ll need some development printed circuit boards. To attach the shift registers and to wire up your segments. O

Oh, and yes! The Arduino programming software is free.
 

Thread Starter

SamuelInca

Joined Jan 23, 2019
8
Great!
Oh, you mentioned the shift registers can be connected together, what would I need for that? come to think of it, I'll probably need wires for all the connections, I'm not attaching anything directly to the μP with just solder.

Any idea of what wire or other small connector I would need to use?
 

Thread Starter

SamuelInca

Joined Jan 23, 2019
8
I'll add 24 gauge hookup wire and wire strippers to my list.

Thank you all so much, especially you, djsfantasi. You all have been incredibly helpful!

I'll post back here if I have any more questions during its development.
 
Top