G Scale Model Train Forum banner
1 - 20 of 22 Posts

·
Premium Member
Joined
·
451 Posts
Discussion Starter · #1 ·
Good day - My wife and I have traveled across the country on Amtrak a number of times and I always take along a scanner to monitor the train's radio communications. The defect detector reports were always of interest.
This inspired me to try my hand at creating one for model railroads. After a few weeks of work I finally have it (mostly) working and thought it might be of interest to some of you.
The detector uses two small lasers and two phototransistors that sit across the track from one another. A passing train breaks the beams allowing the Arduino to compute the train's speed, length and number of axles. It also has a temperature sensor.
Once a train has passed the Arduino uses a small MP3 player to speak its report just as the real ones do!
I have placed a short video on YouTube here:
Photos, code and details of its construction are on my web page here:
http://www.trainelectronics.com/Arduino/DefectDetector/

You will note that the video and web page photos are of an HO implementation but there is no reason that this unit would not work equally well with G-scale. In fact I plan on bringing one along to the ECLSTS in March and to demonstrate it during my seminar.

Please let me know if you have any questions or ideas for enhancements beyond the ones I have listed.
thanks!
dave
 

·
Registered
Joined
·
700 Posts
That's really neat Dave. I've seen other track detectors out there, but they don't actually count axles, take temp, etc. Can your unit be customized to have a defect every now and then?
 

·
Premium Member
Joined
·
451 Posts
Discussion Starter · #3 ·
That's really neat Dave. I've seen other track detectors out there, but they don't actually count axles, take temp, etc. Can your unit be customized to have a defect every now and then?
Eric - that is on my TODO list - I have to add a menu first that allows the end-user to choose a ratio of error reports vs no defect reports.

I also want to have it trigger a radio so that the report is broadcast to a radio as it does in the real world.

great fun!

dave
 

·
Premium Member
Joined
·
998 Posts
Pardon my drooling. I didn't have any big project planned for the end of 2015, after the RR gets put away for the winter. I think I have one now.

Beyond cool.

JackM

Do you know what time/day your seminar will be at ECLSTS?
 

·
Premium Member
Joined
·
451 Posts
Discussion Starter · #5 ·
Pardon my drooling. I didn't have any big project planned for the end of 2015, after the RR gets put away for the winter. I think I have one now.

Beyond cool.

JackM

Do you know what time/day your seminar will be at ECLSTS?
Glad you liked it, Jack - my seminar is scheduled for Friday morning - probably at 9:30 or 10:00 or thereabouts - hope to see you there.
dave
 

·
Premium Member
Joined
·
451 Posts
Discussion Starter · #6 ·
Pardon my drooling. I didn't have any big project planned for the end of 2015, after the RR gets put away for the winter. I think I have one now.

Beyond cool.

JackM

Do you know what time/day your seminar will be at ECLSTS?
Glad you liked it, Jack - my seminar is scheduled for Friday morning - probably at 9:30 or 10:00 or thereabouts - hope to see you there.
dave
 

·
Premium Member
Joined
·
998 Posts
Definitely!

JackM
 

·
Premium Member
Joined
·
451 Posts
Discussion Starter · #10 ·
The Defect Detector now has menus & random defect announcements

Good day, all - I have been working on the software for the Defect Detector and the code has grown from less than 500 lines to well over 1000! This is almost all due to adding menus so that more than a dozen options can be changed from the LCD screen.
You can now individually activate or deactivate each of the reports (like temperature, speed and length) and you can set the mile marker number (000.1 through 999.9), the scale and the probability that defects will be detected.
I currently only allow for one defect report at a time. This report identifies a randomly selected axle in the range of what was counted and a randomly selected North, South, East or West side of the track. For those of you who don't want all four directions it is simple to rename files so that you only get East & West or North and South.
I tried to break the program up into many, small routines so that others can more easily figure out what is going on. I know that there are much more efficient ways to write this code but what I have done works and is fairly easy to understand.
I have added the new code and a number of photos to my web page here:
http://www.trainelectronics.com/Arduino/DefectDetector/
I plan on adding another video once I finish up a few other things.
The next step is to add a small radio transmitter to the detector so that you actually pick up the report on a scanner, just like the real thing!
Stay tuned!
dave
 

·
Registered
Joined
·
1,113 Posts
That's pretty cool.

Too bad we can't get a hold of the real railroad audio files to create a very authentic sounding detector. At least I doubt they would make these available.

I use my scanner every time I take the train and the BNSF and Metrolink digitized voices I'm familiar with are so ingrained in my mind.

I can almost hear in my mind now, "BNSF detector, milepost xxx.x, no defects, repeat no defects, total axles 44, out" (44 being the typical axle count on the Southwest Chief...the train I travel the most on).

A quick YouTube search found the exact voice and detector info I'm familiar with in my region:

 

·
Premium Member
Joined
·
451 Posts
Discussion Starter · #12 ·
That's pretty cool.

Too bad we can't get a hold of the real railroad audio files to create a very authentic sounding detector. At least I doubt they would make these available.

I use my scanner every time I take the train and the BNSF and Metrolink digitized voices I'm familiar with are so ingrained in my mind.

I can almost hear in my mind now, "BNSF detector, milepost xxx.x, no defects, repeat no defects, total axles 44, out" (44 being the typical axle count on the Southwest Chief...the train I travel the most on).

A quick YouTube search found the exact voice and detector info I'm familiar with in my region:

https://www.youtube.com/watch?v=PLnYl58uX7c

It wouldn't be all that hard to edit the clips that are on YouTube and elsewhere - The challenge would be to get every sound that you needed, like all of the digits 0--9!
The good news is that the detector uses MP3 files that are easily changed should anyone want to go that route.

dave
 

·
Premium Member
Joined
·
5,510 Posts
If you want the 'electronic' vocalization, use the Windows Narrator function.

It is the same very poor annunciation and timing as a real defector... I mean Detector. (Narrator is LOUSY at understanding the timing of syllables, spaces between words, commas, periods and other punctuation.)

If'n I had muh druthers, I'd use the old ATARI "S.A.M." (Software Automatic Mouth) program... don't bother trying the PC versions of S.A.M., they all use the same text to speech software that Narrator does. The old Atari version paid attention to punctuation and could even be made to SING!


If you want to do it in Windows, here is how...

1 Run "Sound Recorder"

Click the "Start" button and type "Sound" in the search box... "Sound Recorder" will appear at the top, click on it.

2. Run the "Text to speech" setup dialog:

Click the "Start" button and type "Narrator" in the search box... then click on "Change text to speech settings" in the list that appears at the top.

3. Type what you want the computer to say into the text box in the middle of the Text to Speech dialog box.

4. Click the "Start Recording" button on the Sound Recorder box.

5. Click the "Preview Voice" button on the Text to Speech dialog.

6. Click the "Stop Recording" button on the Sound Recorder box and type a file name in the dialog box that shows up.

Change the text in the text box and do it all again to save more files.

I know there is a way to change the Narrator's voice, but my system won't let me right now and I don't know why.
 

·
Premium Member
Joined
·
451 Posts
Discussion Starter · #14 ·
Text to Speech in Windows

If you want the 'electronic' vocalization, use the Windows Narrator function.

It is the same very poor annunciation and timing as a real defector... I mean Detector. (Narrator is LOUSY at understanding the timing of syllables, spaces between words, commas, periods and other punctuation.)

If'n I had muh druthers, I'd use the old ATARI "S.A.M." (Software Automatic Mouth) program... don't bother trying the PC versions of S.A.M., they all use the same text to speech software that Narrator does. The old Atari version paid attention to punctuation and could even be made to SING!


If you want to do it in Windows, here is how...

1 Run "Sound Recorder"

Click the "Start" button and type "Sound" in the search box... "Sound Recorder" will appear at the top, click on it.

2. Run the "Text to speech" setup dialog:

Click the "Start" button and type "Narrator" in the search box... then click on "Change text to speech settings" in the list that appears at the top.

3. Type what you want the computer to say into the text box in the middle of the Text to Speech dialog box.

4. Click the "Start Recording" button on the Sound Recorder box.

5. Click the "Preview Voice" button on the Text to Speech dialog.

6. Click the "Stop Recording" button on the Sound Recorder box and type a file name in the dialog box that shows up.

Change the text in the text box and do it all again to save more files.

I know there is a way to change the Narrator's voice, but my system won't let me right now and I don't know why.
Great suggestion! I just fooled with it and it may be a better way to generate the sound files for the detector.

FYI, under Windows 8.1 I just typed

change text to speech settings

in the search box (comes up when you hit the Windows key)

Thanks!

dave
 

·
Premium Member
Joined
·
451 Posts
Discussion Starter · #15 ·
New voice, radio transmitter & menus video

The suggestion to use Microsoft's "text to speech" function has turned out to add more realism to the defect detector. I redid the system with Microsoft's voice and made a new video. This also includes a demonstration of the setup menus and the radio transmitter.
The new video is here:


the original video is here:


Details are on my web page here:

http://www.trainelectronics.com/Arduino/DefectDetector/

Enjoy!

dave
 

·
Registered
Joined
·
691 Posts
Pardon me if this has already been asked, but have you thought about using infrared LEDs for the detector?
 

·
Premium Member
Joined
·
451 Posts
Discussion Starter · #19 ·
Pardon me if this has already been asked, but have you thought about using infrared LEDs for the detector?
I considered it but the tolerances involved in getting accurate axle counts (especially at smaller scales) makes it difficult. The lasers are quite easy to align as you can see the beam and be assured that it is just above the rail.

I use a pulsed IR LED on my speedometer (see: http://www.trainelectronics.com/speedometer/speedometer_manual.htm ) but opted for lasers here.

Could it be done with IR sensors? Probably. Does it work with lasers? Absolutely!

dave
 
1 - 20 of 22 Posts
Top