Circuit to randomly select one of three outputs...

User avatar
John Donnelly
Web Team
Posts: 1092
Joined: Fri Mar 16, 2012 7:03 pm

Circuit to randomly select one of three outputs...

Postby John Donnelly » Sun Mar 20, 2022 12:14 pm

More electronics that electrics but I'm wondering if such a circuit can be built/is available. I know that I could do this with a Arduino and a little bit of coding and that may well the route I eventually go down as I do have some experience with that.

So, down to what I need, the photo below shows one of the signals on my main line. The 3 aspect signal head replaced an earlier distant semaphore arm and it relates to a home signal about half a mile or so down the line but one that is not modelled the layout. When the home is at danger, none of the aspects are lit but when the signal is pulled off, depending on the signal further down the line, the colour light can show either green, amber or double amber.

The semaphore is operated from a DCC Concepts lever and I will make use of one the built in switches to power the colour light and, in my mind, I'd have that switch connected to a circuit that would randomly be able to select one of 3 outputs which would then provide power to light up the relevant aspect on the signal.

Image

So, does such a circuit exist or can it be built?

John

User avatar
Tim V
Posts: 2868
Joined: Tue Jul 29, 2008 4:40 pm

Re: Circuit to randomy select one of three outputs...

Postby Tim V » Sun Mar 20, 2022 1:20 pm

I don't understand why it should be random, since it indicates the state of the next block?
Tim V
(Not all railways in Somerset went to Dorset)

User avatar
John Donnelly
Web Team
Posts: 1092
Joined: Fri Mar 16, 2012 7:03 pm

Re: Circuit to randomy select one of three outputs...

Postby John Donnelly » Sun Mar 20, 2022 1:55 pm

Tim V wrote:I don't understand why it should be random, since it indicates the state of the next block?


As the next block isn't modelled (the scenic break is the bridge), it's state is unknown so rather than, for example, the aspect always showing green, I'd like it to be random.

User avatar
Winander
Posts: 847
Joined: Thu Mar 20, 2014 12:19 pm

Re: Circuit to randomy select one of three outputs...

Postby Winander » Sun Mar 20, 2022 2:51 pm

MERG PMP12 - Random Lights
Kit Number: 812
Switches up to 10 lights on and off randomly. £1.81

That's all it says about it in the kit locker. The problem for your application might be after selecting a random colour then keeping just that one on after the semaphore was changed. Would it prototypically only show a light when the semaphore permitted passage?

i seem to recall you are a member, so a visit to their forum might be the place to get more information.
Richard Hodgson
Organiser Scalefour Virtual Group. Our meeting invitation is here.

User avatar
Noel
Posts: 1976
Joined: Wed Jun 23, 2010 1:04 pm

Re: Circuit to randomy select one of three outputs...

Postby Noel » Sun Mar 20, 2022 5:12 pm

John Donnelly wrote:rather than, for example, the aspect always showing green, I'd like it to be random.

Possibly with the aspects changing while the home is clear, i.e. Y to YY to G?
Regards
Noel

Tony Wilkins
Posts: 814
Joined: Tue Mar 20, 2012 3:57 pm

Re: Circuit to randomy select one of three outputs...

Postby Tony Wilkins » Sun Mar 20, 2022 6:43 pm

Hi John.
Sounds like a job for a timer / counter circuit with a binary output counting 2, 3, 4. Bit 2 to give a Y aspect, Bits 1 and 2 for Y Y and Bit 3 to give G. Its randomly setting the initial condition that's the tricky bit. Probably easier to do in software.
Regards
Tony.
Inspiration from the past. Dreams for the future.

bécasse
Posts: 377
Joined: Sun Jun 17, 2018 8:26 am

Re: Circuit to randomy select one of three outputs...

Postby bécasse » Sun Mar 20, 2022 8:40 pm

It would be perfectly reasonable for such a signal to always go Y > YY > G once the semaphore which provides the red aspect has cleared. 4-aspect colour light signals would only be installed where train density is sufficiently high to justify the extra costs involved so much of the time the next colour-light signal would still be at red when the semaphore is cleared. To be totally realistic, you could set up a 0 > Y > YY > G timer circuit which is triggered whenever a train passes but which only actually illuminates the relevant colour light aspects when the semaphore arm is off.

Incidentally, although the red aspect is created through the spectacle plate of the semaphore signal, the intensity of that red light should match the intensity of the three c/l aspects, normally this was done by using an electric, rather than oil, lamp. The green spectacle of the semaphore signal would be blanked off.

User avatar
John Donnelly
Web Team
Posts: 1092
Joined: Fri Mar 16, 2012 7:03 pm

Re: Circuit to randomy select one of three outputs...

Postby John Donnelly » Sun Mar 20, 2022 9:53 pm

Thanks all for the replies so far.

I don't know if the aspects need to cycle as every prototype photo I have of this particular signal, and I have quite a few, show no lit aspects when the semaphore arm is at danger. It has always been my feeling ,although I have no written evidence that, as soon as a train passed the signal and the arm went back to danger, the lights went out regardless of the aspect they were showing when the arm was up...

User avatar
grovenor-2685
Forum Team
Posts: 3918
Joined: Sun Jun 29, 2008 8:02 pm

Re: Circuit to randomy select one of three outputs...

Postby grovenor-2685 » Sun Mar 20, 2022 11:01 pm

Indeed, the colour lights would be extinguished whenever the semaphore went to stop, but it could still be lit for some time, ideally a random aspect to start with and step up after a couple of minutes if not already green. A job for the Arduino I would think, or a small PIC. It should be easy enough to find a random number sketch for Arduino. MERG has a PIC operated random lights unit (PMP 12) kit that could be adapted if you can program the PIC. Its under £2.
Regards
Keith
Grovenor Sidings

User avatar
John Donnelly
Web Team
Posts: 1092
Joined: Fri Mar 16, 2012 7:03 pm

Re: Circuit to randomy select one of three outputs...

Postby John Donnelly » Mon Mar 21, 2022 9:08 am

grovenor-2685 wrote:A job for the Arduino I would think


I'm thinking that's the way to go, there is already a random number function available to use in a sketch.

Porcy Mane
Posts: 131
Joined: Wed Apr 11, 2012 4:55 pm

Re: Circuit to randomy select one of three outputs...

Postby Porcy Mane » Fri Mar 25, 2022 4:27 pm

John Donnelly wrote:
I'm thinking that's the way to go, there is already a random number function available to use in a sketch.


Didn't realise you'd asked this question elsewhere after asking about it last Saturday.

Would this be the type of thing? Still needs some improved discrete component selection to even up the LED illumination or to adapt it to the hardware you have used. Randomness over eighteen cycles.

I'll have a look at your components tomorrow.

https://www.youtube.com/watch?v=QELcjsdBmbU

P

User avatar
John Donnelly
Web Team
Posts: 1092
Joined: Fri Mar 16, 2012 7:03 pm

Re: Circuit to randomy select one of three outputs...

Postby John Donnelly » Fri Mar 25, 2022 4:36 pm

Porcy Mane wrote:
John Donnelly wrote:
I'm thinking that's the way to go, there is already a random number function available to use in a sketch.


Didn't realise you'd asked this question elsewhere after asking about it last Saturday.

Would this be the type of thing? Still needs some improved discrete component selection to even up the LED illumination or to adapt it to the hardware you have used. Randomness over eighteen cycles.

I'll have a look at your components tomorrow.

https://www.youtube.com/watch?v=QELcjsdBmbU

P


Cheers Paul, that looks like exactly the sort of thing I'm looking for...

See you tomorrow.

User avatar
John Donnelly
Web Team
Posts: 1092
Joined: Fri Mar 16, 2012 7:03 pm

Re: Circuit to randomly select one of three outputs...

Postby John Donnelly » Thu Mar 31, 2022 7:57 pm

Decided to go down the Arduino Nano route and as of tonight on the test bench, I've programmed the Arduino to send an output randomly to one of three outputs when a switch is thrown and to turn the power off to all three when the switch is off.

I may, later, add some code to sequence the aspect automatically if the semaphore is off for long enough.

User avatar
John Donnelly
Web Team
Posts: 1092
Joined: Fri Mar 16, 2012 7:03 pm

Re: Circuit to randomly select one of three outputs...

Postby John Donnelly » Sun Apr 03, 2022 9:54 pm

For anyone who may be interested, here is the result of the programming of the Arduino. When the semaphore signal is 'off', I've programmed the Arduino to randomly select one of the three possible aspects for the colour light signal. If the arm remains off, the lights cycle back to green after a pre-determined number of seconds (set to 5 for the purpose of the video):


User avatar
John Donnelly
Web Team
Posts: 1092
Joined: Fri Mar 16, 2012 7:03 pm

Re: Circuit to randomly select one of three outputs...

Postby John Donnelly » Mon Apr 04, 2022 9:07 am

Oops, it appears I have the Amber aspects the wrong way round, this will be corrected with a programming tweak.


Return to “Electrics”

Who is online

Users browsing this forum: ClaudeBot and 0 guests