Wednesday, January 15, 2014

Station Announcer final project

Finally I have a stable version of the station announcer running in Arduino and suitable for both analog (through a remote controller) and digital systems (with Loconet bus). I'll try to explain everything in an easy way, but be careful, I won't be responsible for any damage or any mistake in explanations!!!

First of all, the list of materials:

  • Arduino UNO R3: About 15$ or less in ebay
  • Elechouse MP3 shield with built in amplifier: 21.5$
  • Remote controller and IR receiver: 6$
  • pc speaker from an old PC (or new, did you ever used it???): 0$
  • To make the Loconet interface, components are 5$ more or less, and you can mount it in a protoboard shield or use directly a GCA50 board from Giling Computer Aplications (5€). I'm working designing my own Loconet interface shield, but meanwhile Giling GCA50 does the job perfectly. Giling Boards

And now the pre-requisites:

How to upload a program to Arduino board:
  1. Connect Arduino board with the USB wire to the PC
  2. Open the Arduino IDE and from there, open the source code downloaded from sourceforge (hanasuLNet_ino.ino)
  3. In Arduino IDE, select the serial port that has been installed (usually is the last one) in Tools -> Serial port
  4. Also select your arduino board (UNO) in Tools -> Board
  5. If you have the MP3 shield plugged: as the MP3 shield uses the same serial port as the PC connection, you have to put MP3 shield in sleep mode or the PC link will not work. There is a push button in MP3 shield named "Sleep", just push it 3 seconds.
  6. Now click the download button (round button with an arrow) in the IDE and wait the progress bar
  7. It's done!!!! If you have any problem, review Arduino help: http://arduino.cc/en/Guide/Windows

IR Receiver connection:
The IR receiver has three legs. One goes to the +5V pin, other to the GND pin, and the third one to the I/O number 11. Here you have a very good tutorial about IR: http://arduino-info.wikispaces.com/IR-RemoteControl

Now plug an USB or SD card to the MP3 shield and it's ready to work. Following the MP3 Shield instructions, you will see it's possible to copy files in the internal memory, so there's no real need of having a memory stick or SD card always connected.

The remote controller has various functions:
  • MODE key selects the sound source (internal memory, memory stick or SD card)
  • Volume controls
  • Power button stores the current volume and mode values in the non volatile memory (it's like a "save config" button)
  • With the number keys you can select a file number (in the order they were copied to the memory) and pressing the play button it will play the file.
  • It's also possible to use the NEXT and PREVIOUS buttons to play directly the next or previous MP3 file


Here there is a video of the station announcer in action:






I'll continue in a new post for the Loconet part. Enjoy it!!!



Thursday, December 19, 2013

Station Announcer running in a protoboard

I'm still waiting my Arduino UNO to arrive, but meanwhile I did some successful tests with a NANO.

If you followed my previous posts, I tested an MP3 shield for Arduino communicating via hardware serial:

http://www.clubncaldes.com/2013/12/arduino-project-station-announcer.html

And later, I ran a Loconet serial monitor also on Arduino to intercept the Loconet bus messages:

http://www.clubncaldes.com/2013/12/station-announcer-loconet-interface-for.html

Now I joined both experiments and changed a bit the source code to play a different MP3 file assigned to each activated output. Each time an output is activated, I play the same MP3 file number. The speaker you see has been taken from an old computer:


I activate the output through Intellibox keyboard, but it also works activating an output from the computer.

Now I have to wait the Arduino UNO and the numpad, and make a clean source code. The goal is to activate a sound typing the sound number in the numpad or via Loconet assigning a digital output to each file.

I hope to post the final result soon!!!


Sunday, December 8, 2013

Station Announcer: Loconet Interface for Arduino

Let's go for the second part of the project: Loconet Interface for Arduino.

I found a very interesting page talking about a Loconet Shield for Arduino. It's www.scuba.net (SPCoast, Railroading on the Southern Pacific Coast). They developed a shield for Arduino called LocoShield and wrote the needed libraries. In this page you can find all the information (electrical schema, Eagle files, Gerber files for fabrication...): http://www.scuba.net/wiki/index.php/LocoShield

And it looks like this:



The software (Arduino libraries and examples) are published in the MRRwA Project SourceForge Project: http://sourceforge.net/projects/mrrwa/

But unfortunately they don't produce the boards and nobody sells them, and the price to make just 5 or 10  is too expensive. Just if more people would be interested for a total production of 100 or more, then it would make sense. And I don't want to isolate my own boards because I never did it and I'm not skilled.

 Another problem I saw is the power source. Arduino and MP3 Shield need 5Vcc to function and I can't take them from Loconet wires, and there is no 5Vcc power source supply in my layout... or there is? If I well remember, Peter Giling boards (the ones I use in my layout) have a different Loconet connector with the common signals of loconet plus 5Vcc to feed directly his interface boards through the same Loconet wire. GCA101 is the Ethernet-Loconet interface plus 3Amp power source of 5Vcc to feed all loconet boards (GCA50). So I have it!!!

Then, it would be greate to feed also Arduino from here and avoid more wires and power sources. Looking closer to the GCA50 electrical schema, it's almost identical to LocoShield from the Loconet DB9 connectors to PIC. The board feeds the PIC16F873 with 5Vcc taken from the DB9 Loconet connector, and converts the Loconet signal to a PIC readable TTL serial, exactly what I need also for Arduino and what LocoShield does.





Then that's the right solution: using a GCA50 board without the PIC as a Loconet interface for Arduino. I only have to mount the electronic components of the board from the DB9 connectors to the PIC. And I take the serial RX/TX signals and the +5V and ground signals from here to Arduino. 

Just to test the idea, I took a GCA50 completed board and removed the PIC. Then I connected the RX/TX serial signals to pins 7 and 8 in Arduino (these are the pins used as soft serial by the LocoShield libraries):


I uploaded the Loconet Monitor program that comes with the Loconet libraries, and voilá!!! I can monitor all the traffic of the Loconet bus:


And now the job is almost finished. I can manage the MP3 shield through the hardware serial of Arduino, and read all the events of the Loconet Bus through a soft serial of pins 7 and 8.

In the next post, I'll show you everything integrated, running and playing the station sounds I want selecting an output in my Intellibox or my PC (Rocrail).

This post references and merits:

MRRWA (Model railroading with arduino): http://sourceforge.net/projects/mrrwa
Peter Giling boards: http://www.phgiling.net