The Concept
The most complicated track configuration that my operators encounter is the double slip. I wanted to indicate the route that was set through red/green bi-colour LED’s whereby the Green showed the route set and red to indicate “don’t go there”.
Initially I was going to use relay logic but after research settled on a principle I found on Rob Paisley’s website called 2 Sets Of 2 Inputs To 4 Discrete Outputs. How I applied the concept is shown below.
The concept was applied to the first two double slips which are located at Helix Junction and Hornertown Classification yard and both are Peco Insulfrog and A & B switches are achieved by using an accessory switch which is a SPDT.
When it came to Peco Electrofrog the accessory switch was required to switch the live frog power and was unavailable for switching the 12V DC used in the control circuit. I used a Launchpad to program a MSP430g2553n20 microprocessor to drive LED’s to indicate the route set through a live frog double slip on a layout wired for DCC based on the polarity of the frogs which are set by the turnout location.
The givens are: LED’s driven by the MSP are to have their current limited to 10mA each, the DCC inputs must be electrically separated from the MSP, the active DCC circuit shall be indicated by an indicator LED.
I have incorporated an on board power supply board that utilises one of my 18V 4 Amp AC accessory power circuits and outputs 3.3V regulated DC.
In this project a LaunchPad, will control the 8 Outputs by monitoring the state of the switched outputs of four Optocouplers providing frog power status .
Bill of Materials (for one Double Slip NB some Photos show board for two):
(1) 1 x MSP430G2553IN20 processor which will be fitted to the LaunchPad for programming.
(2) 1 x IC experimenters board (link ).
(3) 1 x IC Socket 20 Pin ( link ) .
(4) 1 x IC Socket 16 Pin ( link ).
(5) 1 x 40 Pin Header ( link ).
(6) 8 x 330Ω ¼W resistor ( link ).
(7) 1 x 47kΩ ¼W resistor ( link ).
(8) 4 x 1kΩ ¼W resistor ( link ).
(9) 4 x 1N4004 diode ( link ).
(10) 4 x 3mm Red LED ( link ).
(11) 4 x Optocoupler ( link ).
(12) 4 x 3mm Red/Green Common Cathode LED’s ( link ).
(13) 1 x Power supply (see below).
Notes:
(1) ( links ) were valid at the time of publication.
Power supply bill of materials:
(1) 4 x 1N4004 Diodes.
(2) 1 x 3.3V Regulator TI UA78M33CKCS.
(3) 1 x 1000µf 50V.
(4) 1 x 10µf 50V.
Below is my experimenters board with circuits for two double slips.
Theory of Operation:
The switched output of each Optocoupler is connected to the Microprocessor switching VCC to pins P1.6, P1.7, P2.4 & P2.5.
The state of Point Motors, A and B are assessed by which stock rail is not connected to the frog (polarity same as frog) so a circuit is completed via the Optocoupler. When an Optocoupler operates it causes its respective input pin to go “high”. There are four valid combinations A1 & B1, A1 & B2, A2 & B1 or A2 & B2. The software in the LaunchPad causes Green & Red Route LED outputs to operate.
This is achieved by monitoring 4 inputs: A1 – P1.6; A2 – P1.7; B1 – P2.5; B2 – P2.4. If any of the predetermine sets of inputs go high: the corresponding set of Red & Green LED’s are high until the next input state change. See the table below:
State | P | R | Q | S |
A1 & B1 | Green P1.0 | Green P1.2 | Red P1.5 | Red P2.1 |
A2 & B1 | Green P1.0 | Red P1.3 | Red P1.5 | Green P2.0 |
A1 & B2 | Red P1.1 | Green P1.2 | Green P1.4 | Red P2.1 |
A2 & B2 | Red P1.1 | Red P1.3 | Green P1.4 | Green P2.0 |
Each input is assigned a Unique Checksum A1-8, A2-16, B1-32, B2-64 so only set checksum values match “a state” A1&B1 = 40, A1&B2 = 72, A2&B1 = 48 & A2&B2 = 80. Checksums are stored and checked against the LastChecksum. Should an invalid Checksum occur for any reason then all Green LED’s operate for the duration of Flash_Timer then the Red LED’s do the same and the process repeats three times before Checksums are rechecked. For the first Checksum check or if an invalid Checksum found then the value of LastChecksum is set to -1 to ensure inputs are re-read from the microprocessor.
Link to the code.
Demonstration
Link to Video of operation.