random timer for model train stop

Thread Starter

nottechnical

Joined Aug 6, 2010
9
Newbie needing help. I would like a circuit to control a model train as part of a fund raising project. The layout will have twenty stations and the train will be required to stop at different stations. A section of track at each station will be isolated from the rest but wired together. I would like a random timer to de-energise all the isolated sections. Push button to start and after a delay of approx five seconds the random timer would then de-energise the sections, stopping train at nearest station. Randoms times could be between five and twenty seconds. Can construct circuits but limited knowledge in electronics. Thank you in anticipation of some assistance.
 

tom66

Joined May 9, 2009
2,595
It's important to understand it's difficult to be completely random. To this extend, I assume you mean "pseudorandom", that is, determined by a function which is predictable, but to the observer looks random.

One circuit I designed as a basic random number generator involved a 555 timer and a counter. The counter was operated by holding the RESET pin high briefly. This charged a capacitor connected to the RESET pin and the timer oscillated at about 50 KHz (50,000 times a second.) The timer would switch off after the capacitor discharged, the time of which varied depending on how long the button was pressed or any number of factors (such as the room temperature changing the capacitance of the capacitor.) A counter was connected to this which displayed one of ten numbers; a simple extension would be to extend the counter to count one of twenty numbers. This should give you an idea on how to make a random timer.
 
Last edited:

Bernard

Joined Aug 7, 2008
5,784
To complete schematic, need a signal to mark trains arrival at a station. How long does train stay at a station? ; hopefully a fixed time for all stations like 5 sec. then train starts another random time run. Can power to track be monitored via low value sensing resistor to show when train hits dead track. Power is DC??
 

Thread Starter

nottechnical

Joined Aug 6, 2010
9
tom66 - As I said I have limited knowledge in electronics and have experimented and failed with some of my own circuits hence the need of a diagram. Thanks for time spent and your advice. Will take on board your suggestions and try again..
 

Thread Starter

nottechnical

Joined Aug 6, 2010
9
Bernard - Don't think I have explained my requirements very well. The train stops at the nearest station once the random timer de-energises the isolating rail at all stations and would remain there until the push button is activated to re-energise all sections of track and re- start the random timer. The train would run until the random timer again de-energised the isolating rail. The reason for the isolating rail is to have the train stop at the exact position of the station. This would be the case at all stations. The power is 12vDC. Hope this is helpful. Thanks for your interest and time spent.
 

windoze killa

Joined Feb 23, 2006
605
Let me have a go at explaining this as I understand it. You have 20 stations and in front of each station you have a piece of track you wish to remove power from randomly. For example the random selector will select station number 5. Track in front of station number 5 will have its power removed so when the train reaches that section of track it will come to a stop magically in front of the station.

If this is the case I think you are going to need 20 relays that are going to be randomly selected (note I have said selected and not deselected as this would conserve power as only one relay will be energised at any one time).

The other way I understand it could be that you want to remove power from ALL station section at the one time and the random part of the equation is the timing. This will stop the train at the nearest station when power is removed. This is the way I think you have asked for. This would be cheaper as you would only need one relay.

Either way you could do away with the push button and make both the start and stop sequences random. So after the train randomly stops at a station some random time afterwards it will start again and so on.

You could have one pseudorandom timer trigger the stop relay and also to trigger the start timer to switch the relay back on.

I know you still don't have a circuit but I hope this helps a bit. I will have a go at trying to design something for you but work commitments are a bit tight at the moment.

PS. Model railways are one of my hobbies which is why this thread has caught my eye.
 

Bernard

Joined Aug 7, 2008
5,784
Here is an attempt to hold IC count low. Initial 5 sec. delay & reset at powerup are missing for now to keep it simple. Assuming control FF [F ] is reset, the two speed clock is running at about 300 Hz, continusly circulating thru 512 counts. When PB SW is pressed, F is set, Q goes high, closing switches[ 4066 D ] A & C, adding a capacitor Cx-2 to clock, slowing it to 25.64 Hz or 20 sec at stage 10 of E. Stage 10, pin 15 of E is then connected to F reset via SW C. From what ever count E was at when F was set, count continues now at .039 s/ step untill reaching stage 10 when FF F is reset. Output Q controls track segments, killing power when high. Need two more 10k resistors at E-12 & F-4 so inputs are not floating. When my eyes uncross i'll recheck values.
 

Attachments

Bernard

Joined Aug 7, 2008
5,784
The other half of the 4027 goes between F-Q & track control. .39 s should be about .003 sec. for fast clock as shown en E's box.
 

John P

Joined Oct 14, 2008
2,025
I hate to raise difficulties, but what will prevent the train from getting (let's say) 90% through one of the switched sections when the power goes off, versus being out on the mainline and entering a dead section and stopping as soon as it loses contact with the mainline? The result of this difference would be that for any given station, the train's stopping point will vary.

It seems to me that the way around this is to have a detector for the train at each station. Every time a detector is triggered, the system spins the roulette wheel, and if the right number comes up, the power is cut for a certain period. Otherwise, the train doesn't stop, but if it does stop, it always lands in the same place for each station. This system needs the detectors, but no breaks in the rail.
 

Bernard

Joined Aug 7, 2008
5,784
If train hits a controled section of track and power dies 90% thru, train either stops in 10% or goes on to next station, and nobody will notice any difference except for an ocasional slowing.
 
Block detectors are very common in model railway setups. They generally detect current draw from a particular section of track. Using this idea could work but I think it maybe a little complex for the OP seeing his ID is "nottechnical". Hopefully I can get some time to help him out with a design.​
 

Thread Starter

nottechnical

Joined Aug 6, 2010
9
Bernard - Thanks for the schematic. As an Electrical (not electronics) engineer I can follow the circuit although not fully understanding how it works. Looks like it might serve my purpose when complete. Sorry about the eyesight. Hope they uncross soon.
 

Thread Starter

nottechnical

Joined Aug 6, 2010
9
Windoze Killa - Thank you for your interest. The circuit would de-energise All station sections of track at the same time and the random part of the equation would indeed be the timing. I would still require the push button to restart the cycle after each train stop.
 
You may not need a push button. If you are happy with say a 10 second stop at the station you could have a timer set to restart the power to the tracks after that period.

I really want to get stuck into this design but I have been suffering a few migraines. I was thinking of using a LFSR as a random generator. Will try and do something over the weekend.
 
Last edited:

Bernard

Joined Aug 7, 2008
5,784
Back to a block diagram, ignoring proper signal input polarities: Initial condition : train at station, track off, colck on fast, counter on continuous circulate. Flip-flop 1, FF-1, @ reset allows clock to run on high speed [10 to 60 pps] resetting every time stage 32 is reacher, reset via gate G-1, enabled by FF-1-notQ. When PB-SW is closed, clock goes to slow, S, by setting FF-1, Q goes hi, switching timing resistors on clock.FF-2 is reset, applying power to track. One shot, OS, is triggered also applying power to track for 5 sec. The clock now on slow, .66 sec / step, continues count untill stage 32 is reached in .66 sec to 20 sec. where it is gated by G-2, resetting FF-1[ switching to F ] & setting FF-2 [ turning off track power ]. If clock switches at stages 24 or later, the short time to 32 count might not allow the train to clear the dead track when PB-SW is pressed, hence the 5 sec over-ride. Any number of counters can be used- 4020, 4024,4040, 4060, etc. Driver is transistor or relay. Any clearer??
 

Attachments

Bernard

Joined Aug 7, 2008
5,784
Block diagram with numbers: The slow clock, S, is set with 1μF cap & about 680kΩ, or 1M pot, to give a period of .62 sec X 32 counts = 20 sec.; fast clock about 20 X faster. The 5 sec timer uses the opening of PB-SW to give a neg. pulse to start. Two seperate 555's used for clarity, can sub 556. G3 with 2 1N914 diodes form an OR gate to allow either FF2 or 5sec to control the track. The 4040 can sub for 4020, lower stage pin nos no the same but here are not used. If LED is used , resistor of about 430 will do for a white one. For the driver either a relay or transistor SW can be used. If more drive for driver is needed, G3 & G4 can be paralled to give around 12 mA out, or about 120 mA relay current.
 

Attachments

Thread Starter

nottechnical

Joined Aug 6, 2010
9
Bernard
My apologies for not being in contact. This was due to a family bereavement.

I have sourced all components for the timer and will assemble circuit soon and hopefully get back to you with word that it works. In the meantime thank you so much for all your help and advice.

Bill
 
Top