element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
    About the element14 Community
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      •  Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Arduino
  • Products
  • More
Arduino
Arduino Forum Arduino for my Father's Model Railroad Layout
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 9 replies
  • Subscribers 420 subscribers
  • Views 1406 views
  • Users 0 members are here
Related

Arduino for my Father's Model Railroad Layout

e14 Contributor
e14 Contributor over 13 years ago

Hi there, I'm looking to do a little brainstorming for an idea I had involving the Model Railroad my Dad built in his basement.

 

There's 2 things I want to do.

 

1. add sound to the scenery - He has a DCC layout which gives sound to the trains themselves... but I want to add sound to the scenery.

i.e the waterfall in the corner... or the some birds in the forest... even the sound of mechanics hammering away in the maintanence yard/engine house.

 

2. Arduino controlled signal lights for sections of track based on trains in the area...

i.e Say there are 4 blocks of consecutive track - A B C D. if a train enters track block D the signal for following trains into block D should be red. the signal for block C should be amber and the signals for B should be green. It also get a little more complicated when adding track switch positions into the mix...

 

For Goal number 1 the idea would be that sounds don't play until you're standing infront of the scene. I'm not sure whether to use IR Sharp Distance sensor or a cheap Ultrasonic sensor as the triggering device. And then I don't know what to use to play the sounds.. It would need to be small speakers that can be hidden in the scenery.. I'm thinking no bigger than the size of a quarter. And then what stores and plays the sounds?

 

Goal number 2 has LED's embedded throughout the layout... some signals would be flag type signals requiring servos to move the position of the flag... My biggest problem is how do you detect the train's position on the track?

 

I want to figure out the hardware situation first, then I can start worrying about writting the programs...

I'm thinking the 2 operatons would require their own processors (2 arduino control boards) Unless it is possible to have one board control everything. But I don't know.

 

Any ideas would be great.

 

Thanks,

Guido

  • Sign in to reply
  • Cancel

Top Replies

  • billabott
    billabott over 13 years ago +1
    Okay. Great. Borrow some ideas from this guy: http://70.66.73.1/arduino.html
  • billabott
    billabott over 13 years ago

    Okay.  Great.  Borrow some ideas from this guy: http://70.66.73.1/arduino.html

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • e14 Contributor
    e14 Contributor over 13 years ago in reply to billabott

    Sweet! that's what I need for the second part! But he's not showing full circuits and code... but I might be able to figure it out.

     

    For the scenery sounds I was thinking that maybe RFID might also be a viable option for triggering a sound.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • mcb1
    mcb1 over 13 years ago

    Guy

    You have presented a well thoughtout project with good information to assist.

     

    In reverse

    2. Detection

    There are 'Hall effect' switches that detect a magnet pasing them.

    You could fit these under the train.

     

    There are also optical sensors that will see the Infra Red beam refected off a surface of the train, that can be fitted underneath.

    You could also detect the ambient light, and when the train passes over it is detected.

     

    Both are a dollar or two.

     

    1. Sounds

    The Arduino can play sounds, but a simple sound bite device (similar to the internals in childrens toys or greeting cards) is probably the easiest.

    I'm sure there are some MP3 style shields avavilable to play sounds from an SD card, which may suit your budget as well.

    Depending on which method you choose, it is relatively easy to do.

     

    The ultrasonics work well, and you can set the maximum distance, to avoid false triggering.

     

     

    I suggest you can start working on your code/sketch with a some simple switches and leds.

    There are examples within the IDE, and plenty of books and tutorials that have been suggested here before.  (search works)

     

    I suggest trying to avoid using delay() and master the "BlinkWithoutDelay" example that uses the millis() timer instead of delay.

     

    mark

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • mcb1
    mcb1 over 13 years ago in reply to billabott

    William

    beaten while typing.

     

    good link though

     

    mark

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • e14 Contributor
    e14 Contributor over 11 years ago

    A bit late but better late than never. 

     

    There are 3 ways to detect the trains - current detection, infrared, optical. 

     

    For trains on a section of track (eg to trigger trackside signals, level crossing signals), current detection works best.  Current detection requires an insulated section of track that can detect current flow when the train moves into the insulated section.  There are several off-the-shelf products that can do this, the best one being the NCE BD20 block detector.  (NCE - North Coast Engineering).  These units present a logic 1 when current flows. 

     

    Similar results can be produced with infrared detectors and optical detectors, although both are sensitive to ambient light (room lighting) and can be a real pain in the posterior.  However, the Arduino can be a good controller as you can program it with debounce functions.  For IR, there are two types of detection - cutting the IR beam, and bouncing the IR beam back to the IR detector.  Cutting the IR beam units are placed on each side of the track.  Bouncing IR beams are placed in the middle of the track so that the beam bounces off the underside of the cars going over the unit.  Optical detectors simply cut the beam. 

     

    For both IR and optical detectors, units are placed at the limits of the stretch of track where detection is required (eg on both sides of a level crossing) with the units connected to the Arduino.  As long as both or either one are detecting, the signals are operating.  Again, you will have to incorporate debounce functions in your programming. 

     

    For trackside signals, you are starting to get into some fairly complex arrangements.  A straight piece of track is relatively easy to program.  However, when you get into turnouts (aka switches) where the track goes off in two (or more) directions), things get a bit complicated.  For a turnout, this requires a mechanical switch at the turnout which can indicate which way the track is aligned. 

     

    Don't know if this helps but it's a start.  My suggestion would be to begin with a simple level crossing with some flashing lights.  Then add a bell, followed by some crossing gates connected to a servo. 

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • dtozer
    dtozer over 11 years ago

    My favorite subject, or one of them. I have been in model railways since I was 5 years old, now 68, so long time. Done design, build, clubs, HO/OO and G gauge.

    Sold and supported the first digital system back in the late 70's early 80's, Hornby of England's Zero One control system. The predecessor of DCC. Well now to the DCC realm, go to the NMRA website to dig out the general specs if you have not already done so, techie stuff, interesting for techie's. Look at the model railway mags, for books on DCC, lots of stuff. Go to NCE, TCS, Soundtraxx, and CVP for systems & decoders. Take a ride for free with JMR & Panel Pro, great stuff, open system development. If you have any questions only to grad to answer or direct you if I can. Model Railroader is a good magazine, with digital downloads and other stuff on control. Local club is also a good place to go, watch out for the rivet counters!

    Have Fun!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • dtozer
    dtozer over 11 years ago

    PS You can really get into some crazy stuff with Arduino!

    Any body know where Arduino resides!

    Something like Waldo!

    lol

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • dtozer
    dtozer over 11 years ago

    Take a look at ESU dcc sound decoders, the the Select, USA version.

    This system the decoders you program the sound files.

    I am sure they will assist you and make recommendations.

    Use speakers of no less than 1 inch and in an enclosure to enhance the sound.

    You loose a lot of quality and db's when you do not use the correct enclosure for the speaker and the correct type for the frequency range you are trying to recreate.

    Hope this helps!

    Regards

    David Tozer

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • freddie43
    freddie43 over 9 years ago in reply to billabott

    billabott

    Thanks for the link, but I am afraid from UK (and 3 years later) the connection times out

    Do you recall the title of the piece, the author, or the full url?

    Thanks

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2026 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube