Controlling Märklin Digital Railroad with CS2.exe


Setting up the Raspberry PI to work with Central Station 2 v3.8.1

Using the free software from Maerklin, you can search your Railroad for MFX and MFX+ locos, and you can make use of the new MFX+ features:

 

Before you proceed, make sure you have installed your PI first by reading this section

 

Downloading CS2.exe:

The download can be found on the official site of Maerklin: https://www.maerklin.de/en/service/downloads/software-updates/

The installation should be straight forward and self explanatory.

Installations on the PI:

We will need a web server running on the PI. I will show you how to install Apache Web Server.

First lets get some updates with:

sudo apt-get update
 

Now get and install Apache:

sudo apt-get install apache2

Add pi user to have permission to /var/www/

sudo usermod -a -G www-data pi
sudo chmod 775 /var/www

Now we need to copy at least one file to the webserver, and create a new directoy:
 

For Jessie release before 2016-05-10, do this:

sudo mkdir /var/www/config
sudo cp config/geraet.vrs /var/www/config/

For Jessie release from 2016-05-10 and later, do this:

sudo mkdir /var/www/html/config
sudo cp config/geraet.vrs /var/www/html/config/


If you don't have my tool aready running, you can start it now with:

sudo /home/pi/PiCanS88/PiCanS88 -f -b 192.168.2.255 -v -d 192.168.2.96 -m 1

Starting and configuring CS2.exe:

Now you can start the installed Central Staion 2 Software on your PC:

Sometimes the startup will fail with:

In this case wait a few seconds and try again.

If you want to scan your rail road for MFX locos, you need to change the settings to let this CS2.exe work as Master CS2.
Click on Setup: , then click the tool icon: to get here:

Uncheck the option 'Auxillary Device' :

Now you will be able to search for mfx-Loco:

By clicking on:


Your Pi is now all setup to act as a full Central Station 2 for your Märklin Railroad. Enjoy.

 

Setting up the Raspberry PI for use with RemoteCS2 for Android

If you have finished setting up CS2.exe and if you have created the track layout in CS2.exe, you can copy the config files to the Raspberry Pi, so RemoteCS2 can make use of it.
To transfer the files to the Pi, I am using the tool "WinSCP":

Using WinSCP we will first copy all needed config files into the home directory of the user "pi", in the subfolder "config".
To know where the source files are located take a look at your CS2.exe configuration here:

From there, please select all "*.cs2" files and the folders: "gleisbilder", "fcticons", "icons", "magicons_".

and drag an drop them into WinSCP in the "config" folder:

Now open a SSH Connection with your Pi, and execute following commands:

For Jessie release before 2016-05-10, do this:

sudo cp config/*.cs2 /var/www/config/
sudo mkdir /var/www/config/gleisbilder
sudo cp config/gleisbilder/* /var/www/config/gleisbilder
sudo mkdir /var/www/icons
sudo mkdir /var/www/fcticons
sudo mkdir /var/www/magicons_
sudo cp config/icons/* /var/www/icons
sudo cp config/fcticons/* /var/www/fcticons
sudo cp config/magicons_/* /var/www/magicons_

For Jessie release from 2016-05-10 and later, do this:

Do the same as above but extend the destination path to: /var/www/html/ instead of /var/www/

 

Now we will have to fix a little bug in Apache Webserver :(
Right now RemoteCS2 for Android will not show any Train Icons/Pictures, because the access to the Icons-Folder is restricted because of a stupid alias assign.
To fix this problem, edit the file alias.conf and comment the line: 'Alias /icons/ "/usr/share/apache2/icons/"'
So type:

sudo nano /etc/apache2/mods-enabled/alias.conf

You will see this:

<IfModule alias_module>
#
# Aliases: Add here as many aliases as you need (with no limit). The format is
# Alias fakename realname
#
# Note that if you include a trailing / on fakename then the server will
# require it to be present in the URL. So "/icons" isn't aliased in this
# example, only "/icons/". If the fakename is slash-terminated, then the
# realname must also be slash terminated, and if the fakename omits the
# trailing slash, the realname must also omit it.
#
# We include the /icons/ alias for FancyIndexed directory listings. If
# you do not use FancyIndexing, you may comment this out.
#
Alias /icons/ "/usr/share/apache2/icons/"

<Directory "/usr/share/apache2/icons">
Options FollowSymlinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>

</IfModule>


Now add "# " like below:


<IfModule alias_module>
#
# Aliases: Add here as many aliases as you need (with no limit). The format is
# Alias fakename realname
#
# Note that if you include a trailing / on fakename then the server will
# require it to be present in the URL. So "/icons" isn't aliased in this
# example, only "/icons/". If the fakename is slash-terminated, then the
# realname must also be slash terminated, and if the fakename omits the
# trailing slash, the realname must also omit it.
#
# We include the /icons/ alias for FancyIndexed directory listings. If
# you do not use FancyIndexing, you may comment this out.
#
# Alias /icons/ "/usr/share/apache2/icons/"

<Directory "/usr/share/apache2/icons">
Options FollowSymlinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>

</IfModule>

 


Save and exit with:

Ctrl+o -> Enter -> Ctrl+x

 

Changes will take effect after a reboot:

sudo reboot

Now you can start RemoteCS2 on your Android-Device, and let it search for a CS2: