Sunday, August 9, 2020

Now I Can Do Dual Track

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.

Sunday, August 2, 2020

The Best Laid Plans ....


This weekend I had plans on what I was going to achieve.  I did basically none of those tasks.  I was going to do some more work on the Cassino Station Overbridge.  Never got to it.  I was to do some detail work around the yard on one of the houses in Canterbury Street.  Never got to it.  I did want to spend some time working on controlling a servo with one of my Arduinos.  Never got to it.  I was to continue work on trying to create a string of party lights out of micro LEDs.  For this I did some work on Friday afternoon, and that was where it ended.  I did want to put together a few extra street signs.  I cut them up before lunch today, and maybe tonight while watching TV I might add some posts to the signs.  So this might eventually get completed this weekend.

However last night I did some work with my test Arduino.  I am testing the controlling of various light flashes.  I am trying to create a dance party in a local hall which will be surrounded by lots of drunk model people.  The hall with have a set of random flashing lights going off inside the hall, which people looking at the layout will be able to see.  What will also occur is that the hall will have an MP3 player located underneath it with a small speaker.  So those walking past will also be able to hear the big booze up party.  But my MP3 player has not turned up as yet.  Earlier in the week, I was experimenting with controlling some blue flashing lights for my local police car.  It will be positioned down the road from the large hall party.  It's blue lights will randomly come on occasionally to pull over some locals for a RBT.

I did visit George’s shop early on Saturday morning and got some advice about packaging up one of my Level Crossing kits (for single track) for sale at his shop.  Later that morning Barnacle Bob visited my place and left with his own Arduino and some styrene detail models for him to assist with adding yet more detail to his fantastic layout.  Later on I went to Bunnings and purchased some wood to make a little diorama, which will be used to display my level crossing kit.  So this diorama can sit in George's shop and show people how it works.  So today with the help of my apprentice, I got the various bench saws out of the shed and cut up some wood and made a display box.  I gave it a paint, fitted the track and the detectors and then some level crossing lights (provided by George) and then did some scenery on the board. 

Now if Australia Post played nice, I would have had some more IR detectors available and some additional Arduinos delivered on Friday so I could have potentially had the level crossing module working today.  But now I need to wait for my various packages to arrive and then find some time off work to put it all together. 

Here is what it looks like so far.
The new display module with glue drying on the ballast

Sunday, July 26, 2020

Finishing Some Projects

On Tuesday night a few of us got together on my Whereby channel for a chat on modelling.  On Wednesday evening I joined the Qld Railways Modelling chat with the Wuiske’s and a few others.  On Friday afternoon, I went down to the shed and installed all the road markings around my traffic lights located just south of Lismore station.  I also started checking out the overbridge at the end of the Cassino station platform at Simpson Parade.  I was looking at what I needed to do permanently install the roadway and the overhead book office.  It has been sitting there for almost 15 years.

On Saturday morning I made a trip over to Austral Modelcraft to buy some styrene as well as buy some decoders for the Club Shop.

On Saturday afternoon after my son’s soccer game, I installed the check rails in the level crossing on the north side of Cassino at Hotham Street.  I them installed the roadway around the location and stained the road.  This also has been waiting for about 14 years to be installed.  
Hotham Street level crossing

After this, I moved back to Cassino Station and Simpson Parade and continued working.  I build a frame foe the road bridge, painted it and installed the road over the top.  I then build a frame for the overhead station booking office and installed some support posts.  The frame was painted and the overhead booking office was installed onto.  I then painted up a footpath for the bridge and used some 0.060” Angle as a gutter.  Later that night while looking at google maps view, I discovered that there was no footpath on the southern side of the bridge, but I found out that the fence on the bridge was made from round pipe for the rails.  It also has a very rusty wire now.  So I will model this look.

So today I made and installed this fence.  I also added some fencing and road guttering down towards down towards the town side of Cassino.  I also did some work on the front and side fence of one of the houses in Canterbury Street.

The first view of the road overbridge at Cassino.

Another view with the wire fence almost in view

The station overhead booking office and the bridge from a different angle

The house on Canterbury Street now has as front fence.  Still more work to do to complete this house.

The station from the opposite side of the road.  The platform steps have now been permanently installed.  It has taken maybe 20 years to do this.  The overhead booking office and the platform stairs were from my first version of Cassino that predates the shed.

Today I had a bit of a surprise.  David Lowe came over this morning and presented me with a working Fast Clock device to plug into my NCE Cab Bus.  I was after one of these for the North Coast Controller to use.   This will tell the North Coast Controller what the time is when he is talking to the various locomotive operators and he can look at his timetable graph and tell if the train is on-time, running late or running early.  It helps him to keep the trains in the timetable running more or less as per the timetable graphs.
The Fast Clock display matching time with the NCE cab bus as displayed on a Procab-R throttle.

Dave also dropped off three of his little track current sensing devices.  Actually it is very similar to the NCE BD20.  David has made these himself and they can be used in various circuits.  

I have some of the Tuesday Nighter's coming over on Tuesday.  But to give them a taster, here are my set of traffic lights working.  This was taken pre-installation of the road markings.

Here is an example of my level crossing detector working.  But I had an extension lead across the track just past the crossing.  This shows the ability to lock out the activation of the crossing when shunting the Meatworks Siding.  This was taken pre-installation of the check rails and balsa roadway through the crossing.



Monday, July 20, 2020

Update From Barnacle Bob's

On Saturday morning while out visiting a local hobby shop, I made my way back via Barnacle Bob's.  I dropped off some locomotive oil and then went on a tour of the layout.

OMG!  Pictures follow.

What is a country setting without some of the local wildlife.  Here 5 cockatoos are enjoying themselves.

Goannas are in this picture - basking in the sunshine on the rocks

Kangaroos having a drink or water


The creek that the layout is named after,

An old windmill blade behind the shed.


The local stock yards


A car has gone for a dip in the water.  The local water police are checking for any occupants and supervising the recovery operations.


While on the wharf, the local detective has apprehended the drunk driver and put him in handcuffs. 

A local crane to assist with loading/unloading activities on the wharf.


One of a number of my industrial bins painted up by Barnacle Bob.

The local rural fire station and the town toilet block.

One of the local residents hanging out the washing

I think that is Lefty having a tinkle in the bushes 

I'm sure that is Miguel painting his boat before it goes on another trip up the creek.  Hopefully he doesn't forget his paddles.

An old boat rusting away on the banks of the creek.

Someone has left a shopping trolley near the water's edge.

Sunday, July 19, 2020

Some Success


Well I did get to the shed on Friday afternoon and today.  Saturday was filled up with a hobby shop visit in the morning, Barnacle Bob's after that, followed by Soccer and a surprise birthday party for my sister.  

On Friday afternoon I completed the level crossing detectors for Hotham Street on the northern side of Cassino.  I do have one LED not flashing, so that will be a dry solder joint.  I will eventually get around to fix that.  I am having some trouble with the bypass switch to be used at the Cassino Meatworks Siding.  I have configured it to cut out the track detection when someone is shunting in the siding – usually doing a run around maneuver.  However, when the detector is switched back in, sometimes it triggers the level crossing sequence.  So I will actually do the sending of the signal from the bypass switch to the Arduino, via an AND gate.  I will AND the detector output and the output of the bypass switch together, and send that output to the Arduino.  So I will play with that one afternoon this week.  I will make a trip to Jaycar to pick up an AND gate Chip for $1.25 and $0.40 for a 14 pin socket.  We will see if I can avoid having to change the level crossing detector code in the Arduino, which I can easily do, but I just want to make the Arduino code generic.

Given that I had everything sorted with that level crossing, it meant that today I pushed ahead with the installation of the traffic lights on the southern side of Lismore Station.  On Thursday at work, PK dropped by and handed over three sets of traffic lights that I got him to add to an order he was making from the US.  It almost arrived in record time.  So I tested them on Friday evening and drilled out some 3mm styrene tube with a drill bit so the four wires (red, yellow, green and common) could fit through from the light heads.  The drilling made a larger whole through the center of the styrene tube.  I did not have any brass wire, so I thought this was the easiest method to create some light posts.  The styrene tube was painted silver for my traffic lights poles.  I attached a 1000 Ohm resistor to the common wire, as there was always going to be only one LED lit at any point in time.

So today I built a shelf under the layout for the Arduino to sit on.  This was right under the traffic lights.  Just 30cm from the Arduino was a 4 output power board with two free sockets, so the Arduino had power.  I drilled four holes through the baseboard and fed my light poles with their wires through.  I added a pin connection to every wire from the light poles to plug into the Arduino and held my breath as I powered it on.  It was lighting up multiple lights, but the sequence seemed to be sort of working.  I attached my PC to the Arduino and went through the code again.  I had attached the Common leads to the 5V pin in the Arduino.  I was thinking that a HIGH output was to light one of the outputs.  But a LOW setting of the pin, was lighting them.  Thus one was off and two were on.  What a Dork!  I have many of these occurrences.  I could have just pulled my 5V common pin out of the Arduino and plugged that pin into the Ground pin of the Arduino.  But I thought I would change the code to swap the outputs, so LOW was a lit LED and HIGH was a turned off LED.  I also had to add code to endure that on power up, all the red lights were on and everything else was turned off.

So after compiling that changed Arduino code again, and sending it to the Arduino, the traffic light controller works like a bought one.  It just sits there churning through light sequences, and even throws in a random all yellow flash sequence, because I can.  Videoing this would create a very large video file, that would take quite some time to upload.  So I haven’t done a video yet.  Maybe next week.

Sunday, July 12, 2020

Checking the Code For the Level Crossing Actuator


Well I checked the code on my level crossing actuator system last Sunday night, and the code seemed correct.  The issue that occurred the previous weekend should not have occurred.  But if I put a delay of 50 milliseconds between one “do while” Loop and the second “do while” Loop the code now waits until the train passes the detector.  Without the delay statement, it just falls through the code.  It shouldn’t.  I can live with the 50 millisecond delay between checks for when the train reaches the detector on the other side of the crossing, and until the detector is clear.    Oh well.  It seems to work now.  I put this down to a sensor de-bounce occurring in the actuation.  However upon further testing later in teh week, on Friday and Saturday afternoon, the turning off of the sensors on a long train was causing some more issues.  So I added some specific debounce code to cater for wagons with an open underframe that seem to produce a 'no wagon' reading sensor result when there is actually a wagon there - sitting over the sensor.  So after lots more testing, it now seems to be running quite well.  There were some more tweaks undertaken after I added the sensor debounce code, as this tight loop, stopped the crossing lights from flashing as quickly as they should.  So this was easily fixed in the code.

A video of the train operating across the Bruxner Highway level crossing.

I had been studying the various photos that I had of the level crossings I am installing on the layout.  While they show that there are one set of level crossing flashers on each side of the track, each have flashing lights showing in each direction.  Most of the level crossing lights you get only show lights in one direction.  Given that my lights are all LED lit, I thought that I might have been able to just solder an LED onto the back of the existing lights and then build up some light shrouds from 4mm styrene tube and a round backing plate.  So on Monday night I soldered a second LED to back of each of the existing LED’s so the flashing lights are bi directional.  I did this to two sets of flashing lights. 

On Tuesday after work, I made a quick trip to Jaycar to pick up a couple more red LEDs, to finish the last set of flashing lights.  That was completed later that night.  But after installing the second LED to the rear of the existing LEDs, a couple of the original stopped working.

So on Wednesday I bit the bullet and removed the original LEDs that were no longer working and new LEDs were filed down to fit into the existing brass light housings and then the LED leads were soldered to the new LEDs and low and behold it was just like a bought one.  Earlier on Wednesday I was thinking about how I was to make a round disk behind the light housing for the rear facing LEDs.  I initially thought that I’d use a piece of styrene and drilling a 3mm hole in the middle.  Getting a round piece of styrene was problematic, as well as getting the hole dead in the middle.  Hmmmmm.  I thought that I must have some small metal washers, and sure enough, and they already had a large enough hole.  So I painted them black and left them to dry overnight.

On Thursday I cut down the rear light housings to a tapered shape and then painted them black.  Once dry everything was glued together and was then ready to place on the layout.  I just haven’t done it yet.

So on Saturday I commenced the installation of the second set of level crossing flashers - this one on Hotham Street, by drilling holes for the sensors and the level crossing lights.  So today I did a bit more work on the crossing, but I started by fixing up some layout fascia in that area and made a small shelf to install the Arduino on.  I have run the wires for half the sensors and I will complete the installation next weekend.

Another thing I did on Saturday evening was to update the code for my Arduino traffic light project.  This now triggers the various red, yellow and green lights.  This is also intended to be have installation commence next weekend as well.

Sunday, July 5, 2020

Installing the Flashing Level Crossing Lights on the Bruxner Highway


The first task after work on Friday afternoon was installing one of my infrared (IR) detectors under the baseboard in a section of test track and determining if they will trigger the Arduino circuit, when nestled down below the track.  So that was tested and it proved successful.  I just need the LED’s top to just protrude above the ballast.  I then moved onto improving and writing some more code for my various Arduino projects.  First I improved my level crossing circuit, by adding a reset button and logic throughout the code.  Basically if we lose a train somewhere in the circuit, or someone accidentally triggers the level crossing by their hand moving over a detector, we now have a way of turning the level crossing circuit off and allowing it to sit and wait for a real train trigger event.  The reset feature seemed to work well in my testing. 

The next project I started to work on was the traffic light code for my Arduino.  So I wrote that and tested it just with print statements to track what it was doing.  It seems to work well.  My set of “traffic lights” code has a random length of time set for the main road to have a green light followed by another random shorter length of time for the side road ‘T’ intersection to have its turn at a green light.  The logic also has a random yellow flash sequence, for a random duration of time, that can pop up occasionally to amuse people looking at the set of traffic lights.  I have some traffic signals on order, and they might get here by August sometime.   This will be another fun project to implement.  Next weekend I will replace the print statements with actual triggering of the various LED outputs in the program in readiness for the arrival of the lights.  I have a selection of red, green and yellow LEDs that I can wire up on my breadboard to test the two directions at the set of lights.  I just need to find a few 1K ohm resistors.

So Saturday morning was spent trying to find what sort of level crossing lights I might have around to install.  I found the first two crossing lights, and after about another 30 minutes of looking, I confirmed my suspicion that I indeed did have another 2 crossing lights hidden in the shed.  Now I looked at the lights but I could not work out if they had LEDs or miniature light bulbs in them.  My Arduino is only supposed to power LEDs.  I wanted to be sure what they were LEDs.  I was scratching my head, then I realised, of course it is easy to determine if they were LEDs or globes.  LED’s only conduct power in one direction.  So I got out a 3V battery power supply and connected up the flashing lights in the level crossing.  Yes they only lit in one direction and not when I reversed the power to them.  So they were LEDs.  That is a good start.

I then drilled my first hole in the baseboard for the’ Up Outer’ detector for the Bruxner Highway level crossing.  I then realised that next three detectors will be difficult to install.  I have a section of track below them, so I can’t get my drill underneath to drill out the hole for the detector. I had a think about the installation method over lunch.  So after lunch I reverted to the drill from the top in all different angles to make a hole larger underneath.  Basically I used the drill as a bit of a saw.  I test fitted the detectors and they all fitted with the detectors just having their LEDs protruding through the ballast.

So this morning, I was again scratching my head as to where to put the Arduino for the Bruxner Highway level crossing?  I decided I’d make a little shelf about 4” square for the Arduino.  I then started laying wires from each of the detectors back to the shelf.  I soldered all the GND and positive power cables for the detectors to a single point, and then back to the Arduino.  I then wired all the IR trigger connections back to separate points and then from there to the Arduino.  Then I connected the level crossing lights to the Arduino.  Everything seemed to be travelling smoothly.  Oh look, there is Mr Murphy.

Then came the test.  My bad soldering caused a short to the Arduino.  So I used a sharp knife blade to ensure that there was bridging causing the short between two solder pads on my distribution PC board, and then we had a wire come loose on the PC board.  So after fixing this, the detectors came live.  But my level crossing would not flash.  I realised that I had the common wire from the LEDs connected to the GND terminal and not the 5V positive.  So that was fixed and magic!

I actually ran a wagon through the crossing and it worked.  I then set about studying the implementation a bit closer.  I appears that I may have a bit of a logic bug in my crossing code.  Instead of the inner detectors once triggering to signify that the train has reached the opposite side of the crossing, it does not then wait until that trigger has stopped (i.e. the whole train has passed that detector).  So in my case I turn off the flashing lights as soon at the nose of the train gets to the other side of the crossing.  So later tonight I will add another “do … while” loop to the code to cater for this oversight.

So next Friday I will take the Arduino back down to the shed with my upgraded code and give it another test.  I might even take a video.

Today I have ordered another two Arduino’s, so if I am still motivated, I might look at the installation of the crossing lights at Hotham Street level crossing as my next project.  The issue with this project is that I had a set of point very close to the level crossing at both ends.  I will need to ensure that I can trigger the activation from the track that had the points set for it.  So I might need multiple detectors at each end.  Then I will have to work out if I am going to also install another set of flashing level crossing lights (which I don’t have) on the Fairy Lane level crossing.  I haven’t spent any time thinking about this as yet.  If I do, I am going to require a few more Infrared detectors from eBay.