Jump to content

Loconet Sound and Outputs Module with Arduino


Dani

Recommended Posts

Hello,

 

Some time ago a friend of mine bought a Sound Director Module (Loconet compatible) from Uhlenbrock. When I heard ambient sounds, train announcement and different sound effects in his layout I realized bringing sound to your layout really boosts it. I wanted to put immediately one of this in each station, town, factory and shrine. I always missed to have those train station melodies typical from Japan, and listen the ravens or the summer cicades. But more than 100€ that costs each of the sound modules was over my budget.

 

So I decided to try to do it my self, and that's what I want to share with you. It's a DIY project, but now that it has been developed, if you want it you just have to buy the different elements, plug them and upload the software. No programming skills are required, just a little bit of soldering for the Loconet Interface board.

 

This is the required hardware:

 

Arduino UNO R3 compatible board (you can have it from ebay for less that 4€):

 

%2524_57.JPG

MP3 Shield from Elechouse (both in ebay or Elechouse directly). This is the most expensive component, arround 20€:

 

Arduino%2BMP3%2BShield-1.jpg

 

Loconet shield for Arduino, you can purchase the board or complete kit to solder like any other GCA board from Rocrail site (7,5€ plus components), or do it yourself:

 

DSC_2301.JPG

 

Boards are plugged one on the top of the other, and you can use speakers from an old computer. Upload the software through the USB connection (download the free software from Arduino and clik the upload button, nothing else). And it is ready to plug in your loconet bus and start playing sounds. Train announcements can be automated through the software, so you can play the correct one for each train depending the arrival or departure track. Or you can start them manually like changing a switch.

 

This is the complete module assembled:

 

DSC_2306.JPG

 

Your MP3 sounds can be in a memory stick or SD card plugged to the MP3 shield, or copied into the internal memory. As there are still 16 free outputs left in Arduino board, you can use it at the same time as an output module for lighting. I have it installed in each station for sounds and also to manage all the lights of the station, platform and around it.

 

All the configuration is set through LNCV variables. It's the same than CV of loco decoders, but for modules. It's exclusive from Uhlenbrock, but Rocrail supports it so you don't need an Uhlenbrock command station to set up the module. Through those LNCV variables you can set up the volume, assing an output number to each of the sound files and outputs, create a dimming effect, set up the maximum intensity for lights, and many more things. It can be used also as a Loconet Monitor if you want to debug your bus traffic.

 

More detailed information and the link to download the Arduino program can be found in my blog: http://www.clubncaldes.com/2015/08/new-loconet-sound-and-outputs-module.html

 

These are some demo videos playing sound announcements, first is in Spanish, and second one with Japanese train station sounds. It really makes me feel like in Japan again. (second video was recorded at very low volume, you will have to turn your computer's volume up to listen it):

 

 

 

Cheers,

Dani

Edited by Dani
  • Like 4
Link to comment

Sorry, I forgot to say thanks to MRRWA (who did the Arduino libraries needed to communicate through Loconet, and all basic examples for programming), and SPCoast where I found the basic electrical schema to make a loconet interface. The hard work is really from these guys.

Link to comment

Dani,

 

very cool! this is the kind of stuff im tempted to start playing with minus the loco net and just using a photo sensor to trip some things in a station when the train stops for any length of time while playing with DC trains! I need to find the time to sit down and start learning arduino programming! 

 

thanks for sharing this with us!

 

jeff

  • Like 1
Link to comment

very cool! this is the kind of stuff im tempted to start playing with minus the loco net and just using a photo sensor to trip some things in a station when the train stops for any length of time while playing with DC trains! I need to find the time to sit down and start learning arduino programming! 

 

Hi, I did also a first version to be managed by a remote IR controller, so it can be used in any type of layout and system. If you want the program as an example just get in touch with me. Be careful, once you start with Arduino, it's a kind of drug.... ;)

 

  • Like 1
Link to comment

This is a great system that you have put together! The loconet and the IR are good interfaces. Maybe it would be also useful to add a DCC version that takes its inputs from any DCC bus and works as a stationary decoder, which would allow sounds to be triggered the same way as a turnout or a signal and can be programmed by selecting the address with jumpers. This would make it work for people with non loconet DCC systems.

Edited by kvp
  • Like 1
Link to comment

Dani,

 

I was afraid you were going to say that! Tempting! This is the reason I have held off on the ardunio stuff is I'm afraid I may get sucked in and want the time to be sucked in!

 

Photo sensors are also so cheap and easy to trigger ardunio stuff as well! Just program the announcement to go off if sensor is covered for more than 5 seconds (ie train stopped). The programming language is not far off others I've done, just my dyslexia to deal with on the minimalist syntax (it's very hard for my brain to tell the difference between a : and ; )

 

Soon, hopefully soon I will dive in! First project is just a simple led light controller with the $2 minis that can turn on/off LEDs in different rooms of a building on a random pattern so it looks lived in! Uber simple but I figured a good place to start! I've actually had to do a lot of device control, automation and timing control for exhibit stuff I've done in the past so by brain is already use to the logic. I just wish we had ardunio stuff 20-30 years ago! You should see some of the command and control systems I had to work with to do things like lighting, door and slide show displays -- the old days of flipping banks of toggle switches and flashing led sequences to program them! Then making pcs do it with I/o systems, now a $20 ardunio board and a few hours of fiddling. Slap a $25 rasberry pi on it if you need heavy duty brains! A different world. It's funny though with all this easy and cheap hardware to do super great physical interactive elements in exhibits, museums don't want them, all they want now is surface table displays and cell phone apps, ugh! Totally non human.

 

Cheers

 

Jeff

Edited by cteno4
  • Like 1
Link to comment

Dani, thanks for making this post. I'm interested in this as a (near) future project.

 

I've recently been playing with Arduino with my son. We're still at a basic level but having fun. I've just recently realized we could combine Arduino and n-scale. I was searching for train things that we could do it it, and I found your thread.

 

I've got a couple of questions if you don't mind.

 

1. Where did you get the station sounds?

 

2. I'm going on vacation to Tokyo next month. I could record some sounds to use. What format should I record in? What quality does the sound need to be? Is a cellphone microphone good enough or should I get something else?

 

3. I've found mrrwa.org. but haven't had a chance to go through it in detail. Off hand what are some other train related arduino projects that can be done. 

 

BTW, if you need any sounds recorded in Tokyo/Japan let me know. 

Link to comment

Hello,

 

I found all station sound in this page: http://melody.pos.to/

There is an amazing collection of sounds for all tracks of many stations and lines.

 

I'm leaving to Japan tomorrow!!! I plan to visit the snow festival in Sapporo, and then travel south to Aomori, Sendai, Tokyo and Osaka. The MP3 shield I showed in this post is able to play multiple formats, I always use MP3. In a previous trip I recorded some sounds like the traffic signals, ambient sounds, ..... with my mobile phone and work great in the shield, and the quality is more than enough.

 

When you download the Loconet libraries from MRRWA, there are included several working examples like a Throttle, a Loconet Monitor, Control Panel, and many more.

Also my github is free to download whatever you find interesting: http://www.github.com/ClubNCaldes

 

There you will find updated versions of the sound and outputs module, a Loconet <-> Ethernet (lbserver) interface por PC, the software to turn Arduino in a 4 servo control and frog polarization for turnouts, or a LocoIO board (where each pin can be configured as input or output, continuous or pulse, ..... ).

 

I'll be disconnected during all month as I'll be in Japan, when back do not hesitate in asking any question you need.

  • Like 2
Link to comment

Gavino,

 

If you plan on getting recording try to find the speaker and get as close to it as possible, align yourself in its path. When you are far from the speaker you will get the reverberation from the walls. That equated to white background noise on the file when the voice tapers off.  When the file ends the white noise drops off and it sounds like a recording. 

 

When you add the reverb via software it ends cleaner.

 

Inobu

Link to comment

Gavino,

 

If you plan on getting recording try to find the speaker and get as close to it as possible, align yourself in its path. When you are far from the speaker you will get the reverberation from the walls. That equated to white background noise on the file when the voice tapers off.  When the file ends the white noise drops off and it sounds like a recording. 

 

When you add the reverb via software it ends cleaner.

 

Inobu

 

Ok. But just to be precise....

 

As close as possible? Can I be too close? If I manage to be right beside the speaker, should I hold my phone/recorder right up to it? What's the optimal distance? Acceptable range? What's too close? Too far? 

 

What recording device is acceptable. I have a Samsung Galaxy S5. Good enough? 

 

Are there any particular sounds of Tokyo that you'd like me to record for you?

Link to comment

Generally you want to record as clearly as possible, without the sound clipping due to being too loud. Standing at platform level should be ok.

 

For noise, it's possible to smooth out most white noise at the end either down to zero or into a background noise on a loop which can be then faded out.

Link to comment

In the vicinity of the speaker.

 

Listen to this one from http://sound-of-station.com/sound/jrhokkaido/sapporo/sapporo_ticket1.mp3

 

You can tell this recording is further away from the speaker. It is bouncing off the walls. Directly under the speaker there is no reverb. Not sure how the S5 will work. Remember cell phones want to cancel out background noise. You are wanting to capture it. worth a try.

 

Departure and arrivals   

Link to comment

Generally you want to record as clearly as possible, without the sound clipping due to being too loud. Standing at platform level should be ok.

 

For noise, it's possible to smooth out most white noise at the end either down to zero or into a background noise on a loop which can be then faded out.

Practical experience will show you that white noise cover the complete frequency spectrum. When you try to remove it the desired frequency will be removed as well. For example the announcers voice is high and soft. If is caught up in the white noise and is washed out in the process. It creates a muffled sound verses a crisp high note with the white noise. Trying to loop over it will just induce clicks from the loop and creates a wave form similar to quantizing noise. That is why position near the speaker can minimize the background reverb which carries the white noise into the recording with it.

 

Once again this is from experience not a theoretical thought. 

 

Listen to this and you can hear that the recording was make quite a distance from the speaker. It has been edited but goes to silence to quickly. If the recording was cleaner the issue can be addressed. It would not be an issue if the sounds were played at a train show because the shows background noise would skew the sound as a whole. 

 

http://sound-of-station.com/sound/jrhokkaido/sapporo/sapporo_ticket1.mp3

 

Inobu

Link to comment

Gavin,

 

Might look at a simple mic system for the phone to get a more wide range sound. Tiny mics in phones are pretty narrow bandwidth and not great at picking up more open sounds, but newer phones are getting better at speaker phone operation so getting better at ambient sound as well as sound right next to the mic.

 

One problem inobu mentioned is that the builtin mics and usually mics plugged in the headphone/mic jack will get the background noise filterered off and the low stuff cut off, so you get a clearer mid range but the sound is dull or flat sounding. Some mics can go in the USB and bypass these filters and do a much more full frequency recording.

 

I had a nice little unit years ago for the iPod that went thru the USB port and had a pair of cartiod mics for stereo along with stereo mic jacks. I had a small nice very stereo cartiod condenser mic on a 10' lead so I could put the mic away from me and my noise and a neat little shotgun stereo condenser. It was great to travel with in a little pouch. It did surprising well as I've used a lot of pro gear in filmmaking and it was quite good for maybe $150 or so setup. I got into bringing back audio from travels instead of just pictures and was quite fun as listening to audio only brings back very different memories and perspectives of a trip than just image or video that combines the two. India was the best example as the videos and pictures don't bring the experience back all that vividly, but the audio only can raise the hairs on your neck! I've always been interested how audio scales can bypass the conscious mind and pop vivid pictures from memory into our minds eye w.o ours thinking about it consciously, its a real intuitive reflex.

 

Good thing about using an external mic though is that you can use a cardioid or shotgun mic to get a tighter beam on the source and not get the reflections and other ambient noise as much. You can also hold it a bit away from you or tie it to a walking stick to get away from other noise and get a better shot at the source.

 

One thing to try is find something where you are that is like a train station and see how your phone does picking up audio and you can experiment on the best ways to hold the phone for the best results.

 

Also a recorder app is a must to record and log stuff and download the audio files easier later. Scads of those out there I'm sure on android, just have to find one that has the features you need and speaks to you interface wise.

 

There are a number of sites with a lot of audio files of station announcements to get some examples to play with and experiment on.

 

One thing when doing audio its like shooting a lot of pictures. If you want really good ones you need to plan what you are doing, when doing it, experiment, review etc, so it can become a time suck quickly like photography, so you need to think if you want to invest that or spend that time exploring. For a while there I was really enjoying the audio and not shooting a lot of photos. I had the audio set up so I could just whip it out and record when something fun was there but I didn't spend time trying to track down audio bits.

 

Jeff

Link to comment

Thanks Jeff that's it in a nutshell or coconut shell its bigger.

 

Here the visual of the sound example. The white noise is the purple and the reverb is blended with the voice. This blending makes it difficult to discern between the noise and sound. That why you cannot "smooth out" the noise. it will remove the clarity of the announcers voice. 

 

gallery_153_16_47141.jpg

 

So you are better off eliminating the noise in the beginning hence getting close to the speaker and eliminating the noise insertion.

 

Inobu 

 

 

and yes I take things to the extreme.

Edited by inobu
Link to comment

Ambient noise can be fun as part of the scene in a station to recreate the environment, but in doing scale audioscapes these really don't come thru. Scale audioscapes are tricky as sound like I day does odd things with the minds eye that are not as predictable as they are doing visual tricks at scale with the minds eye. Usually it has to be done simpler and subtly in just the right spots to come off with scale audio. So it's one of those things that you just have to experiment with a lot to find the right effect that you like and it many not be universal! Also you can get a cacophony very fast that just grates on the ear or gets loud if they start competing with volume to work.

 

Last is a big issue and thats the train noise. Running a few trains on a layout gets quite loud fast with motor and wheel/track noise. I'm always surprised how loud it is when we shut down the layout and how quiet it gets and I realize my ears are ringing a little with 4 trains running. Shinkansen at speed can be quite loud.

 

But it's still fun to play with and see what you can get to work in your setup. Get a cheapo audio playback board (you can get them for $2 on ebay) and some small speakers and experiment with some audio from the web.

 

Some folks just hate audio on a layout just like animation bits. Just strikes a wrong cord in the minds eye formthem and can creep some out. Just figure out what you like and works in your layout and room.

 

Jeff

Link to comment

A lot of interesting ideas. I've never thought of taking 'audio snaps' of a vacation, but I really like the idea. I love listening to audio samples from the past. Alas I have very few. I'm actually interested in making a little audio album of my trip, regardless of the layout project.

 

I think the layout sound project would be fun. I'm still making up my mind about how 'authentic' a layout needs to be. If I make a model I want it to done as well as it can be. But I'm definitely not what you'd call a 'rivet counter'. I want to try it and decide.

 

I take the point about the phone mike. It's geared toward picking up close sounds and ignoring the ambiance. I'm interested in picking up a decent mike that isn't super expensive. I also don't want to walk around with a giant TV style boom mike. Can you tell me the make and model of the one you used. I can put it into google and use that as a starting point. I don't have a ton of time to research sound equipment right now.

 

I have some experience using audacity and some other programs to do voice editing. I'm a bit of a language buff. I've used programs to sample phrases and words, mostly to add to anki decks, for an optional pronunciation/accent model. I've never 'refined' the sound files though. I've just chopped them. But I'm fairly sure I could learn to do it.

 

So if any of y'all have software/hardware recommendations for sound acquisition/editing I'd love to hear them.

 

Also, if anyone has any requests for specific sounds from Tokyo, I'd be happy to do some gathering - eg. recording from a specific station etc. 

Link to comment

Phone microphones that are made to capture sound for video recordings are generally good and don't filter out the environment. Imho most of the time the easiest way to switch from talk mode to video mode is to record a video.

  • Like 1
Link to comment

Phone microphones that are made to capture sound for video recordings are generally good and don't filter out the environment. Imho most of the time the easiest way to switch from talk mode to video mode is to record a video.

 

Thanks. That seems like a good workaround. The video will also help to keep track of what's what.

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...