Random timer!

Hi Guys,

I'm looking for ideas here. I am trying to figure out how to make a random interval timer! Something that will trigger an indicator after a random period of time. Ideally 1 to 15 seconds after a button is pushed.

Thanks.

--
Best Regards:
                      Baron.
Reply to
Baron
Loading thread data ...

A PICAXE 08 will do it, although if you dont seed the random with something dynamic, it will be the same pattern after every boot.

The pic is 1.5gbp or so, programmed in basic or flowchart trough 2 resistors, so cheap to get started with.

formatting link

/Jan

Reply to
Jan Nielsen

have a fast oscilator the becomes a slow oscilator when the button is pressed. (period of 14 seconds) add a 1 second delay

Bye. Jasen

Reply to
Jasen

Hi Jasen, inscribed thus:

I like that idea... but how would you implement it ?

--
Best Regards:
                      Baron.
Reply to
Baron

Hi jan,

Jan Nielsen inscribed thus:

I've never used pickaxe. Thanks for the link, I'l go and have a look at it.

--
Best Regards:
                      Baron.
Reply to
Baron

--- Do you want it to be an integral number of seconds from when the button is pushed or are you looking for a pulse with a truly random width starting 1 second after the button is pushed and ending at any time up to and including 15 seconds after the button was pushed?

Better yet, what's your application?

-- JF

Reply to
John Fields

Hello John,

John Fields inscribed thus:

This is intended as a reaction timing device. The user pushes a button and after a random delay, pops a light on and starts a counter. The user presses a second button that stops and freezes the counter. A little like the "Simon" toy but with a counter instead of a buzzer. Fixed delays ie 1, 2, 4 etc seconds is easy. I didn't think a random delay would be so hard !

--
Best Regards:
                      Baron.
Reply to
Baron

Just use a PSRG (pseudorandom number generator). Let it free-run, and when the button is pressed, use the PSRG's current value to select one of your 15 fixed delays.

Good Luck! Rich

Reply to
Rich Grise

--
It isn\'t, it\'s just that your description is confusing and isn\'t
detailed enough to allow a design to be done.

From your second description I take it that you want a device which,
after a button (START) is pushed, waits for between 1 second and 15
seconds to turn on a light and simultaneously start a counter then,
when a second button (STOP) is pressed, stops the counter while
preserving the value of the count it has accumulated.

What you haven\'t said is whether you want the delay to occur in
random increments of one second and what granularity you want from
the reaction time counter.  That is, 1s? 100ms? 10ms? ???

You also haven\'t addressed how you want the reaction time counter to
be reset if you\'re doing multiple runs.  

A good way to do it would be to have the START button do it at the
beginning of each run, unless you have a better idea.
Reply to
John Fields

--
I\'ve made a few assumptions and posted a schematic to abse.

The device should work like this:

1. When the START button is pushed, a four-bit pseudo-randomly
   generated number is loaded into a four bit binary delay counter
   and the counter enabled.

2. The PRSG is advanced to the next state.

3. The  counter\'s one second clock is started. 

4. The four BCD digit reaction time counter\'s outputs are cleared.

When the delay counter times out:

1. The delay timer is disabled and latched up.

2. An LED is turned on.

3. The reaction time counter is enabled.

4. The 1000Hz reaction counter clock is started.

When the STOP button is pressed:

1. The reaction time counter is disabled and its outputs frozen in
   the state they were in when the STOP button was pressed.

When the START button is pressed again, the new pseudo-random number
will be loaded into the delay counter and the cycle started anew.

One caveat: One of the allowed states of the PSRG is 1111, which
will cause the LED to come on as soon as the START button is
pressed, so instead of 15 random delays from 1 second to 15 seconds
you\'ll have 16 random delays from zero seconds to 15 seconds.

It\'s a feature, not a bug. ;)
Reply to
John Fields

John Fields inscribed thus:

Hi John,

Unfortunately abse (alt.binaries.schematics.electronics) is not a group I have access to. My service provider doesn't provide news services any more. First they stopped posting and now they have been discontinued altogether. This server is the only one I can read and post to.

--
Best Regards:
                      Baron.
Reply to
Baron

John Fields inscribed thus:

Yes that's it exactly

The clock to the counter is at 1Khz.

That is what I am doing now. Pushing the start button resets the counter to zero.

This is the bit that I am struggling with !

Sounds good !

--
Best Regards:
                      Baron.
Reply to
Baron

formatting link

--
Service to my country? Been there, Done that, and I\'ve got my DD214 to
prove it.
Member of DAV #85.

Michael A. Terrell
Central Florida
Reply to
Michael A. Terrell

--
Email me your email address and I\'ll send you a copy.
Reply to
John Fields

John Fields inscribed thus:

Done ! Thank you John.

--
Best Regards:
                      Baron.
Reply to
Baron

I'd probably do it software, but if pressed to do it in hardware it'd be based around this:

here's the variable-rate bit done using a LM555 tiomer chip,

(it's not perfect one time in 1000 (or so) it'll fire immediately instead of waiting "randomly" 0-14 seconds but I'm guessing from your description that's not an issue...

.-------------------------------------------------------------. | This is an ascii schematic, if the diagram appears garbled | | try switching to a fixed-pitch font (courier works well) | | pasting it into notepad works well on ms-windows. | | or in google groups "view source" (found under options) | `-------------------------------------------------------------'

500K slow rate \\ /\\ .-\\/\\/\\--+--------+--- +5V | / | | / | . . . .|. . . . \\ | . VCC(8) . / 1.2M | . . \\ `--RES(4) OUT(3)--------->

| . 555 . go-fast ----\\/\\/\\-->|-+--------+--TH(6) DIS(7)-----. 10K 1N914 | . . | +--TR(2) CV(5)-- | | . . | | . GND(1) . | | . . . .|. . . . | | | | +--------|-----\\/\\/\\-' | | 33 ===== | 10uF | | --+--------+-- 0V

+5V on go fast will make it run at about 100Hz - faster than human reactions. pur 0V on go fast and the rate is determined by the trimmer at the top, set that so that the circuit pulses once every 14 seconds with go-fast held low. (best way to detect the pulses may be cheap headphones in series with a 1K resistor on the output, the pulse will it'll probably be too short to easily see on a LED)

the rest of the circuit depends on exactly what you want. assuming the start switch is a momentary push button, is it acceptable to require that the operator to hold it down until the random trigger ?

can I use a two pole switch to make the design easier or is only single pole available, can the switch be floating or must one end be ground or +5v

what sort of output do you need is a floating LED acceptable or must it be ground referenced ? what behavior do you want from the output? Bye. Jasen

Reply to
Jasen

Jasen inscribed thus:

Yes I have been caught out by not using fixed pitch fonts before !

The indicator and counter should come on together !

No ! Once pushed the operator has to be able to press a second button. This stops the counter and latches the display until the first button is pressed again.

The switches I used are the momentary ones from computer reset buttons.

What happens at the moment is a monostable flips state, 0 - 5v TTL logic.

It won't take me long to breadboard this up so that I can play with it. If it works well then that will be great.

--
Best Regards:
                      Baron.
Reply to
Baron

Jasen's original suggestion makes a great pseudo-random generator. Just have a 4-bit counter counting a fast clock. When the START button is hit, the counter will be at some random value (random due to the random timing of the START press relative to the high-speed clock). You just have to switch off that clock and switch to a low-speed clock for your count-down. (You can switch the timing values in a single clock, or have 2 separate clocks for this.)

Best regards,

Bob Masta D A Q A R T A Data AcQuisition And Real-Time Analysis

formatting link
Scope, Spectrum, Spectrogram, Signal Generator Science with your sound card!

Reply to
Bob Masta

Hi Bob,

Bob Masta inscribed thus:

This seems silly ! But I just can't seem get my head around it ! This is what I have at the moment.

I have a 1Khz clock and a one second gate time which feeds a four digit display. The one second clock is counted by a four bit counter to give 1, 2, 4, 8, seconds delay using diodes and a switch to select

1 to 16 seconds.

The display is four digits fed from the 1Khz clock gated by the 1 second clock. This is started by a monostable triggered from the delay timer and triggered back by the stop button.

This works fine. I just don't seem to be able to see the wood for the trees !

--
Best Regards:
                      Baron.
Reply to
Baron

On Sun, 03 Jun 2007 15:04:55 +0100, Baron wrote:

--- For some reason I didn't get your email addy, so if you'll send it again (or post it here with sufficient munging to foil the harvesters) I'll be able to send you my circuit.

BTW, here's the PRSG in LTSPICE, with a fix so it has a minimum delay of 1 second (the "feature" was fixed ;):

Version 4 SHEET 1 2076 1144 WIRE 480 -816 -352 -816 WIRE 592 -816 480 -816 WIRE 752 -816 672 -816 WIRE -416 -768 -592 -768 WIRE 240 -752 -352 -752 WIRE 240 -704 240 -752 WIRE 592 -704 240 -704 WIRE 752 -704 752 -816 WIRE 752 -704 672 -704 WIRE 240 -640 240 -704 WIRE 240 -640 -352 -640 WIRE 0 -608 -352 -608 WIRE -416 -592 -528 -592 WIRE 0 -592 0 -608 WIRE 592 -592 0 -592 WIRE 752 -592 752 -704 WIRE 752 -592 672 -592 WIRE -256 -576 -352 -576 WIRE -592 -528 -592 -768 WIRE -528 -528 -528 -592 WIRE -256 -496 -256 -576 WIRE 592 -496 -256 -496 WIRE 752 -496 752 -592 WIRE 752 -496 672 -496 WIRE -128 -480 -384 -480 WIRE 128 -480 -128 -480 WIRE 368 -480 128 -480 WIRE 512 -480 368 -480 WIRE -384 -432 -384 -480 WIRE -128 -432 -128 -480 WIRE 128 -432 128 -480 WIRE 368 -432 368 -480 WIRE -544 -384 -544 -464 WIRE -464 -384 -544 -384 WIRE -256 -384 -256 -496 WIRE -256 -384 -304 -384 WIRE -208 -384 -256 -384 WIRE 0 -384 0 -592 WIRE 0 -384 -48 -384 WIRE 48 -384 0 -384 WIRE 240 -384 240 -640 WIRE 240 -384 208 -384 WIRE 288 -384 240 -384 WIRE 480 -384 480 -816 WIRE 480 -384 448 -384 WIRE 752 -384 752 -496 WIRE -496 -336 -624 -336 WIRE -464 -336 -496 -336 WIRE -208 -336 -240 -336 WIRE 48 -336 16 -336 WIRE 288 -336 256 -336 WIRE -624 -320 -624 -336 WIRE -496 -256 -496 -336 WIRE -240 -256 -240 -336 WIRE -240 -256 -496 -256 WIRE 16 -256 16 -336 WIRE 16 -256 -240 -256 WIRE 256 -256 256 -336 WIRE 256 -256 16 -256 WIRE -624 -208 -624 -240 WIRE -384 -208 -384 -288 WIRE -384 -208 -624 -208 WIRE -128 -208 -128 -288 WIRE -128 -208 -384 -208 WIRE 128 -208 128 -288 WIRE 128 -208 -128 -208 WIRE 368 -208 368 -288 WIRE 368 -208 128 -208 WIRE 512 -208 512 -480 WIRE 512 -208 368 -208 WIRE 752 -208 752 -304 WIRE 752 -208 512 -208 WIRE -624 -176 -624 -208 FLAG -624 -176 0 SYMBOL Digital\\\\dflop -384 -432 R0 SYMATTR InstName A1 SYMATTR SpiceLine vhigh 5v trise 88e-9 tfall 88e-9 SYMBOL voltage -624 -336 R0 WINDOW 3 24 104 Invisible 0 WINDOW 123 0 0 Left 0 WINDOW 39 0 0 Left 0 SYMATTR Value PULSE(0 5 0 50e-9 50e-9 .5 1) SYMATTR InstName V1 SYMBOL Digital\\\\dflop -128 -432 R0 SYMATTR InstName A2 SYMATTR SpiceLine vhigh 5v trise 88e-9 tfall 88e-9 SYMBOL Digital\\\\dflop 128 -432 R0 SYMATTR InstName A3 SYMATTR SpiceLine vhigh 5v trise 88e-9 tfall 88e-9 SYMBOL Digital\\\\dflop 368 -432 R0 SYMATTR InstName A4 SYMATTR SpiceLine vhigh 5v trise 88e-9 tfall 88e-9 SYMBOL Digital\\\\xor -400 -720 R180 SYMATTR InstName A5 SYMATTR SpiceLine vhigh 5v trise 88e-9 tfall 88e-9 SYMBOL Digital\\\\and -384 -672 M0 SYMATTR InstName A6 SYMATTR SpiceLine vhigh 5v trise 88e-9 tfall 88e-9 SYMBOL Digital\\\\xor -496 -480 R90 SYMATTR InstName A7 SYMATTR SpiceLine vhigh 5v trise 88e-9 tfall 88e-9 SYMBOL res 688 -832 R90 WINDOW 0 -34 58 VBottom 0 WINDOW 3 -35 57 VTop 0 SYMATTR InstName R1 SYMATTR Value 160k SYMBOL res 688 -720 R90 WINDOW 0 -34 58 VBottom 0 WINDOW 3 -35 57 VTop 0 SYMATTR InstName R2 SYMATTR Value 80k SYMBOL res 688 -608 R90 WINDOW 0 -34 58 VBottom 0 WINDOW 3 -35 57 VTop 0 SYMATTR InstName R3 SYMATTR Value 40k SYMBOL res 688 -512 R90 WINDOW 0 -34 58 VBottom 0 WINDOW 3 -35 57 VTop 0 SYMATTR InstName R4 SYMATTR Value 20k SYMBOL res 736 -400 R0 SYMATTR InstName R5 SYMATTR Value 330 TEXT -584 -184 Left 0 !.tran 20

When you run it, The horizontal axis corresponds to successive pressings of the START switch (after the STOP switch has been pressed) and the vertical axis corresponds to the numerical value of the shift register's output, where 10mV = 1, 20mV = 2, and so on.

The resistor network is a DAC used to generate the vertical data and isn't used in the actual circuit.

-- JF

Reply to
John Fields

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.