-ReadMe-
With this circuit we can check how long it takes to repeat a sequence. Due to the lack of space I could not implement a counter.
So ... I added an (little) auxiliary RC circuit where the capacitor charge will give us a value directly related to the number of pulses counted until the repetition. The circuit only works in COUNTER mode. The orange line shows the growth of the capacitor voltage. The RC value is very large to ensure an initial curve as linear as possible, far from the exponential.
Even after 4096 values, the capacitor would have a load of only 45 milli-volts. Very far from the exponential and practically linear.
In the linear part, the load curve grows at a rate of 10 microVolts per pulse. This means that if the orange line is at 4.57 miliVolts, the pulses counted are:
4.57e-3 / 10e-6 = 457 pulses.
If you like math, you can calculate the integral and get the number of pulses, approximately.
The button is to "reset" the capacitor.
Run it online, PC... Very^4 slow in my Android S3...
And now faster on my new Xiaomi 9T.
How does it work:
I will not explain the Random section (top right) because you already know it although I am going to tell you a little trick:
If you raise the ADC reference voltage, you can limit the maximum number of displays.
For example, if you put it at 7v the display will be limited to number 9.
Max number 999 => 10^3 - 1
To do this brings us another problem. The probability of nine increase respect all others... If you don't like this change the HIGH value of generators from 4V to... 3 or 2 or 1 or...
The default value is 4v.
Max number 0xFFF => 16^3 - 1 (4095)
The Verification section is very simple.
First and very important is to locate the "Logic Source" under the orange displays. This makes it possible to switch between GENERATOR and COMPARATOR modes.
OFF (GENERATOR mode)
The circuit generates random numbers constantly (green displays). Orange display don't changes.
We can use this mode to wait for a certain sequence or to count numbers instead of sheep ...
ON (COMPARATOR mode)
The first thing the circuit does is to capture the number generated by storing it in a latch (orange displays). A few micro-seconds later the generator clock becomes controlled by an OR gate. When the comparator circuit detects a match, it sets its output to "1" (blue line) causing the OR gate to have its output to "1" and therefore, the CLK is disabled. Diode in RC circuit is to ensure that capacitor don't discharge. So you can go on holidays by a month and when you return the capacitor will be with the same value.
So... If you have patience you can stay to count the pulses and check how many numbers are generated before the repetition. Keep in mind that a random number can be repeated long before all combinations have left.
I hope you like it.
|