Northern Tablelands Express approaching Ardglen Tunnel

Northern Tablelands Express approaching Ardglen Tunnel
Click on the above photo to see the Main North Album at Flickr

Sunday, June 14, 2020

Occupancy Detection for DCC.

Note: If using relays with Integrated Circuits (I.Cs.), see my warning at the bottom of this Blog entry
.
If you need to know where a loco/train/rolling stock is on the layout when using computers, signals or just for a LED on a Panel etc, you'll need an "Occupancy" Detector, sensing the train's position by infra red beams or current to a section of isolated track. Radio Frequency Identification (RFID) is not discussed here, if interested, click here.  

For an "out of the box" Occupancy Detector that I use and recommend is NCE's BD20.

As always I need easy solutions, so nothing different for occupancy detection. 
I haven't installed any resistors to my rolling stock wheel sets, I ONLY sense the presence of the loco. Yes the train can still be in the block while the loco is NOT but the Operators can see the train when they enter a Yard/Loop. This saves me from adding resistors to to my wheel sets. There's only so much time left.

The only problem I experience, that's common on all layouts, are power interruptions to the loco caused by dirty wheels/track, that'll cause the BD20s to "cycle", resulting in the Semaphore to cycle, from Caution to Clear then back to Caution, while the loco continues on unaffected because all my locos have a "Stay Alive". 
If the rolling stock had resistor wheel sets, this cycling could be all but eliminated as there are more "current" paths (resistor wheel sets), than just the loco. 
Installing a 100 uF 16V Electrolytic Capacitor across Pins 1 and 2 of the BD20 will delay for 3 seconds, the turning OFF the Detector thus eliminating the "cycling" of the Detector. 

The BD20 is capable of driving a Relay from Pins 3 and 4, if you supply 12 Volts to Pins Pin 1 and 4. Relays are used for my signalling to control the Tam Valley Octopus III for the Semaphore's Servo.

On my layout I use "occupancy" detection for:
  1. Signalling 40 metres of single line with 3 loops for automatic bi directional running.
  2. Signalling at other locations.
  3. Indicating which tracks are occupied in my "eye level" Armidale Staging.
  4. Turn off the track power to eliminate crashes in my Tickhole Tunnel.
  5. Operating Points and Signals to provide my desire route through Tamworth.
  6. Just lately helping Cassino Craig with his Shelton photographer. 
For my signalling, see my previous Signalling Blog entries where I used BD20s. At a Mate's recommendation in the U.S. I purchased some cpODs  needing more Detectors as I fit more Semaphores and other "occupancy" projects. 

I enjoy tinkering around with electronics, so I looked at making my own Occupancy Detectors from Rob Paisley's web site. , I had already made a DCC Ammeter, see my Ammeter Blog entry 

I was hearing a lot about using Arduinos for model railways, so I asked Dave Lowe from Brisbane who was going to attend the MRNSW 2018 Convention, if he'd do an Arduino Presentation.
Great Presentation with lots of ideas and examples of how to use the Arduinos for our layouts. There’s even an application to make a DCC system. Dave's example to flash a LED/s with an Arduino, that can be easily done using a $2 "555", I thought it was an little bit of an overkill. I bought an Arduino to play around with it. 

I had just installed a 60' Turntable in Tamworth and when the AMRM Article explaining how to control a Turntable using an Arduino and a Jaycar Stepper Motor, I felt my prayers for motorizing the Turntable were answered. I raced out and bought the applicable Stepper Motor.
My mate Brian spent an inordinate amount of time using the exact same Turntable mentioned in the AMRM Article and had correspondence with the author but could not get it work successfully. More perseverance may have been necessary but you can only spend so much time pulling your hair out. Brian’s experience sealed the fate for my Arduino, yet to connect any power to it, let alone “make” a project.

Making Occupancy Detectors 

I decided I wanted to make "transformer" type Occupancy Detectors, similar to the BD20 using Rob Paisley's Transformer Occupancy Detectors.

My regular electronics parts suppliers, Jaycar and Element 14 did not stock the Transformer so I purchased them, along with other parts, from EBay. The 10 components were assembled on a piece Veroboard and they worked first time. Dave sent me some Circuit boards and his pdf to make a much tidier Detector. 
Changing the value of "C1" in the above circuit, provides the delay, I need. 

My home made Detectors cost me $3 each so I can save heaps and buy more Tam Valley Octopus IIIs to motorize my static Bracket Semaphores. Dave has used Arduinos to operate his Servos, maybe I should talk to him but for now the Octopus III, is good for me.  

Occupancy Indication for my Armidale Staging.

This staging area is at 1680 mm, too high for me to see what’s in the 6 Sidings and to manually set the Points, so you can use an empty Siding. I needed add Peco Point Motors along with a Control Panel and some form of "occupancy" indication.

I made the Armidale Control Panel using my usual method of Toggle Switches and ONLY 3.0 mm Green LEDs, recessing the Panel into the fascia. Operating a Toggle Switch, illuminates the appropriate LEDs and operates the Peco Point Motor using it's own Capacitor Discharge circuit (see previous Signalling Blog entry).

The illuminated Green LEDs easily identifies which Siding is selected but requires extra wiring behind the Panel, well worth it.

Occupancy of the Sidings was to be simple, just a Red LED easily implemented by using Red/Green LED (Jaycar Part No ZD0248) for the LAST LED in each of the 6 Sidings, see photos.

An empty Siding the Bi-colour LED illuminates GREEN and an occupied Siding the LED is RED, see below.

The photo on the right has the last LED illuminated RED, indicating Siding 1 is "occupied" with the 4 Car Northern Tablelands Express at "home". 
Also shown is the Yard "Exit" Colour Light Signal is at green indicating it is safe to crossover into Tamworth.

I wanted a simple homemade solution, firstly trying infra red sensors but the difficulty of mounting the transmit and receive LEDs I made a simple homemade "current" type of detector I saw years ago on p89 in DCC book by Ames, Friberg and Loizeaux, years ago. I used a 4N25 and a 1 Amp Bridge Rectifier mounted on a Veroboard with a LED. Connected 12 Volts and DCC and it works.

For a circuit see Rob Paisley's Basic Detector but without the LM339 Comparitor etc. Pin 5 supplying an earth to the LED, with occupancy. This simple detector could be used if you want a LED on a panel, see photo.

I could not work out how to "changeover" the polarity to the Red/Green LED without using a Relay and my simple detector could not drive a relay without adding a LM393. Now it's not a simple detector. 

I went with one of my homemade Veroboard Transformer Occupancy Detectors, shown right.. 
Instead of adding a relay to control the Red/Green LED, with the help of Andrew, I added 3 resistors (L/H side of Detector), that "swap" around the polarity to the Red/Green LED from Green (not occupied), to RED when the Detector senses "current" in the Siding, indicating the Siding is occupied. 

You may have to adjust the turns through the Transformer to get the indication to changeover.

The photo right, shows 4 of the Detectors mounted under the layout behind the Armidale Control Panel 

The only problem with this above solution, if there’s no loco (only rolling stock), it will not show “occupancy” – solution, make it a train and not just rolling stock by placing a loco on the track. While not exact but this’ll prevent someone from trying to park their train in that Siding and we all have spare engines. If you've run out of locos, clip a 100 Ohm 1 Watt Resistor to the track.

I also re-modelled Armidale because I don't think I'll ever install the Return Loop, that I initially wanted all those years ago. I added a spare "island" station, some houses and a little bit of scenery. I know the station is not "correct" but it'll do for now until I maybe build the right station.  

Tickhole Tunnel “Isolation”.

In my last Blog entry I suggested if an Operator did not stop at the Colour Light Signal on the UP, if it was RED before entering Tickhole Tunnel, he'd probably crash into a train with catastrophic results. 
I'd have to spend half an hour during an Operation Session to remove scenery to access the wreckage. 

To safeguard this slack Operator, in this era of strict OHS procedures, I’ve removed the power to the track at the Signal by using the second set of contacts on the DPDT Relay on my Detector controlling the Colour Light Signal, an easy fix. 

The Occupancy Detector in this installation is one from the Model Railroad Control Systems in the U.S. mentioned above.



Tamworth entry/exit Points.

I could have used a different type of Auto Reverser for the Tamworth Return Loop with "contacts" to operate these Points. This would include of shunting in Tamworth.

I could have added a Frog Juicer and associated DCC stuff. 

I wanted  all trains from Werris Creek to be automatically “routed” passing Tamworth's Platform, then they'd go to Armidale or take the Return Loop for continuous running (back to Werris Ck etc). If the Return Loop option was taken, the train "appeared" on the rear track of Tamworth, the second Occupancy Detector automatically switches the Points via the Capacitor Discharge seen on the left of the photo, getting the train back onto the mainline, to Werris Ck.

Casino Craig’s Shelton the Photographer.

After reading Craig's Blog entry he posted on 31 May 2020, I contacted Craig and with Andrew, we suggested alternatives to what Craig was trying to achieve with his Flasher Circuit that worked, well sort of. 
Craig purchased an Arduino and wrote the appropriate code, what a computer geek Craig is.

I did NOT want to venture into getting my Arduino to work so I used one of my $3 Detectors to operate the LED, but it remained illuminated dimly after the Flash even with changing resistor/capacitor combinations, I tried a Relay with a 100 uF Capacitor in series with the Coil that energies the coil for a  1/4 of a second providing a perfect Flash, irrespective of how long the Detector senses occupancy. 

A 100 uF for" C1" in the circuit, keeps the Detector "ON" for 15 seconds after there is NO sense current from 40 mm "block". This eliminates a second and subsequent flashes with dirty wheels/track and/or when the second bogie of a diesel,contacts the 40 mm block. The values of both of these Capacitors may have to varied to provide a single flash. Maybe Craig's Arduino is looking as a  better option but not for me.  

To make value of the time I spent, I decided to add Shelton to my layout at Ardglen Tunnel, using a 0.8 mm Surface Mount Daylight White to glued to Shelton’s head. I cut the appropriate Gaps in one rail before the Tunnel and connected the DCC “sense” wire through the Detector’s Transformer to the isolated track and connected it to the 12 Volt D.C Bus for signalling, under the track..














Above is my "test" Transformer Detector, assembled on one of Dave's Circuit Boards, under the layout. The schematic on the right shows all of the the connections. 

See Shelton “flashing” at Ardglen on the Main North, below.  


Craig's set-up on the 14 Jun 2020 entry, uses a Bridge Rectifier connected to a 4N25, "triggering" his “supercharged” Arduino as per the diagram below and it flashes. Craig has just got to get Shelton, onto his layout. 


The Voltage Drop across the Bridge Rectifier, reduces the voltage to to the track that can cause a "slowing down" of a loco using this method of Occupancy Detection. Circuits using this method of detecting the current without an Arduino, are also shown at the above Rob Paisley's pages.  

Bridge Rectifier Current Occupancy Detector using a LM555 Timer with a Delay.

I made another Occupancy Detector but instead of using the hard to source Transformer I use, I used a 1 Amp Bridge Rectifier and a 4N25 that triggers a LM555 Timer triggering a Relay. I used a 2.2 uF Electolytic that provides 3 seconds of delay. Inc/dec capacitance varies the delay.

The Output of the LM555 (Pin 3), can be used to operate LEDs for both "states" of the Detector as shown in the circuit.

Check Rob Paisley's site for more details.


 
I added a Jaycar 230 Ohm Relay and the LM555's 200mA capacity is fine with using the 250 to 500 Ohm relays but the LED is illuminated as long as the Detector is "energized, red/green photos below. 


To get the above Detector to FLASH for using with Shelton, I added a 100 uF Capacitor in "series" with the Coil, shown left. 

This makes an Occupancy Detector with easy to source parts and without using an Arduino that has to be "coded". 

Craig could this alternative circuit and save his Arduino for something a little more "difficult". See the photo left.

Without the Capacitor, the Relay is energized for as long as the Detector sees "occupancy". 

An Occupancy Detector with easy to source parts from Jaycar etc, for any "occupancy" project.   

I haven't made another circuit schematic.



Warning when using Relays with Integrated Circuits (I.Cs.)

Energizing the 300 to 500 Ohm Coils of the “common” 12 Volt Relays from say Jaycar, is not a problem in most cases. The “circuitry” used to energize the Coil needs to be able to supply this necessary “coil” current.
The Output Capacity of the LM393 Integrated Circuit used in my Occupancy Detector is very low at 20 mAs. If you use the above “low” Ohm Relays, the LM393 could be damaged. Instead use the 1,000 Ohm Relays like Jaycar’s SY4032 or SY4036 versions.
Some years ago I purchased lots of 960 Ohm Relays shown in the above photos, so I’m okay.

3 comments:

  1. Thanks Marcus! I seem to be getting famous among the bloggers!!

    ReplyDelete
  2. Hi Phillip and Shelton. Thanks for the compliments. Shelton we're waiting for Craig to get his Shelton onto his layout.

    ReplyDelete