30 Day, Random Timer

Thread Starter

Kim Sleep

Joined Nov 6, 2014
24
I am using the attached circuit that times for 30 days, but I need it to do more.
For a Science project I need a Timer that will trigger for 5 seconds at a random random time/day, 1 time during a 30 day cycle.
The circuit then resets and then triggers at a different random time/day over the next 30 day cycle, for 5 seconds,
Then on and on.
It should be triggering a Piezo Beeper, and an LED for the 5 seconds (approximately, not high accuracy needed either)
Please note, the day and time does not need to be accurate at all....hell, it can be plus or minus a few days. As long as its relatively random, its all good.

Thank you for any help
1680062257487.png
 
Last edited:

Sensacell

Joined Jun 19, 2012
3,257
True randomness is really rather difficult.

One idea would be to have a "random number counter" that represents the 30 day period, clock this counter with a crappy, unstable high frequency oscillator. (with temperature drift, etc)
Use another independent counter to count-off the passage of time, the time counter.

Compare the time counter to a latch, when these are equal- start a 5 second pulse, latch the random number counter into the latch for the next comparison.

If the two time bases are asynchronous, the values should be random enough.

I would use an MCU to do this, with a sketchy RC oscillator and the master crystal time base.
An RC oscillator using high-impedance elements would be nice and noisy.
 
Last edited:

Ya’akov

Joined Jan 27, 2019
8,174
I should add that one of the easiest sources of true entropy and so the basis of randomness is the noise produced by a solid state FM detector. That can be converted into actual random behavior is true randomness is required.
 

Thread Starter

Kim Sleep

Joined Nov 6, 2014
24
This random and there is erratic. True randomness can be obtained by the noise generated by an avalanching revers biased semiconductor junction. A source of random clock signals can be the Ed Nisley circuit:
https://circuitcellar.com/research-design-hub/projects/high-speed-random-numbers/

It may be more work than an erratic oscillator, but it is inexpensive and gives randomly spaced pulses.
Thank you for your response. As mentioned, absolute randomness is not necessary as all the specs for this are rather "Sloppy". As a matter of fact Sloppyness may help in the randomness...if ya get what I mean
 

Thread Starter

Kim Sleep

Joined Nov 6, 2014
24
A pic micro would be easier..
I have no skills with Microcontrollers, Im 63 , and still work in an analogue world, as I existed prior even to the I.C. age. I have bought a trainer from Amazon, but with a full-time job, its been pushed to the back of my bench.
 

Thread Starter

Kim Sleep

Joined Nov 6, 2014
24
No, this is nt schoolwork, it is for a science group that I belong to locally. Thank you for your reply
I have no skills with Microcontrollers, Im 63 , and still work in an analogue world, as I existed prior even to the I.C. age. I have bought a trainer from Amazon, but with a full-time job, its been pushed to the back of my bench.
 

BobTPH

Joined Jun 5, 2013
7,557
Is the requirement that it fire once in each 30 period, or that it fires randomly with a 30 day average interval between firing?
 

drjohsmith

Joined Dec 13, 2021
792
I have no skills with Microcontrollers, Im 63 , and still work in an analogue world, as I existed prior even to the I.C. age. I have bought a trainer from Amazon, but with a full-time job, its been pushed to the back of my bench.
Go for an arduino
lots of code examples and tutorials,
just go for the "standard" UNO, many others around, but this is the go to starter board

https://store.arduino.cc/products/a...L5*MTY4MDExODQ3Mi4xLjEuMTY4MDExODUxNC4wLjAuMA..

about USD 25


Arduino has a Integrated Design Enviroment,
lots of support, The board itself has logic in and out pins, and there are
things called "shileds" that plug onto the standard board connectors, and allow lots of output drivers,

and it has a random function,

https://www.arduino.cc/en/Guide
 

jiggermole

Joined Jul 29, 2016
101
I don't have the code anymore but i used an attinyxx and the watchdog timer. I used the built in psudorandom on the microcontroller to save a random interval then would put the attiny to sleep and have the watchdog wakeup and count to that random interval then do something and start over.
I used mostly code that others graciously put on the internet for the project so the arduino skills are learn as you go with something like this.
I used it to have a battery powered piezo, stuck it in the back of a coworkers drawer. They tore apart the desk and still didn't find it. Surprising how irritating a little beep at random intervals can be.
 

Thread Starter

Kim Sleep

Joined Nov 6, 2014
24
I don't have the code anymore but i used an attinyxx and the watchdog timer. I used the built in psudorandom on the microcontroller to save a random interval then would put the attiny to sleep and have the watchdog wakeup and count to that random interval then do something and start over.
I used mostly code that others graciously put on the internet for the project so the arduino skills are learn as you go with something like this.
I used it to have a battery powered piezo, stuck it in the back of a coworkers drawer. They tore apart the desk and still didn't find it. Surprising how irritating a little beep at random intervals can be.
LOL...I made the same thing using hardware , and it drove my boss nuts!!!!...I threw it on top a shelf 30 feet off the ground...it was WONDERFUL!
 

Thread Starter

Kim Sleep

Joined Nov 6, 2014
24
Is the requirement that it fire once in each 30 period, or that it fires randomly with a 30 day average interval between firing?
Someone suggested I use the word "Erratic" rather than "Random". So it fires once within a 30 day average period between firing. So to give you an example it fires march 15, then April 1st, May 21, June1, July17...etec etc for 5 seconds each time. Thank you for your reply, I appreciate it
 
Top