Control a SARK-110 Remotely using a Raspberry Pi
This application note explains how to setup remote access to a SARK-110 antenna analyzer connected to a Raspberry Pi from a computer running SARK Plots. This means that you can control the antenna analyzer from a computer that it is anywhere within the range of your home network such as a laptop connected via Wi-Fi. Besides, it is possible to configure it to have access from anywhere outside your home network.The SARK-110 is connected to the Pi via the USB interface. The Pi runs a TCP server software and it is connected to the home network via Wi-Fi or Ethernet. The remote computer runs SARK Plots software (version v220.127.116.11 or higher) and it is connected to the home network as well.
Raspberry Pi Setup
These setup instructions have been tested on a configuration with Raspberry Pi 3 Model B running Raspbian Stretch with Desktop operating system, so may need some changes for other operating system distributions or hardware model. For operating the Pi, you may need a keyboard and monitor or operate remotely using VNC for example. The Pi needs to be connected to the network via Wi-Fi or Ethernet interfaces.
The server source code and necessary files are available in GitHub in the following location: https://github.com/EA4FRB/sark110-srv-linux.
For getting the files and first setup you will need to do the following:
Open a terminal window and change to the directory you want to place the project, e.g. cd /home/pi/projects
Enter the command: git clone https://github.com/EA4FRB/sark110-srv-linux
Now you should have the server project located in: /home/pi/projects/sark110-srv-linux
First time, you will need to copy sark110.rules file to /etc/udev/rules.d. Enter command: sudo cp sark110.rules /etc/udev/rules.d
The executable sark110-srv.a is available, so you would not normally need to compile the project. Otherwise, please review the instructions available in the README.md file.
Now you can connect the SARK-110 to the Pi. For starting the server you will need typing: ./sark110-srv.a
If everything is correct, you will see the following screen. Write down the IP address of the interface; in this case the IP address for the wlan0 interface is 192.168.1.66
Now you have the Pi ready for receiving commands from a computer in your local network running SARK Plots.
If you need to launch the server automatically on reboot, you can follow the following procedure:
Open a terminal window
Enter the command: crontab –e
Add at the end of the opened file: @reboot /home/pi/projects/sark110-srv-linux/sark110-srv.a
Save the file
SARK Plots Setup
For setting SARK Plots to use the server you will need just to enter the IP address of the server. Select <Settings> <Parameters> and enter the IP address in the text box located on the bottom left side of the dialog box.
Then select <Settings> <Communications> <Network>:
Finally press the Connect and Run buttons to start plotting the measurements.
Remote Connection from Anywhere
The instructions above describe the setup for a remote connection within the range of your home network. It is also possible configuring the system for accessing from outside your home network using Port Forwarding. For using this feature, you will need to open ports in your router. The way to open ports depends on the router you are using, so you will need to refer to the manuals or documentation available in the Internet regarding Port Forwarding for configuring your router. Notice that the port used by this server is 8888.
For using the Port Forwarding with your Pi, you will need first to configure a static IP address. There are several ways for doing this, e.g. by entering in “Wireless & Wired Network Settings” by clicking on the network icon located on top right side of the desktop. Select Configure Interface wlan0, disable the checkbox “Automatically configure empty options” and enter the required addresses, e.g. IPv4 Address (e.g. 192.168.1.100), Router Address (usually 192.168.1.1 or 192.168.0.1) and DNS Servers address (usually same as router address). Enter these settings, reboot the Pi and run ifconfig to confirm if the settings are correctly applied.
Then configure your router for opening the port 8888 following the specific instructions. Finally, you will just need to know the public IP of your network and configure SARK Plots with this IP address for accessing to the SARK-110’s Pi server.