3.-A NATS installation

The NATS server is a simple, secure and high-performance open source messaging system that is used for the different remoteSwitch modules to communicate with each other. As many remoteSwitch modules as devices to be controlled are desired. In addition, you always have to run a remoteSwitch configured as a web server, then at least we will have 2 remoteSwitch running. The NATS server is used for communication between all these modules. You can download the NATS server from its official website that you will find at:


Download NATS module

We can download version 2.0.4 from my website:


We have many ways to put the NATS binary in the RsPi, some will surely choose to download it to the PC and from it, upload it through an FTP to the RsPi. Here we are going to do it using the wget command as shown below:

sudo wget --no-check-certificate https://ea4tx.com/wp-content/uploads/files/rspi/nats-server

With this we already have the binary in the RsPi although surely in the root folder or /home/pi. Now we are going to copy it to the folder /usr/local/sbin which is where it would usually be left, for this we can use the program mc (midnight commander that we had already installed in step 2) or by using the command:

sudo cp nats-server /usr/local/sbin/

You can do these two steps in one, using the command:

sudo wget --no-check-certificate https://ea4tx.com/wp-content/uploads/files/rspi/nats-server -P /usr/local/sbin

You will have to indicate that the type of file can be executed, with which you will surely have to change its properties, something to do by using the command:

sudo chmod 755 /usr/local/sbin/nats-server

With this we have the program ready. It is not necessary to configure anything.

We execute it and verify that it starts well.

Start System

So that when you turn on the Raspberry Pi the program will automatically run, we will use SystemD. To do this, we will leave a file in the /etc/systemd/system folder such as nats.system This file indicates the path where the program is located, its startup options, the user account with which it runs, etc. You can download This file from my site using the command:

sudo wget --no-check-certificate https://ea4tx.com/wp-content/uploads/files/rspi/nats.service

We will copy this file to the /etc/systemd/system folder, then the command will be:

sudo cp nats.service /etc/systemd/system/

In principle, this file that you have downloaded and copied to the /etc/systemd/system folder can be left as is without having to change anything in it. Now we only have to add this nats service in the systemd manager, then we execute the command:

sudo systemctl enable nats.service

With this already restarting the RsPi, this service will be executed automatically. You can also start or stop manually, for this the start command would be:

sudo service nats start

or to stop:

sudo service nats stop

With all this, we should already have the nats server up and running, ready so that when we start the remoteSwitch modules can connect. We will see this later.

3.-B ser2net instation

The ser2net module works as a router or gateway between serial ports and TCP/IP. It allows defining in a configuration file (/etc/ser2net.yaml) and line by line, each of the serial ports that we want to be accessible by a TCP/IP port. In this way, an application can connect to that TCP/IP port and access the serial device via the ser2net.

  • Note: Through a single ser2net service you can access as many serial devices as defined.

The serial devices are going to be each of the RemoteBox or StackMain that we connect to the RsPi and with this we allow them to be accessible by TCP/IP. Thanks to this service, the windows RBM client can connect to the device via TCP/IP and the remoteSwitch also accesses.

Since version V4 of ser2net it can be defined that multiple clients connect and share the same serial port. To do this you have to add a parameter that does not come by default and is called:

        max-connection = N     (where N is the number of simultaneous connections desired, for example for 5 it would be max-connection = 5)

Ser2net standard installation

To install the standard ser2net package, run:

sudo apt-get install ser2net

The installer will have left the program in the \usr\sbin\ser2net folder, the ser2net.yaml configuration file in \etc and the service boot system ready. 

Ser2net configuration

The configurator of the ser2net service is called ser2net.yaml and we have it in \etc. Edit the file:

sudo nano /etc/ser2net.yaml

The following link explains the implementation and parameterization of the ser2net service in more detail, then I recommend that you visit this link:

If we have a RemoteBox already connected to the RsPi and we have already edited the ser2net file and started the service

sudo service ser2net start

We can test that the ser2net service is working before continuing with the final part and that it would be to install the remoteSwitch and its web server which will be what you see in the last section.

Run the RBM program on your computer and configure that the service is via TCP/IP indicating the IP and Port of the defined service.

We will be closed for holidays from 10/July to 28/July.


Cerramos por vacaciones desde el 10/Julio al 28/Julio

This will close in 5 seconds