G Scale Model Train Forum banner

A Talking Defect Detector - my latest Arduino Project

7K views 21 replies 8 participants last post by  backyardRR 
#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
 
See less See more
#4 ·
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?
 
#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
 
#11 ·
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:

 
#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
 
#13 ·
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.
 
#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
 
#19 ·
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
 
#22 ·
Quote:
"Could it be done with IR sensors? Probably. Does it work with lasers? Absolutely!"

From today's NY Times.

Charles H. Townes, Who Paved Way for the Laser in Daily Life, Dies at 99

Charles H. Townes, a visionary physicist whose research led to the development of the laser, making it possible to play CDs, scan prices at the supermarket, measure time precisely, survey planets and galaxies, and even witness the birth of stars, died on Tuesday in Oakland, Calif.
He was 99.
 
This is an older thread, you may not receive a response, and could be reviving an old thread. Please consider creating a new thread.
Top