Sunday, March 13, 2016

"Lleida Expotren 2016" Train fair held in Lleida

This weekend is being held in Lleida one of the biggest train fairs of Spain, named Lleida ExpoTren ( Modular layouts of all scales are exhibited, and also real trains restored thanks to the ARMF, an association dedicated to restore historical rolling stock and put it in service again.

When I arrived I first visited ARMF garage where is possible to have a ride on a RENFE 1003 and on a MZA 602, a former railway company from Spain prior to RENFE.

This association is working also in the restoration of other rolling stock, it must be really hard as they dismount completely the locomotive, sand it, change panels, paint, make new electrical installation, ... really a huge work:

Here you can see a common utility in all Spanish steam locomotives, the "botijo" holder. "Botijo" is how we name a clay water can, that keeps the water fresh all the time even in the hottest summer:

There I met some of the hobby colleagues from Barcelona, they are really funny and generous people, it's a pleasure to know them and enjoy their friendship. Just a pity not all the club members were there:

Here just a view of the old railway installations in Lleida, next to the ARMF garages:

After a good lunch of the typical "cargols a la llauna amb all-i-oli" from Lleida, was time to enter to the huge exhibit of rail-road models.

First of all I met Francesc, one of the promoters of T-Track systems in Spain:

That was the zone of the big scales, the funniest for all kids (and not so young people also...):

Then I took a look to the H0 layout, some modules where really beautiful and had lot of detail:

There was also an impressive diorama of Stalingrad, one of the coolest I've ever seen:

My friend Emili J. Sanmartin has an stand there showing his incredible models:

Finally, I spent the rest of the time admiring the N modules:

And that's the end of my review. A really enjoyable day where I met old colleges and new ones. I hope to see you all soon again.

Sunday, March 6, 2016

Arduino 8 servos module with feedback

I've been always using servos to move my switches. I use GCA136 boards, from Peter Giling, plus GCA137 boards mounted on top to feed the switch frog. A friend asked me if it would be possible to drive servos with Arduino and make a cheap module, and that's what I want to share with you.

This module cannot manage frog polarization, if you need that use Peter Giling boards. But just to move servos, is a great and cheap solution. It's possible to adjust the movement and speed of each of the 8 servos. And the module sends back 8 feedback signals for the software to know when the servo movement has finished and can allow move a train on it. Many servo modules that you can find in the market cannot be used with slow movement because trains are released before reaching the end position and provoques short circuits or derailments.

Configuration is very easy, using the GCA50 configuration screen of Rocrail. It has an special tab for servo adjustment.

So, let's go for the shopping list:

An Arduino UNO:

A Loconet shield GCA185:

And finally a Sensor Shield V5. This is just to make the connection of servos easy:

Sketch is using pins 2,3,4,5,6,9,10 and 11 to connect servos. Pin 13, connected to the on board led,  is also reserved and will be activated during a servo movement.

You can download the last version of the sketch (software) for Arduino from the ClubNCaldes github repository:

This sketch is using the ServoTimer2 library. This is a special library developed by Michael Margolis not using the internal Timer1 of Arduino as this timer is already in use by the Loconet libraries and wouldn't work. I had to fix the code to make it work with the last version of the Arduino environment and you can find also this fixed library in the code repository with the sketch. 

Once uploaded, you can configure it going to GCA50 configuration screen in Rocrail, under "Programming" menu. In this screen go to Addresses tab and click the Query button. By default sketch is configured with the 81/1 identification, and it should be shown in the screen. It's recommended to change first of all this address to any other number. You can change it in the general tab.

Going to the Easy Setup tab you can read the board configuration clicking the button Get All. The first 8 ports must be configured as output and assign an output number for each of the 8 servos. The last 8 ports, from 9 to 16, are the input numbers assigned to the feedback signal of each servo. You can use the same number for the input as assigned to the output. In Loconet input numbering is independent from the outputs:

Click the Set All button to write configuration into the board. The last tab labelled Servo is used to adjust the movement and speed of each servo:

Select which of the 8 ports (=servos) are you configuring. Each of the two positions have a range from 1 (equivalent to 0 degrees) to 127 (equivalent to 180 degrees). "V" is the speed of movement, being 0 the slowest and 5 the fastest. Each time you press the Set button configuration will be stored and servo will move one side and the other at the selected speed.

Current to feed arduino and servos is taken directly from Loconet, but you can feed also the sensor shield with an external 5V power supply removing the jumper in the sensor shield board.

Here you can see it in action. I hope you like it: