Page 3 of 10 FirstFirst 1234567 ... LastLast
Results 41 to 60 of 197

Thread: The Arduino & Model Railroading

  1. #41
    Join Date
    Dec 2009
    Location
    Lexington, KY
    Posts
    16,789
    Blog Entries
    16
    Thanks
    4,630
    Thanked 12,870 Times in 5,375 Posts
    Mentioned
    236 Post(s)
    Tagged
    0 Thread(s)

    Default

    I went on a (lazy) search for one of those reflective sensor modules that would fit inside the track gauge (for looking up between the rails) a while back. They are pretty neat little gizmos. I didn't find a suitable one, but I wasn't looking very hard. Looks like the one you've got there is plenty small enough.
    Never mistake a guy who talks a lot for a guy who has something to say...

    CH&FR Site and Blog: http://www.chfrrailroad.net and http://blog.chfrrailroad.net
    Appalachian Railroad Technology: http://www.apprailtech.com


  2. #42
    Join Date
    Mar 2011
    Location
    Windsor, Ontario, Canada
    Posts
    1,085
    Thanks
    1,665
    Thanked 2,379 Times in 604 Posts
    Mentioned
    19 Post(s)
    Tagged
    0 Thread(s)

    Default

    Quote Originally Posted by TwinDad View Post
    I went on a (lazy) search for one of those reflective sensor modules that would fit inside the track gauge (for looking up between the rails) a while back. They are pretty neat little gizmos. I didn't find a suitable one, but I wasn't looking very hard. Looks like the one you've got there is plenty small enough.
    This one is a TCRT5000. Google it, or search on eBay. They're cheap - I bought some last night for $0.20 each...

    Datasheet: http://www.vishay.com/docs/83760/tcrt5000.pdf
    Last edited by pbechard; 28th Feb 2013 at 12:01 AM. Reason: Added a link to the datasheet
    Peter

    Layout Depot (share your designs with others): www.LayoutDepot.com
    My Build Thread: www.nscale.net/forums/showthread.php?28081-Green-Valley-Railway

  3. #43
    Join Date
    Jul 2012
    Location
    TX
    Posts
    1,403
    Thanks
    717
    Thanked 3,288 Times in 773 Posts
    Mentioned
    20 Post(s)
    Tagged
    0 Thread(s)

    Default

    Guys - they are essentially no different than what I'm using. It's just a matter of placement ...

  4. #44
    Join Date
    Mar 2011
    Location
    Windsor, Ontario, Canada
    Posts
    1,085
    Thanks
    1,665
    Thanked 2,379 Times in 604 Posts
    Mentioned
    19 Post(s)
    Tagged
    0 Thread(s)

    Default

    Quote Originally Posted by Nskale View Post
    Guys - they are essentially no different than what I'm using. It's just a matter of placement ...
    NSkale - I complete agree - they're essentially the same thing, and both work great. I'm sorry if I seemed to be pushing against your solution, that wasn't my intention. Thanks for your testing and ideas on this... it's nice to see others tinkering with Arduino and MRR together.

    -----------

    A guy at the club built an HO speedometer car - a tiny magnet on the axle, a hall sensor to detect axle revolutions, an Arduino nano inside, and a 16x2 screen (like you see in my earlier post) was mounted in the side so you could see your scale speed in mph and kph, and distance travelled since last reset (buttons mounted in the side corners). Amazing little project!

    So many things to do....
    Peter

    Layout Depot (share your designs with others): www.LayoutDepot.com
    My Build Thread: www.nscale.net/forums/showthread.php?28081-Green-Valley-Railway

  5. The Following 2 Users Say Thank You to pbechard For This Useful Post:


  6. #45
    Join Date
    Jul 2012
    Location
    TX
    Posts
    1,403
    Thanks
    717
    Thanked 3,288 Times in 773 Posts
    Mentioned
    20 Post(s)
    Tagged
    0 Thread(s)

    Default

    Quote Originally Posted by pbechard View Post
    NSkale - I complete agree - they're essentially the same thing, and both work great. I'm sorry if I seemed to be pushing against your solution, that wasn't my intention. Thanks for your testing and ideas on this... it's nice to see others tinkering with Arduino and MRR together.
    You're doing some interesting things. I'd like to know where you are going to use the display because I was thinking of doing one but I couldn't see where it would go on the layout. Please elaborate on your setup.

    But I've been there, done that, with IR reflection.

    The Chinese modules I got I installed under the tracks pointing up (they use the same IR parts) - to use reflection from the bottom of the cars - it sucked. Why? Because the cars (and engines) don't have consistent reflectivity. They all have different colors and reflectivity. I ended up putting white tape on the bottom of the engine tanks to make a consistent target across all the engines. As far as using the individual cars to trigger them --> reliably <-- ?

    Fuggetaboutit.

    Line of sight detection is the way to go. When the beam is clear, it's clear and the same power. When it's blocked it's blocked. It's digital as opposed to an analog type response from reflectivity. It works way better than reflectivity. Trust me.

  7. The Following 2 Users Say Thank You to Nskale For This Useful Post:


  8. #46
    Join Date
    Mar 2011
    Location
    Windsor, Ontario, Canada
    Posts
    1,085
    Thanks
    1,665
    Thanked 2,379 Times in 604 Posts
    Mentioned
    19 Post(s)
    Tagged
    0 Thread(s)

    Default

    I'm thinking that this screen will be mounted on the sloped roof of a building, with the arduino and guts inside. The "hotbox" sensor will setup near the tracks. I'd like to keep it portable so I can move it around between operating sessions. I'll likely do a "build thread" for this project once I start past the prototyping/breadboard stage.

    Another idea I've tinkered with, instead of break-the-beam IR, is to break the beam with a laser and a light dependant resistor (LDR). Range is (MUCH) longer than the IR. I've dissambled a dollar-store laser pet toy and basically treated it like an LED (from an Arduino perspective). Use a high enough resistor to avoid burning out the laser though. For one thing, it'll be easier to align than an invisible IR beam! I haven't installed anything like this... just played around with it for ideas. Not sure of the lengevity of this solution.
    Peter

    Layout Depot (share your designs with others): www.LayoutDepot.com
    My Build Thread: www.nscale.net/forums/showthread.php?28081-Green-Valley-Railway

  9. #47
    Join Date
    May 2005
    Location
    Southern Colorado
    Posts
    3,059
    Blog Entries
    8
    Thanks
    1,279
    Thanked 1,965 Times in 928 Posts
    Mentioned
    30 Post(s)
    Tagged
    0 Thread(s)

    Default

    I've considered the same as a possible method of replacing current sensing block detectors, but there are inherent problems which make lasers unsuitable for that particular task. The visible laser light limits its usefulness to hidden trackage (unless you don't mind seeing the bright red searchlight beam flashing your trains). Also, it is only suitable for long straight blocks, or curved blocks with some limitations. First, there must be a clear line of sight between the two ends of the block. Second, the arc outside the laser line must not be longer than your shortest train, or you can get a false clear indication. Thinking more about it as I type this though, I suppose you could use mirrors to bounce the laser light around the curve... Something that would have to be tinkered with.

    I'd be more inclined to try it if there were non-visible light lasers available cheaply, but I am not aware of any.
    "Do Not Hump!?!?! Does that mean what I think it means?!?"--Michelle Blanchard

    "People saw wood and say nothing, but railroad men saw trains and say things that are better left unprinted."--Charles De Lano Hine

    Down with UP

  10. #48
    Join Date
    Jul 2012
    Location
    TX
    Posts
    1,403
    Thanks
    717
    Thanked 3,288 Times in 773 Posts
    Mentioned
    20 Post(s)
    Tagged
    0 Thread(s)

    Default

    Quote Originally Posted by pbechard View Post
    I'm thinking that this screen will be mounted on the sloped roof of a building, with the arduino and guts inside. The "hotbox" sensor will setup near the tracks. I'd like to keep it portable so I can move it around between operating sessions. I'll likely do a "build thread" for this project once I start past the prototyping/breadboard stage.
    Yea that would be fun, I'd like to do do something similar, like put up a train indicator electronic billboard in the yard.

    But, won't the purists poo poo us if we do those things on our layout?

    Another idea I've tinkered with, instead of break-the-beam IR, is to break the beam with a laser and a light dependant resistor (LDR). Range is (MUCH) longer than the IR. I've dissambled a dollar-store laser pet toy and basically treated it like an LED (from an Arduino perspective). Use a high enough resistor to avoid burning out the laser though. For one thing, it'll be easier to align than an invisible IR beam! I haven't installed anything like this... just played around with it for ideas. Not sure of the lengevity of this solution.
    I've got a laser and photocell. I'm pretty sure I could make it work too, but like the other guy said, it's going to look like the Terminator is after your train.

    Have you heard of Fritzing? It's a free app you can use to document your Arduino wiring. It's super-easy to use and even generates schematics.

    You can get it here -

    http://fritzing.org/

    I attached a diagram of the circuit I used to detect trains made using the fritzing app, although it's pretty simple. The key part of the problem is to align the beam at an angle to the train. The diagram is not meant to show that.
    Attached Images Attached Images

  11. #49
    Join Date
    Mar 2011
    Location
    Windsor, Ontario, Canada
    Posts
    1,085
    Thanks
    1,665
    Thanked 2,379 Times in 604 Posts
    Mentioned
    19 Post(s)
    Tagged
    0 Thread(s)

    Default

    A laser will light up a Photocell no problem - I've tested this before. Like NSkale said, it would be for hidden track only, anywhere else would look odd. You can still go across the rail, or a long straight distance where just need to know "yup, there's something on the track".

    I've heard of Fritzing before, but have not used it yet.
    Peter

    Layout Depot (share your designs with others): www.LayoutDepot.com
    My Build Thread: www.nscale.net/forums/showthread.php?28081-Green-Valley-Railway

  12. #50
    Join Date
    Dec 2009
    Location
    Lexington, KY
    Posts
    16,789
    Blog Entries
    16
    Thanks
    4,630
    Thanked 12,870 Times in 5,375 Posts
    Mentioned
    236 Post(s)
    Tagged
    0 Thread(s)

    Default

    Quote Originally Posted by ranulf View Post
    I've considered the same as a possible method of replacing current sensing block detectors, but there are inherent problems which make lasers unsuitable for that particular task. The visible laser light limits its usefulness to hidden trackage (unless you don't mind seeing the bright red searchlight beam flashing your trains). Also, it is only suitable for long straight blocks, or curved blocks with some limitations. First, there must be a clear line of sight between the two ends of the block. Second, the arc outside the laser line must not be longer than your shortest train, or you can get a false clear indication. Thinking more about it as I type this though, I suppose you could use mirrors to bounce the laser light around the curve... Something that would have to be tinkered with.

    I'd be more inclined to try it if there were non-visible light lasers available cheaply, but I am not aware of any.
    I've seen an application where an LED (not sure if it was LED or Laser but the principle holds) beam was bounced Zig-Zag fashion across the legs of a staging yard ladder. One beam covered something like 12 tracks. The intent was to detect whether the ladder itself was fouled, not to detect track occupancy. It was a pretty clever setup.



    Quote Originally Posted by Nskale View Post
    Have you heard of Fritzing? It's a free app you can use to document your Arduino wiring. It's super-easy to use and even generates schematics.
    IIRC, Fritzing can also serve as a fairly inexpensive PCB fabrication service as well... it's a pretty cool deal.


    Geez I need to get some budget priority back onto electronics ideas... or hurry up and get the scenery done on the layout. This stuff is too cool to be left sitting on the sidelines.

    Maybe I should look into some Kickstarter funding or something...
    Never mistake a guy who talks a lot for a guy who has something to say...

    CH&FR Site and Blog: http://www.chfrrailroad.net and http://blog.chfrrailroad.net
    Appalachian Railroad Technology: http://www.apprailtech.com


  13. #51
    Join Date
    Jul 2012
    Location
    TX
    Posts
    1,403
    Thanks
    717
    Thanked 3,288 Times in 773 Posts
    Mentioned
    20 Post(s)
    Tagged
    0 Thread(s)

    Default

    OK, on to the next app. I'm working on a car counting program that uses the same devices. In this case, it will be set up to see the gaps. I want it to count all the units (engine and cars) and report the count and the total time that the train took to pass the detector position.

    I know what you're thinking - "Nskale, how will you know when the last car has passed?"

    Wait and see ...

  14. #52
    Join Date
    Apr 2007
    Location
    Christiana, TN
    Posts
    603
    Thanks
    4
    Thanked 400 Times in 257 Posts
    Mentioned
    22 Post(s)
    Tagged
    0 Thread(s)

    Default

    Quote Originally Posted by Nskale View Post
    ...I know what you're thinking - "Nskale, how will you know when the last car has passed?"...
    Two sensors placed a distance apart so that they can not both be seeing a gap at the same time. When both sensors are clear, the train has passed.

  15. #53
    Join Date
    Jul 2012
    Location
    TX
    Posts
    1,403
    Thanks
    717
    Thanked 3,288 Times in 773 Posts
    Mentioned
    20 Post(s)
    Tagged
    0 Thread(s)

    Default

    Quote Originally Posted by CSXRobert View Post
    Two sensors placed a distance apart so that they can not both be seeing a gap at the same time. When both sensors are clear, the train has passed.
    No, I'm still using only one set of sensors. The method you suggested is, strickly speaking, better than what I am programming, but I think what I'm doing will be sufficiently accurate for 99% of cases.

    It's a little harder than the last program so I'm still working on it.

  16. #54
    Join Date
    Mar 2011
    Location
    Windsor, Ontario, Canada
    Posts
    1,085
    Thanks
    1,665
    Thanked 2,379 Times in 604 Posts
    Mentioned
    19 Post(s)
    Tagged
    0 Thread(s)

    Default

    Quote Originally Posted by Nskale View Post
    No, I'm still using only one set of sensors. The method you suggested is, strickly speaking, better than what I am programming, but I think what I'm doing will be sufficiently accurate for 99% of cases.

    It's a little harder than the last program so I'm still working on it.
    Programmatically, what I did was capture the millisecond timestamp of each car going by, making note of the time the car was no longer detected. If more than X seconds go by without another detection, I assume there is no car in the way. Of course, this could also mean the train stopped with the sensor aligned with a gap.
    Peter

    Layout Depot (share your designs with others): www.LayoutDepot.com
    My Build Thread: www.nscale.net/forums/showthread.php?28081-Green-Valley-Railway

  17. #55
    Join Date
    Jul 2012
    Location
    TX
    Posts
    1,403
    Thanks
    717
    Thanked 3,288 Times in 773 Posts
    Mentioned
    20 Post(s)
    Tagged
    0 Thread(s)

    Default

    Quote Originally Posted by pbechard View Post
    Programmatically, what I did was capture the millisecond timestamp of each car going by, making note of the time the car was no longer detected. If more than X seconds go by without another detection, I assume there is no car in the way. Of course, this could also mean the train stopped with the sensor aligned with a gap.
    Yep, yep, sounds familiar. We'll have to compare code when I get it done.

  18. #56
    Join Date
    Dec 2009
    Location
    Lexington, KY
    Posts
    16,789
    Blog Entries
    16
    Thanks
    4,630
    Thanked 12,870 Times in 5,375 Posts
    Mentioned
    236 Post(s)
    Tagged
    0 Thread(s)

    Default

    <munches popcorn> This is fun!
    Never mistake a guy who talks a lot for a guy who has something to say...

    CH&FR Site and Blog: http://www.chfrrailroad.net and http://blog.chfrrailroad.net
    Appalachian Railroad Technology: http://www.apprailtech.com


  19. The Following 2 Users Say Thank You to TwinDad For This Useful Post:


  20. #57
    Join Date
    Apr 2010
    Location
    Ashland Oregon
    Posts
    4,746
    Blog Entries
    3
    Thanks
    4,122
    Thanked 3,927 Times in 1,884 Posts
    Mentioned
    23 Post(s)
    Tagged
    0 Thread(s)

    Default

    Two sensors placed a distance apart so that they can not both be seeing a gap at the same time. When both sensors are clear, the train has passed.
    The same thing can be accomplished with one set of sensors placed at an angle across the track, not 90* to it.

  21. #58
    Join Date
    Jan 2005
    Location
    Antelope, Calif USA
    Posts
    4,722
    Blog Entries
    6
    Thanks
    1,841
    Thanked 2,464 Times in 1,257 Posts
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)

    Default

    Quote Originally Posted by Michael Whiteman View Post
    The same thing can be accomplished with one set of sensors placed at an angle across the track, not 90* to it.
    I agree that can be done if you want to use a solid beam, but if you want a reflected beam that is perhaps between the rails and less visable, it seems two would be better. It does not seem to me, the non programmer, to add that much complexity. It is an OR istuation. If beam1 or beam2 has a reflection, you have detection. If beam1 and beam2 are clear, you have no detection.
    Sean McC

    "No man is a failure ...

    who has friends." -- Clarence

  22. #59
    Join Date
    Dec 2003
    Location
    Columbus,OH, USA
    Posts
    3,266
    Thanks
    80
    Thanked 1,586 Times in 918 Posts
    Mentioned
    46 Post(s)
    Tagged
    0 Thread(s)

    Default

    In my experience, optical detection has problems with some types of cars.

    Between the rails detection has trouble with empty well cars ( too much air in the middle of the car ).

    Sensors mounted on the side of the track can miss either flatcars ( especially empty ones ) or tank cars depending on how the sensor is mounted.

    This is the main reason my preference is for current sensing detectors.

    Paul

  23. #60
    Join Date
    Apr 2007
    Location
    Christiana, TN
    Posts
    603
    Thanks
    4
    Thanked 400 Times in 257 Posts
    Mentioned
    22 Post(s)
    Tagged
    0 Thread(s)

    Default

    Quote Originally Posted by Michael Whiteman View Post
    The same thing can be accomplished with one set of sensors placed at an angle across the track, not 90* to it.
    Yes, for simple detection one sensor at an angle will suffice. That was already covered earlier in the thread. My two sensor solution was in response to wanting to see the gaps to count the cars. With only one sensor, when you see a gap, is it a gap between cars or the end of the train? The timing solution will work fine as long as the train can not stop while passing the sensor. If the train can stop, then the two sensor solution would be better - if one sensor is blocked and the other is not, then you are seeing a gap, if both sensors are unblocked, then the end of the train has passed.

Similar Threads

  1. Model Power Haunted House using Arduino Micro Controller
    By ndronet in forum Structures & Scenery
    Replies: 7
    Last Post: 12th Oct 2018, 10:24 AM
  2. 3D printing and model railroading
    By vikingservices in forum General Rail Discussion
    Replies: 0
    Last Post: 11th Feb 2013, 12:58 PM
  3. Your interest in railroading/model railroading?
    By simpdogg in forum General Rail Discussion
    Replies: 22
    Last Post: 10th Jul 2007, 11:39 PM
  4. Model Railroading subscription
    By ragnarock4 in forum General Rail Discussion
    Replies: 14
    Last Post: 28th Apr 2006, 03:38 PM
  5. Digitrax/DCC/Model Railroading on DIY
    By colonel_26 in forum DCC
    Replies: 2
    Last Post: 6th Jun 2004, 12:21 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •