Showing posts with label Arduino. Show all posts
Showing posts with label Arduino. Show all posts

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.

Sunday, January 7, 2018

Experimenting with Arduino micro-controllers

When I was still working one of the systems I was responsible for used an Allen-Bradley Programmable Logic Controller or PLC.  The PLC itself was so reliable it never required any repair and I just had to make minor programming and wiring changes depending on my employer's needs.  I used to think something like this would be great for doing things on a model railroad but of course these PLC systems are for commercial applications and are not cheap.  So what I was really thinking of was something similar but smaller and at a consumer price.

Shortly after retiring 5 years ago I discovered the Arduino line of micro-controllers and purchased a Uno board at Radio Shack to play around with.  I taught myself to write some code for it and set up several simulated model railroad applications with LED's on a proto-board but found the mounting and connections to be awkward for practical applications.
More recently I discovered the Arduino Nano on ebay which does about the same job as the Uno but is physically a bit smaller.

What makes it work for me is that for a very reasonable price I can get a terminal board kit that  the Nano plugs into and that has mounting holes.

The programming is done by using an editor program downloaded from the Arduino web site.  The programs are checked and compiled by the editor and loaded onto the Arduino by USB connection to your computer.



The outputs of the Arduino are limited to 40ma which is fine for most LED's not for bigger loads such as a relay.  These small relay modules are powered separately from the Arduino and the input uses an opto-isolator device so the output of the Arduino is protected.  These come in single or multiple relay configurations and are also reasonably priced on ebay.



So with these building blocks I am ready to start some practical projects on the Palisade Canyon layout or on my Ntrak or AsiaNrail modules.  Some of the ideas I have include:

  • Grade crossing flashing light and bell
  • Staging yard controls
  • Point to point operation with stops and turnouts
  • Model buildings lights on and off
  • Signal controls
  • RFID reading and train routing