Wednesday, October 11, 2017

"A Todo Tren" modular exhibition

Club N Caldes organized last weekend, 7th and 8th October, a train fair at the Würth Museum in Logroño, a Modern and Contemporary Art Museum part of the Würth museums network across all Europe. Apart from the fixed and temporary exhibitions, they also provide the needed space for those who want to do any activity (exhibitions, talks, events...), provided that this activity is related to art, didactic, or strengthens the company's business.

As this didactic and altruistic philosophy (Museum is always free of charge) is close to our club philosophy also, 4 associations that have close contact decided to organize a modular exhibition event focused to children and to the most didactic part, showing how Open hardware and software platforms can be used for railroad modelling. And who said what we do is not art?? Of course it is!!! ;)

The first association is "Amigos del Ferrocarril de La Rioja" ("La Rioja friends of rails"?). They exhibited an static H0 layout recreating many sceneries from this region well known by its wines.

Second association to present is "Creaciones Ferroviarias". My friend Jose Manuel León creates awesome models in 1 Scale (1:32) completelly from scratch. He uses also Arduino to manage many of this locomotives and it is an unbelievable artisan work:

"Anden 5" is how this group of five friends is named. They make modular T-Track layouts. Arduino is also present in their layouts to manage their roundabout or add sounds, and they also showed some independent little dioramas or "theaters", like they like to name it, showing how Arduino is used to manage switches, servos, lights..... Children can literally touch it and play with sensors to make trains inside this little theaters move.

And last but not least, our Club N Caldes layout. Now it is a 16 meters long (no curves yet) digital anarchic layout, fully based on open hardware and software systems. Apart from Rocrail to manage it, the rest of software and/or firmware is developed by our own following the Loconet specifications. I say anarchic in the good sense of the word, as not all of us model Japanese landscapes, but we love to have this diversity of environments and people reacted marvelously to it.

Therefore a train can depart from the Hokkaido Coal Mine, cross the rice fields and a Japanese temple, make a brief stop in Hamburg station which is after the container depot, continue through Spanish landscapes like Toledo, the ZooFarm, Jerte Valley, a Catalonian station "Martorell", then go back to Japan to cross the Terayama bridge and end up in the middle of Hoth battle from Star Wars. The only restriction for decoration is to bring something with "soul", something this member admires and arouses emotions and/or memories.

The Coal Mine:

Rice fields and Temple:

Industrial zone:

Hamburg Station:

Social Club and ZooFarm (with Tomitec moving bus system):

Highway in Toledo:

Martorell station:

Terayama bridge:

Hoth Battle (with animations and sound activated by The Force proximity sensor):

As we can drive in manual, automatic and semiautomatic mode, we changed to manual operated trains and let children to drive. This was one of the best experiences ever:

And no more things to show! It was a very successful exhibition with more than 2100 visitants in just one and a half day!! And even local press came to make and article about all us!!

Finally, we wish to express our sincere gratitude to the Würth Museum, Würth Spain and the fantastic people working there who attended us and made us feel like at home. Thanks in the same way to all associations and clubs who supported the idea in a disinterested manner, we hope to make it better and bigger next year!!

You can check many videos in our youtube channel and playlist clicking here.

Wednesday, August 16, 2017

Arduino based 8 servo modules with frog polarization Loconet

ClubNCaldes has developed a new Loconet module to manage switches, based of course in Arduino. Our previous version (see this old post) was using a simple sensor shield that manages servo motors connected directly to Arduino PWM pins. It's been working with no problems, but we noticed some servos glitched a little bit from time to time. Probably it was because no external power source was used to feed the servo motors, and it was taking the 5v power directly from the Arduino.

Then new module and firmware uses an specific servo shield with its own PWM generator, and communicates through I2C bus, so the rest of the pins are free to use. It has an external 5Vcc connector to use a separate power source for servos. The result is a smother servo movement with no glitches or interference.

Here you have the instructions to build your own module:


PCA9685 I2C 16-Channel 12-bit PWM/Servo Drive shield For Arduino
You can find it in ebay for less than 5€.

1 x Relay board
There are 1, 2, 4, 6 or 8 channel optoisolated relay boards for arduino. Take the one you need according to the number of servos and switches you want to manage.

Dupont cable female - female
This is used to connect the relay board to the servo board.

Servo motors
In ebay you can also find cheap TowerPro 9G servos, enough to manage a N or H0 scale switch.
Servo mounting bracket
My favorite way to fix servos under the table is with aluminium servo brackets from Hobby King.

Arduino UNO
Standard Arduino, you can also use NANO or MEGA version, but the provided firmware has been only tested with UNO VERSION.
Loconet Shield (GCA185)
This is always needed in any Loconet module implemented in Arduino, you can make your own or buy a GCA185 board to Peter Giling (see Rocrail page).


Just put Servo shield on top of Loconet shield, and that last one on top of Arduino UNO.
Upload the SVLoco8ServoRelay sketch to Arduno UNO board. You can download it from:


You have to feed the servo shield with a 5Vcc power source, be careful to respect the polarity shown in the board when connecting. Servos and relays are connected to the servo shield pins as indicated in the following photo. The servo connected to pin 0 uses the relay connected to pin 8, and so on:

Keep in mind these pins on the servo shield are independent of the pins on the Arduino board. Only Arduino pins 0 and 1 are used for debugging purposes, and Arduino pins 7 and 8 communicate with the Loconet shield. The rest of Arduino pins are free to use, so you can change the firmware if you like.


Programming and adjusting is done from Rocrail as in the previous version. (NOTE: a new version using standard CV programming is planned to be released soon). Access to GCA50 configuration in Rocrail menu:

Pressing the query button it should appear the connected servo module. By default, it will have the address 81/1:

Selecting your module, you can change its Low and Sub addresses from the General tab (two modules cannot have the same Low and Sub addresses). Be careful, the RESET button of this screen will reset ALL modules connected to you Loconet network, not only the selected one:

Then you can access the Easy Setup tab, here you assign an output number to each of the 8 servos (left part of the screen marked in red), and a number to the input that tells to the sofware when a servo motor has finished its movement (servo feedback signal). Normally, the same number is assigned as in Loconet inputs and outputs do not share the same range of numbers. Set up the screen as in the following image:

To adjust the servos go to the last tab named "Servo":

Each of the ports (1 to 8) select one of the 8 servos that can be connected. When pressing the Get button it will read the configuration:

Pos1: one of the positions of the servo, with a value from 1 to 127 (1=0º, 127=180º)
Pos2: second position of the servo, with a value from 1 to 127 (1=0º, 127=180º)
V: Speed of movement from 0 (slow) to 5 (fast)

The SET button will overwrite the values and servo will move to POS1, wait one second, and will move back to POS2 so you can visually check the adjustment.

I recommend you to first set Pos1 and Pos2 values to 63. This will center the servo. Then mount the servo in place, and bit by bit reduce the value of Pos1 and increment the value of Pos2 until archive the desired servo movement.