Dani Posted February 18, 2014 Share Posted February 18, 2014 (edited) Hello, I've been some time disconnected from the forum and my layout, but I have started again with some experiments with Arduino, and I would like to share the results with all you. I took a simple Arduino UNO kit (from Sainsmart) to make a simple project to play announces in my station. I also bought an MP3 Shield from Elechouse. That was easily mounted and running, so I was able to play music files with a simple remote. Next step was to connect Arduino to my Loconet bus, and receive commands or identify trains to play sounds. For that I took a lot of information from SPCoast (http://www.scuba.net/wiki/index.php/LocoShield) and MRRWA (Modell railroading with arduino, http://sourceforge.net/projects/mrrwa). For the physical interface with Loconet I'm using a GCA50 board, mounting only the components that convert the Loconet signal to serial. Connecting this to the Arduino and using the MRRWA libraries, it's possible to receive and send any kind of loconet message. With the interface running, finally I have a complete station announcer that can recognize trains and play its announce when they stop in front of the station. It can be configured also assigning a sound to a function key of a locomotive (customized for each locomotive) or any number of output (like a switch). I keep also in the same program the remote IR functionality. Basically, the way to recognize trains without having any kind of "identification system", is as follows: When an output is activated from your throttle, a message is sent through the bus to all modules saying "Output number X activate". This is received by all devices listening the bus, but of course just the module in charge of output X executes the command. The same happens when a signaling module detects consumption in a segment, it sends a message saying "My section number X has been activated". The software controlling the layout also receives it, and it can react stopping a locomotive or changing a light. And finally, in the bus you also receive all instructions sent to the trains, like changes of speed, activation or deactivation of functions, ... So, when Arduino receives a message informing the activation of one of the configured sections, pays attention to the first locomotive setting it's speed to zero. In this last message the number of locomotive is informed, so it assumes that locomotive is the one that has stopped in this section and therefore plays it's configured announcement or sound. I created also an "easy setup" procedure using the serial console of the Arduino IDE. It's not necessary to modify the program to set up all the detecting sections, locomotives and sounds. Source code will be ready soon, I just have to clean it a little bit.... For more information, I've been posting all the advances in my blog (http://www.clubncaldes.com). If someone has more ideas, feel free to participate!! Now a lot of ideas are coming to my mind... reading and controlling all messages of the network... being able to connect all kind of sensors and drive motors, lights, ..... I think this is really the best loconect modules you can do just with a cheap Arduino!!!!! Cheers, Dani Edited February 18, 2014 by Dani 1 Link to comment
stevenh Posted February 20, 2014 Share Posted February 20, 2014 Dani, This is really cool! Love what you've done. Is it expected that there is only one train moving at a time? That way you know which train is coming into the station? Or is there a better method to determine trains in blocks? Sorry for the possible dumb questions, I've never dealt with Loconet. Steven. Link to comment
Dani Posted February 20, 2014 Author Share Posted February 20, 2014 Hi Steven, It isn't a dumb question! Thanks for your feedback. Many trains can be moving at the same time. Arduino software pays attention to the first locomotive setting its speed to zero in the two seconds following the activation of one of the possible ten detection sections. If the software is controlling your trains, it never misses because when a locomotive steps into a detection section a command of "speed zero" is sent immediately by the software, there's no possibility that other locomotive stops in the time between the "detection message" and the "set speed zero" message. If you are driving manually a locomotive while others are moving, there is the possibility than you step on the detection section with the locomotive A but before you set its speed to zero there is the coincidence that other loco B stops. In that case, it will fail and reproduce the B locomotive sound. But this is a gap of.... one second? two maximum? It's really a low probable event in a small or medium layout. For the size of my layout, where 10 locomotives are moving at the same time maximum, it has never happened. And believe me that the sound quality of a big speaker hidden in the station cannot be comparable to the small speakers of N scale, that cannot be fitted in all trains. Obviously it cannot play engine sounds depending on the speed like a sound decoder fitted in the locomotive, but for 30$ it's a lovely approach to identification and sounds in your layout. With that money you cannot even buy a single sound decoder for just one loco, or it can be complementary to it for those locos that you cannot fit sound inside. Other uses, modifying the program, can be to manage level barriers (movement, sound and lights) when you detect presence in a concrete section, horn sounds when entering a tunnel, breake sound when a locomotive arrives to a siding. Well, just let your ideas flow.... Cheers, Dani. Link to comment
Dani Posted February 28, 2014 Author Share Posted February 28, 2014 Hi, Last project update: you can download the source code from here: http://www.clubncaldes.com/2014/02/arduino-station-announcer-source-code.html I hadn't time to test it intensively, so if anybody finds a bug or has an improvement suggestion, please comment directly in my blog or send me a message. Cheers, Dani Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now