Notifications
Clear all

Model Railway Signal Lights

32 Posts
10 Users
5 Likes
10.7 K Views
(@john40131)
Member
Joined: 5 years ago
Posts: 95
Topic starter  

Hi Skynet,  You are not the only one struggling with Logic this logic is a nightmare as the Crossover requires a lot of witing and polarity switching, also I have just installed a Scissor crossing which requires 4 relays DPDT to change the polarity of Frogs considered using an Arduino but have to switch relays and I have a lot of 12v DPDT miniture , luckily I can simulate in NI Multisim, I also have a copy of Proteus which not used yet so simulate ...But I will look at all comments to help me..also the signals have 3 colour aspects plus on "Y" points on LH lines have a 5 LED white direction Left or Right as Picture ... High on sketch is when LED's are on..so switches from Red , to Yellow, to Green, and white array for direction when yellow or Green..noy sure how to change to ON - OFF in a sketch is it that simple..

Hi Pugwash, the guy who I copied this sketch from did change to a 74HC595 so maybe have a look at that..

The help is much appreciated...and I will again look through all links and comments..

Regards John

DSC 0741

 

 


   
ReplyQuote
(@pugwash)
Sorcerers' Apprentice
Joined: 5 years ago
Posts: 923
 

   
Inst-Tech reacted
ReplyQuote
(@pugwash)
Sorcerers' Apprentice
Joined: 5 years ago
Posts: 923
 

@john40131

Furthermore, please don't think I am advocating daisy-chaining N 74hc595s to solve your problem. It could be done but it would be a programming nightmare.

Just using 6 digital pins you could control up to 64 LEDs or anything else that needs a digital HI/LO signal. This would involve 8x 74hc595s and an 8-channel Multiplexer (CMOS 405x for example). Much easier to control in a program.


   
ReplyQuote
stven
(@stven)
Member
Joined: 5 years ago
Posts: 49
 

I have always felt that a lucky guess would serve me just as well as struggling to discover the true answer when it comes to complex problems of logic. Many questions are binary such that you have even odds of guessing correctly.

There are many roads eventually leading to the destination. Perhaps some of the longer ones have more scenic views...


   
ReplyQuote
(@john40131)
Member
Joined: 5 years ago
Posts: 95
Topic starter  

@pugwash

I will have a look at that, but like you say could be a nightmare to work out and program so I think I will keep it simple for the moment and progress, on my other post regarding using servos I am able to simulate what I want to do in Ni Multisim but this just takes up so much time but at least I can get my head around wiring..... this link is the guy who setup "Newcastle Central" signals and he used the 74HC757 ...

John


   
ReplyQuote
(@pugwash)
Sorcerers' Apprentice
Joined: 5 years ago
Posts: 923
 

@john40131

A word of caution about using the 74hc595.

This IC is by no means an LED driver, it is only low current tolerant. The maximum current from each output pin should not exceed 20mA and when adding the current on all 8 pins together, the current should not exceed 80mA. In the little demos, I have posted above, the current is limited to 6mA per output pin. Enough for green LEDs but not enough for red ones.

That out of the way, I have discovered a webpage with a very good explanation of how these ICs work.

https://lastminuteengineers.com/74hc595-shift-register-arduino-tutorial/

This may be worth reading before you decide to go down this route!


   
ron bentley reacted
ReplyQuote
(@john40131)
Member
Joined: 5 years ago
Posts: 95
Topic starter  

@pugwash

Thanks very much for link I will have a look next couple of days, I have another Arduino Sketch senario which does work albeit a bit long winded appart from an IF senario.... have a look I posted in another link.

John


   
ReplyQuote
(@pugwash)
Sorcerers' Apprentice
Joined: 5 years ago
Posts: 923
 

@john40131

I have changed my mind about how difficult it would be to program two or more daisy-chained 74HC595 chips.

The following graphic showed how the penny dropped.

Controlling i.e. manipulating, the output pins using a boolean array, which in every loop() is written to the array of 74hc595s.

I took the following code from your initial sketch to show graphically how it could be done.

void routeUpplatform3right() { // All Trains Up Via Platform 3 to Blackburn

digitalWrite(upplatform3RedLed, LOW); 
digitalWrite(upplatform3YellowLed, HIGH);
digitalWrite(upplatform3GreenLed, LOW);
digitalWrite(upplatform3WhiteLed1, HIGH);
digitalWrite(upplatform3WhiteLed2, HIGH);
digitalWrite(upplatform3WhiteLed3, LOW);

delay(mainLedDelay);

digitalWrite(upplatform3RedLed, LOW); 
digitalWrite(upplatform3YellowLed, LOW);
digitalWrite(upplatform3GreenLed, HIGH);
digitalWrite(upplatform3WhiteLed1, HIGH);
digitalWrite(upplatform3WhiteLed2, LOW);
digitalWrite(upplatform3WhiteLed3, HIGH);

delay(mainLedDelay);

digitalWrite(upplatform3RedLed, HIGH); 
digitalWrite(upplatform3YellowLed, LOW);
digitalWrite(upplatform3GreenLed, LOW);
digitalWrite(upplatform3WhiteLed1, LOW);
digitalWrite(upplatform3WhiteLed2, LOW);
digitalWrite(upplatform3WhiteLed3, LOW);

}

And this is what I came up with!!

signal demo

   
ReplyQuote
Skynet
(@skynet)
Member
Joined: 5 years ago
Posts: 5
 

Hi @pugwash @john40131 this IC Driver may help you out it large at 40 pin but it's an real led driver that you can use SPI or bitbang to load the data in a serial stream. I use them for debugging projects, to load the data into it takes about 1ms of cpu time. I have one wired up to 4 seven segment displays and 8 individual leds. I have another one with a string of leds on it and as my program progresses along I turn on a leds or off to aid in debugging. There are some arduino libraries for it and not hard to write your own. This baby could control 34 leds so 4signalheads having 5 leds each. current per led is 15ma. If you use those hc595 your gonna need ULN2803 to drive the leds.

 

When programming think about the reuse of code so you can save steps later software should make it easier to use the hardware. 

https://www.microchip.com/wwwproducts/en/MM5450   use the MM5450 it has an enable line...

http://ww1.microchip.com/downloads/en/DeviceDoc/20005651A.pd

Donnie

This post was modified 4 years ago by Skynet

   
Inst-Tech reacted
ReplyQuote
Skynet
(@skynet)
Member
Joined: 5 years ago
Posts: 5
 

How are the white leds wired looking at that diagram the is a red, yellow, green, white, left and right?

Does the white above the green part or the left or right diverge? or is part of it? 


   
ReplyQuote
(@pugwash)
Sorcerers' Apprentice
Joined: 5 years ago
Posts: 923
 
Posted by: @skynet

How are the white leds wired looking at that diagram the is a red, yellow, green, white, left and right?

Does the white above the green part or the left or right diverge? or is part of it? 

This is a bit of a mystery! The sketch, as flawed as it is, in the first post of this thread, only details three white lights. Only after publishing a photo of the actual light gantry can we see that there are more than just three white lights. In fact, there are nine!

I am pretty sure that these white lights indicate the direction of the next point setting i.e. left or right, and that five white lights will be illuminated depending upon this setting simultaneously.

Perhaps @john40131 could clarify this, otherwise, we are debating this subject based on a false premise.


   
ReplyQuote
(@john40131)
Member
Joined: 5 years ago
Posts: 95
Topic starter  

@pugwash

Yes you are correct, there is Red, Yellow, Green, 1 single white in the middle, 4 white to Right and 4 to Left this only lights when Yellow or Green is on and a train is going Left or Right at a " Y " set of points..

So if Yellow Left, Yellow lights for 5 seconds then Green for 5 Seconds and the middle white LED is also lit and the 4 LEDs to Left come on so wiring which I used 30swg enamel copper wire 7 wire of which one is common to all ..

John


   
ReplyQuote
Skynet
(@skynet)
Member
Joined: 5 years ago
Posts: 5
 

@John40131 Can you draw the track diagram of rails these 6 signals protect include as an image please?

What is monitoring the tracks and switch positions to insure it is safe to display the signal for the movement?

so the signals display something and delay, display something else delay, then display another aspect repeat?

 

 


   
ReplyQuote
ron bentley
(@ronbentley1)
Member
Joined: 2 years ago
Posts: 385
 

@pugwash 

Just came across your old post re the 74hc595 and leds.

Your theory is sound re 8 x leds.

However, it has been my experience that the 74hc595 seems to cope with 8 leds all illuminated, I haven't popped one yet! But it is worthwhile upping the resistors to around 330 ohm or more if you can.

However, I do always alert people to this issue if connecting these ICs to anything else, especially relays, and to use an external power source.

I hope you sorted out your difficulties and have your layout running.

Regards

Ron Bentley

 

Ron Bentley
Creativity is an input to innovation and change is the output from innovation. Braden Kelley
A computer is a machine for constructing mappings from input to output. Michael Kirby
Through great input you get great output. RZA
Gauss is great but Euler rocks!!


   
Inst-Tech reacted
ReplyQuote
ZoolanderMicro
(@zoolandermicro)
Member
Joined: 4 years ago
Posts: 144
 

Hi @ronbentley1, This is an old topic, but an interesting one. I wish I knew more about what @john40131 was trying to do. If the lights were supposed to turn on and off in a particular sequence, I would have suggested a chain of 555 timers. Sometimes it is easier to accomplish a task using hardware than with code. 

ZoolanderMicro, where small ideas are a big deal


   
ReplyQuote
Page 2 / 3