Model Railway Station Sounds

Add fun to your layout, through addition of station sounds of your own choosing from steam sounds, whistles, phone rings, disco music, train announcements, etc.

Most of the cheap IR receivers found online are too sensitive to surrounding light sources such as daylight and and electrical lighting. The TSO2138 use here has an in-built filter to cancel this noise giving a clean reception of IR coding.
The circuit includes an Arduino Pro Mini with IR input and an SD card module. We also have an audio amplifier chip TDA2822 with a volume control potentiometer and a 8 ohm, 0.5 watt, 2 inch diameter speaker.

Powered by the model railway DC voltage 12v/14v

The Arduino sketch is provided here plus some example sound files in .wav format.

Please refer to another Instructable on how to convert sound files for use on the Arduino SD card module.

Circuit diagrams are included above.

Arduino / sd card components:

4 off Ceramic Capacitor voltage 25V; capacitance 100 nF; package 200 mil

2 off Capacitor Polarized ; package radial 100uf 25v

1 off Capacitor Polarized ; package radial 470uf 25v

2 off 10 Ω Resistor; spacing 400 mil;

2 off Screw terminal - 2 pins hole size 1.0mm,0.508mm;

1 off Voltage Regulator variant sink; chip 78009; voltage 9V; package TO-220

1 off Generic female header - 3 pins hole size 1.0mm,0.508mm;

1 off Trimmer Potentiometer track Linear; type maximum resistance 10kΩ; 6mm

1 off Generic female header - 6 pins hole size 1.0mm,0.508mm;

1 off IC TDA2822 pins 8 DIL;

1 off mini 8 ohm speaker similar to: eBay

1 off Arduino compatible SD card module similar to: eBay

1 off micro sd 1 Gb memory card similar to: eBay

1 off IR transmitter (tv remote) similar to: eBay

IR receiver components :

1 off IR receiver TSOP2138

1 off 100 Ω Resistor ; pin spacing 400 mil;

1 off 10k Ω Resistor ; pin spacing 400 mil;

1 off Capacitor Polarized ; radial 4.7uf 25v

1 off Generic male header - 3 pins hole size 1.0mm,0.508mm; row single;

Step 1: Printed Circuit Boards

Printed Circuit Boards available on eBay - the main PCB contains the Arduino Pro Mini module, SD micro card module, TDA amplifier and 9 volt regulator plus connectors, capacitors and resistors. A small PCB is also required to hold the IR receiver circuit.

Although the circuit diagram shows the use of sockets for the Arduino Pro Mini , it should be soldered directly onto the PCB to avoid overlapping the SD card module.

The system takes sound files in .wav format on the micro sd card through the TDA amplifier to the 8 ohm 0.5 watt mini speaker. Each sound file is selected via an IR receiver circuit from a mini IR remote transmitter.

The system may be built into a layout building such as a station, or mounted under the layout board. You will need to have the IR receiver within sight of the IR beam from the transmitter.

Step 2: Sound Files

Sound files - attached files are example of train sounds. You may record your own to suit the purpose.

Step 3: Arduino Pro Mini Code

Arduino Pro Mini code:

#include "SD.h"<br>#include "pcmRF.h"
#include "pcmConfig.h"
#include "TMRpcm.h"<br>#define SD_ChipSelectPin 10  //use digital pin 4 on arduino nano 328
TMRpcm tmrpcm;   // create an object for use in this sketch
#include "IRremote.h" <br>// Start the receiver<br>IRrecv irDetect(A2);  // Arduino A2 Pin for infrared sensor
decode_results irIn;  // define functions attached to IR remote input keys
#define Play1 16738455  //1 these are the codes for the IR transmitter used
#define Play2 16750695  //2
#define Play3 16756815  //3
#define Play4 16724175  //4
#define Play5 16718055  //5
#define Play6 16743045  //6
#define Play7 16716015  //7
#define light_1 16730805  //0
#define light_2 16728765  <br>boolean L1, L2;

void setup(){<br>Serial.begin(9600);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  
   Serial.println("... Initializing");
  tmrpcm.speakerPin = 9; //11 on Mega, 9 on Uno, Nano, etc
 
  if (!SD.begin(SD_ChipSelectPin)) {  <br>// see if the card is present and can be initialized:
    Serial.println("... Initializing");
  return;   <br>// don't do anything more if not
  }
  Serial.println("... done");
 tmrpcm.setVolume(4);
 tmrpcm.play("station2.wav"); <br>//the sound file "1" will play each time the arduino powers up, or is reset
 delay (2000);
 
// Start the receiver
irDetect.enableIRIn(); 
Serial.println("Finished setup - Waiting for Key Press");
}
 void loop(){
if (irDetect.decode(&irIn)) {
    Serial.println("Translating..... Please Wait....."); 
    translateIR();
    Serial.println(irIn.value,DEC);
    delay(200);
    irDetect.resume(); <br>// Receive the next value  
  } 
}<br>void translateIR() <br>// takes action based on IR code received<br>{
  switch(irIn.value)
  {
    case Play1: play1(); break;
    case Play2: play2(); break;
    case Play3: play3(); break;
    case Play4: play4(); break;
    case Play5: play5(); break;
    case Play6: play6(); break;
    case Play7: play7(); break;
    case light_1: light1(); break;
    case light_2: light2(); break;
    
    default: Serial.println("Key not configured");
  }
 delay(200);
  }
void light1(){
  L1 ^= 1;
digitalWrite(3, L1);
Serial.println(L1);
      }     
void light2(){
  L2 ^= 1;
digitalWrite(4, L2);
Serial.println(L2);
      }       
 void play1(){
      tmrpcm.play("noah2.wav");
      Serial.println("... playing 1");
       delay (2000);
 }<br>void play2(){
      tmrpcm.play("station1.wav");
      Serial.println("... playing 2");
       delay (2000);
 }
 void play3(){
      tmrpcm.play("station2.wav");
      Serial.println("... playing 3");
       delay (2000);
 }
 void play4(){
      tmrpcm.play("phone.wav");
      Serial.println("... playing 4");
       delay (2000);
 }
 void play5(){
      tmrpcm.play("whistle.wav");
      Serial.println("... playing 5");
       delay (2000);
 }
 void play6(){
      tmrpcm.play("train.wav");
      Serial.println("... playing 6");
       delay (2000);
 }
void play7(){
      tmrpcm.play("train2.wav");
      Serial.println("... playing 6");
       delay (2000);
 }

Share

    Recommendations

    • Cardboard Challenge

      Cardboard Challenge
    • Toys Contest

      Toys Contest
    • Faux-Real Contest

      Faux-Real Contest

    Discussions