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:

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

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 (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...):

And it looks like this:

The software (Arduino libraries and examples) are published in the MRRwA Project SourceForge Project:

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):
Peter Giling boards:

Friday, December 6, 2013

Arduino Project: Station Announcer

I'm starting a new project, a "Station Announcer". The goal is to have a device able to play the station announces for the different trains arriving and departing to and from each track. I'm also very interested in Arduino, a very cheap and powerful programmable board that can be used to realize almost any imaginable invention.
Estoy empezando un nuevo proyecto: el "Anunciador de Estación". La finalidad es tener un dispositivo capaz de reproducir los anuncios de los diferentes trenes llegando y saliendo a cada via de la estación. También estoy muy interesado en Arduino, una placa programable muy barata y potente que puede usarse para realizar casi cualquier invento imaginable.

The main requisites for it are: Los principales requisitos son:

* Usable for both analog and digital layouts. Debe funcionar en ambos analógico y digital.
* Digital layouts using Loconet bus, and analog connecting a numeric keypad to choose the announce to play. En maquetas digitales comunicando por el bus Loconet, y en analogicas mediante un teclado numérico
* Cheap, and based on open standards. Barato, y basado en estándards.

So Arduino is a good base to start from. For those who knows nothing about Arduino, it's an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software. It's intended for anyone interested in creating interactive objects or environments. It's programmed in C language, through a very easy-to-use and simple interface.
Así pues Arduino es una muy buena base por la que empezar. Para aquellos que no conozcan Arduino, es una plataforma de prototipaje electrónico open-source basado en un hardware y software flexible y fácil de usar. Está enfocado a cualquiera interesado en crear objetos o entornos interactivos. Se programa en lenguaje C mediante una interface muy sencilla.

There are several version, from Ardunio Nano (1x4 cm) or Arduino UNO (with standard connectors to pile shields on it), to Arduino Mega with 4 serial ports, 54 I/O pins and 16 analog I/O. And people have developed expansion boards (shields) for almost everyting. There are ethernet, wi-fi or bluetooth shields, and others to control step motors, servo motors, relays... and finally sensors of all kinds (smoke, distance, rfid,...). It's just something crazy.
Hay distintas versones, desde el Ardunio Nano (1x4 cm) o Arduino UNO (con conectores estandard para apilar shields), hasta el Arduino Mega con 4 puertos serie, 54 E/S digitales y 16 E/S analógicas. Y hay tarjetas de expansión (shields) para casi todo. En comunicaciones, hay ethernet, wi-fi o bluetooth. Otros para controlar motores paso-a-paso, servomotores, relés... y finalmente sensores de todos los tipos (humo, distancia, rfid,...).

All information can be found here:

My first tests have begun with an Arduino Nano (7$) and a MP3 shield from Elechouse (21.5$). I'm still waiting my Arduino UNO development kit to arrive.

I've been testing the MP3 library, and it works perfect. The board can play music from a USB stick, a memory stick or the internal memory with 64Mg of space. That last one not very large but with a very fast access. The board can communicate through the serial port or through a soft serial in pins 7 and 8.
He estado testeando la libería MP3, y funciona perfectamente. La placa puede reproducir MP3 de un USB, un memory stock o de la memoria interna de 64 Mg. Esta última muy reducida, pero con un acceso muy rápido. Puede comunicar tanto por el puerto serie como a través del softserial asignado a los pins 7 y 8.

This is the first successful test, assigning an input to a mp3 file:

In next steps I'll work on the Loconet interface. En siguientes pasos, trabajaré sobre la interfaz Loconet.