So my awaited postal deliveries all turned up on Monday. I tested the 20 IR detectors and they all worked. Quite a few of them had out of alignment LEDs, so that is the reason for testing them, so my concerns were unjustified. During the week I added the wiring under the level crossing module from the IR detectors and level crossing lights back to the Arduino and also installed some PC board distribution points, for all the positive and negative wires for the detectors and level crossing lights. So on Friday afternoon following work, I finally fired up the Arduino in the level crossing diorama module and gave everything a test. It worked. I did have to adjust the IR detectors a couple of times, so they came through the track and provided a better location for them to work.
On Saturday morning while on my way to soccer with my son I made a quick visit to George’s shop to deliver his diorama. Upon testing some of the detectors would not operate consistently with the test wagon. So next Saturday when I revisit the shop I will adjust the sensitivity on those detectors, to ensure consistent detection.
On Saturday evening after a full day of soccer games at different ends of the universe for school and club, I finally sat at my computer desk and designed my version of the code in the Arduino level crossing detector to operate on double track with single directional running on each track. I did implement the code for configurable jumper to make the Arduino now operate for either single track or dual track, depending upon if the jumper being set or not there.
Today I sat down at the keyboard, and started off by writing the code for a single direction of activation. This was the ‘up’ direction. I discovered a few flaws in my logic as I was converting my logic into code, but they were quickly overcome. I then copied that code, and swapped ‘up’ for ‘down’ and ‘down’ for ‘up’, and after some testing and a few small changes, it was tested and it seemed to be working. I ran an up train, a down train, an up and a down train, an up train and 3 down trains, and vice versa, all within the same activation to ensure that the code worked for all possible options for trains on dual track. All scenarios worked well.
So now the version that I will be distributing can be configured as a single track bi-directional level crossing, or a dual track with each track catering for either an up or down travel. Versions with differing scenarios to this have not been considered. With that said, there are options to include cut-out switches on a detector, when shunting near a level crossing so the detector does not activate in these circumstances, or a manual actuating switch to be located on a control panel to simulate a 'shunter' pressing the switch to activate the level crossing from a yard track. But these scenarios are not mentioned in my kit that I am distributing but can be added if anyone is interested.
So now I might be able to start ticking off some of the tasks I want to do to complete some projects on my 'To Do' List over the next few weeks. I also get to have an extra day in the shed this week, as Friday is a Public Holiday in Brisbane.