Wednesday, October 2, 2013

Two Way Infrared Beam Detected Speed Trap with LCD Display

Wow, I can not believe it has been so long since I have contributed to the Launchpad for Model Railroading Blog.  It seems only weeks ago Terry opened up this wonderful can of worms to the model rail community.

I wanted to take a quick moment to apologize for the loss of content on my previous contributed posts to this blog.  I suffered a major hard drive failure during the revision of my main website which caused a loss of several thousand files from my archives, among these were the backups of these missing images.  I just recently discovered they were missing on this blog.  I have been working to recover or redevelop these images and will be revising those posts soon.

Now, on with the show.

This project is a bi-directional speed clocking or "Speed Trap" to display the scale speed of a passing train. bi-directional means that it will work regardless of the direction the train is traveling on the track.

How does it work?

The train is detected by the use of Infrared Beam Detection or otherwise know as an Interrupters.  The train passes through two sets of detectors containing a Infrared Emitter and a Infrared Detector, when the nose of the train breaks the beam between these two components the time count starts that will be used to calculate the speed.  The specific calculation is adjustable by scale such as 160 = N Scale, etc. When the nose of the train reaches the second set of the detection components the counter stops and the code quickly calculates the speed.

The distance between the detector components is also entered into the code as well.  The default is set to 12 inches, but can easily be changed by replacing the 12 with another inch measurement.

This particular variation of this code uses an 16 Character, 2 line Liquid Crystal Display "LCD" to show the state of the "Speed Trap" and the calculated speed.  Below is a video demonstration of the prototype showing the functions.



New Video Posted as of 7/5/2015  \/


Credit to Toni Ryan for the development of the speed calculation and timing for this project.

For those new to the Launchpad for Model Railroading group-source adventure, I consider this to be an "Advanced" project.  You will never read of my describing this as "Difficult" or "Complicated" on this blog because at the source of it all, it is really quite easy to set up.  I choose the word "Advanced" as more extensive skill in electronics make this particular project much easier to understand and implement.  Also, please do not be alarmed by the spaghetti of wires shown in the diagrams below, they are quite straight forward in the connections.

Now let's discuss the parts needed:

The Red and Green LEDs mimic the Red and Green LEDs built on the MSP430 Launchpad.  These external LEDs are not required for operation but were added for the demonstration.

2 - 10  Kilo-Ohm "K" Potentiometers - you can usually find these easily online and vary in style.  A particular style is not required as long as the are 10 Kilo-Ohm "K".  These are used to control the brightness and contract of the LCD display.

2 sets - IR Emitter / Detector Pairs - these are easy to pick up at your local "Radio Shack" or equivalent electronics retailer.  Most electronics supply stores or website carry these as well.

1 16 x 2 Liquid Crystal Display "LCD"  Color choice is builder's preference as they come in multiple styles.
A good source for these wonderful gadgets are sparkfun and adafruit



A note about the LCD in this project.  
The LCD I used in this project requires a 5 Volt power source.  You can use the 5 Volt source that comes through the USB connection to power these displays, or an external 5 volt power source.  There are 3.3 Volt versions on the market which can be connected to the Vcc and Gnd connections on the launchpad to get power.  DO NOT try to power a 5 Volt LCD from the 3.3 Volt Vcc connection.  It will not work and may damage your hardware.

To use the 5 volts supplied by the USB, you need to add some connection points to your launchpad with a soldering iron.

As you can see from the photo above.  I soldered two single pin connections to my Launchpad.  You could solder wires directly to these same points, but I chose to use these so I can connect wires from my development breadboard to the power source.

I would not advise powering anything more than the LCD from this 5 Volt Source, as USB power can be very finicky depending on the hardware driving it.


Diagrams:

IMPORTANT NOTE:: Please Review my previous project Quad IR Beam Detector to better understand how the IR IR Emitters and Detectors are connected, and the theory behind how they work.  Connecting the IR Detectors wrong will damage them.  Please verify your connections before applying power.











Because there are multiple required files and libraries for this project to compile, a code snippet as been intentionally left out of this post

You can obtain the code, instructions, and schematics at hoffysworld.com


Project Schematics and Breadboard image updated to correct errors on 7/5/2015



7 comments:

  1. Great project! I followed the link, though, but have been unable to download anything.

    ReplyDelete
  2. Sorry for this issue, I have been dealing with this issue with my website on and off for weeks. If you email me directly at hoffy (at) hoffysworld.com I will gladly email you the package.

    ReplyDelete
  3. I have revised my website and disposed of the source of the downloading issues. You can now access this projects package as well as all my other public released projects at http://hoffysworld.com/downloadable-files/

    ReplyDelete
  4. Thanks. I was able to download the project after you made the changes to your site.

    ReplyDelete
  5. ERRATA NOTICE: I discovered this morning that the Schematic and graphic shown above in this post has a missing trace. This is located in the left top quadrant of the Schematic. This missing trace connects to the GND pin. Sorry for the error

    ReplyDelete
  6. Componentbuy is one of the fastest growing distributors of Semiconductors and electronic Components in the world.Supports more than 20 Millions of Electronic components sourcing needs with Engineering Data support. Locating all your required components for your design and production needs.
    Our website will act as tool for the sourcing and Design engineers on the components needs.

    ReplyDelete