Thursday, January 11, 2018

My first Arduino project - a grade crossing

I have always wanted to create an automated grade crossing. Several years ago I had purchased a grade crossing bell sound module and a pair of NJ International crossing signals with LED signals.  I have experimented with these items a few times but never got around to actually incorporating them into a layout.

As mentioned in the last post for the past few years I have also been experimenting with Arduino micro-controllers.  It was time to bring everything together.  The road that connects a few industries in Battle Mountain to the rest of the world seemed like a good place to finally create a nice crossing scene.

It was a bit of work but I have the results I was looking for, an automatic grade crossing signal with flashing lights and bell sound.  Work remains to be done to finish the scene but this photo shows it working.


It took all this hardware under the layout to make this grade crossing happen.  Probably not the most efficient setup but it works.


Infrared sensor pairs are hidden in the scenery on either side of the grade crossing.  In this photo looking up from a low angle one of the receivers can be seen inside a cave in one of the rock outcroppings.  At a normal viewing angle this is hardly noticeable.

Transmitters are embedded into the scenery on the ground on the other side of the track and because they face away from the viewer they can't be seen at all.


And now for the tricky bits


Here is the complete schematic drawing of this project.    After almost 1 year with a new computer and learning new versions of software,  I think I am finally getting up to speed with the latest version of Microsoft Visio.



The code and some other notes:

This program is only using part of what the Arduino Nano can do and only using a small part of space available for program storage.

No gates on this crossing but they could be could be added if desired using left over outputs.  I have seen on the Internet where the analog outputs can be used to drive a servo but I have not tried this yet myself.

Arduino outputs are rated for 40ma.  There are a total of 8 LED's on the signals wired in pairs.  I measured the current flow on each pair of LED's at 6ma so two outputs could have done them all but since I had extra outputs I elected to use 4 outputs with each output running 1 pair of LED's.

Sound module runs continuously with connection to the speaker controlled by the relay.  One sound module could be used for multiple crossings with each crossing having it's own Arduino controlled relay module.  The sound module will drive a small 8 ohm speaker.
 

Approximate costs and sources:

  $5.00 - Relay module, ebay
  $6.00 - Arduino Nano, ebay
  $4.00 - Arduino Nano terminal adapter board, ebay
$89.95 - Azatrax MRD8 detector set,  Azatrax
$39.00 - Sound effects module, ITT Products
$35.00 - Crossing signals, NJ International

I had originally acquired the 8 channel Azatrax unit to work with staging yard automation and plan to replace it in this application with a pair of single channel units at $20.00 each and move the MRD8 to it's original purpose.  Azatrax also offers a unit specifically for grade crossings which might not require the use of an Arduino at all.

Now that the ice has been broken for me with the Arduino I hope to try out some other projects in the near future.

2 comments:

  1. Nice setup, Brad.
    Just consinder the following for larger projects :
    Delay() pauses the atmega resulting in a delayed reaction of "sensorState". Substituting the delay() with a millis() comparison will allow you to simultanously alter your ports status and react on "sensorState" change.

    ReplyDelete
    Replies
    1. Thanks Mike, It was not clear from the examples that mills could be used in that way. When I get some more Nano boards I'll try it out.

      Delete