Maker Pro
Maker Pro

random signal generator

Franz Schubert

Oct 22, 2014
3
Joined
Oct 22, 2014
Messages
3
hello

I would like to construct a circuit where by a signal is sent to light up an LED, and after a variable delay, fire up another LED, and then another, and another, and another (maybe 15-20 LEDs in total) and continue indefinitely.

However, the signal would have to be random, so that one is unable to predict which LED will fire next.

basically I want to build my own little reflex training board.

I've built a similar device as part of a highschool project a long time ago, but that was just an alternating signal with a potentiometer knob, and not a randomized one.

similarly, if each LED could also be a switch that needs to be pressed before the next signal is sent, that is also an option I'd like to explore.


regards
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
Hi Franz, and welcome to the forum!

That is easily doable with a microcontroller, not so much without. What level of experience do have?

Bob
 

Franz Schubert

Oct 22, 2014
3
Joined
Oct 22, 2014
Messages
3
Hi Bob

thanks for the quick reply.

I have basic knowledge of electronics and circuitry. My highschool class many moons ago was the only real experience but I'm pretty good with a soldering iron and follow instructions/schematics very well.
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
What about microcontrollers and programming?

Bob
 

hevans1944

Hop - AC8NS
Jun 21, 2012
4,886
Joined
Jun 21, 2012
Messages
4,886
I agree that a microcontroller is the logical approach. True randomness is hard to come by, but for HMI (human-machine-interaction) the short-term memory of human beings plays a strong hand in just how random a sequence needs to be to be completely unpredictable by a human. There are software algorithms to generate pseudo-random sequences based on a starting "seed" that will repeat after, say, 1024 sequential words. That may be overkill. Probably 32 to 64 sequential words would be sufficient.

I once built a device for use by the psychology department at the university I attended. It generated six tone sequences of variable pitch and length from data punched on a Hollerith card. The subject was presented with six buttons plus a seventh "trial" button. Pressing the "trial" button would select one of the six sequences and then the subject had to discover which of the six "test" buttons produced the same sequence. The test ended when the subject successfully identified the "test" button that matched the "trial" button sequence. We recorded the time and the button pushes (with a strip-chart thermal pen recorder IIRC) for later analysis. This prototype machine was constructed entirely with TTL components, with a PLL precision tone generator driving a sine-shaper for the audio output.

A second machine was eventually designed and built based on a microprocessor and a digital cassette drive to load the preset tone sequences and later record the button pushes. Today I would use a laptop computer, thumb drive, and a USB serial interface to the button interface hardware. The PC sound card would generate the tone sequences.

I mention this to illustrate the limitations of human short-term memory. Each tone sequence was like Morse code consisting of variable length tones and spaces. The tones were not necessarily at a constant pitch throughout the sequence, although their level didn't vary. The duration of each sequence was fixed for the duration of the test, but the operator (not the subject) could vary the duration, i.e., how fast the tones were presented. In testing this contraption I marveled at how difficult the task was to memorize the "trial" sequence, hold that in short term memory while I pressed each "test" button in sequence, and try to compare what I was hearing with what I had heard. I will not even discuss how well I performed, but suffice to say that this was a truly diabolical test to administer to grade-school and pre-school children, who probably did better than adults.

The hypothesis they were testing was whether children could be divided into two groups: reflexive or impulsive. Presumably, "reflexive" children were better learners than "impulsive" children. This was also a longitudinal study lasting several years as they followed the progress of each student. And different learning modalities besides the auditory modality were tested too. A similar test had six different "test" pictures hidden behind doors with a "trial" picture (identical to one of them) also hidden behind a door. Only one door could be opened at a time. Thank goodness they were able to construct that one themselves with simple carpentry and springs to hold the doors closed. I think today I would build that one with a laptop computer too. There was also a haptic modality test involving blind holes the subject stuck their hand in to feel the shape or perhaps texture of a "test" object to compare against the "trial" object. And maybe other modalities too. I graduated shortly after the second auditory modality test set was completed and went on to other things.

It might be fun to program a microcontroller for your project. More details please.
 
Last edited:

Laplace

Apr 4, 2010
1,252
Joined
Apr 4, 2010
Messages
1,252
A microcontroller would be a good approach if you are proficient in that area or wish to become proficient. Otherwise, a 4-bit binary counter and 4-to-16 line latched decoder (CD4514) is fairly simple. Running the counter from a high speed clock and latching the count with a pushbutton will give the appearance of a random sequence. For continuous display, use several 555 timers at very low frequency logically combined to generate the latching signal.
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,743
Joined
Nov 17, 2011
Messages
13,743
When you use a pseudo random number generator you should generally look for a proven algorithm. You'll find lots of code on the internet. Stay away from designing your own "improved" pseudo random number generator. Read this Wikipedia article for some background information.

As your application is surely not critical (with respect to distribution, randomness etc. of the pseudo random numbers), a simple linear congruential generator surely will suffice. Here are some code examples.
 

Franz Schubert

Oct 22, 2014
3
Joined
Oct 22, 2014
Messages
3
I must say, I'm probably going well over my head here. My programming knowledge is zilch. Although I do have friends that work in the coding field, I suppose I could always call on their help.

It is a character flaw in that I'm unable to conceptualize the power of electricity. I can build and repair things no problem, but the why and the how often elude me.


at it's roots, I want to build a device that I can use to improve my reflexes in a specific way without a) spending a ridiculous amount of money for already existing, ready-made systems and b) not having to go somewhere (such as a training facility) to use them.

While the already-built systems are impressive (with wireless control and programmable modes), I certainly will be satisfied with a basic "random light" system.

I've made a drawing

11htdzr.gif


basically by turning the system on, the lights start firing in a random order, and i'll concur that I probably don't need "true" randomness as I doubt I'd be able to detect a patterns over a specific scale.

and a knob that can adjust the frequency of the firing delay. A usable range would probably between 0.5 and 3 seconds?

options that I wouldn't mind:

- having the lights with a button, so that the next light only comes on after I press the one that just did (sort of like a sequential whack-a-mole)
- having the time gap between the lights variable within a specified range


again, if there is more work involved than I'm capable off then i'll just put it aside, but if the schematics to something like this are relatively simple and the parts cheap, I wouldn't mind giving it a crack.
 

hevans1944

Hop - AC8NS
Jun 21, 2012
4,886
Joined
Jun 21, 2012
Messages
4,886
An ancient stepping switch with lights wired to it in a "random" sequence comes to mind... IIRC I saw such a contraption demonstrated at a science fair when I was a youth. Impressive with all the incandescent lights "randomly" flashing and the switches clacking.

The sound of a stepper switch, which were once used in dial-up telephone exchanges to select trunk lines, is unmistakable and unforgettable! OTOH, I do like @Laplace suggestion to use a counter and latched decoder as the practical, if somewhat vanilla, solution.

The Whack-a-Mole analogy is apropos: one light on at a time; push the button on that light and it goes out; after a variable delay another light comes on in "random" order.
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,743
Joined
Nov 17, 2011
Messages
13,743
A discrete solution comes to mind:

Circuit setup:
  • Use a 74HC4017 decimal counter.
  • Use a pushbutton with a debouncing logic (see here, page 11). Connect the output of the pushbutton to the input of a monostable multivibrator, e.g. built from a 555 timer IC.
  • Use an inverter to create a negative clock pulse from the output of the multivibrator.
  • Connect the output of the inverter to the clock input of the 4017.
  • Use a second pushbutton conected to the MR input for resetting the circuit (this one doesn't need debouncing).
  • Add a driver (simple transistor stage, see ressources forum) to each output to provide enough current for LEDs or small lamps.The output of the driver would be at0V when on, so the other pin of the lamp/LED would have to be connected to the positive supply. For LEDs use series resistors, see also the ressources forum.
  • Connect the outputs of the drivers to banana receptacles (aka 4mm sockets or whatever you call them).
  • Build a holder for 10 lamps or LEDs.
  • Connect one pin of each lamp/LED to the common positive supply (so all lamps are have one pin connected together and to the positive supply).
  • Connect a suitable length of wire to the other pin of each lamp/LED, terminateeach of these wirse with a 4mm banana plug. DO not use color coded wires, al wires should be of the same color.

Operation:
  • Before each game/training session connect the wires to the drivers in a random fashion.
  • Reset the 74HC4017 by pressing the MR button.
  • One light will turn on press the clock button to advance to the next ligtht. Note that the first light will come on immediately at pressing MR, so it will not count for your timing measurements.
  • Press the clock button. After the period of the monostable multivibrator expires, the next lamp will turn on, the game continues.

This method works without any microcontroller. It requires some digital logic and analog ciruitry instead. It also relies on you mixing the lamp connections in a truly random fashion.
 
Top