RedRat Hub RedRatHub on a Raspberry-Pi

RedRatHub on a Raspberry-Pi

How to get it up and running....

The Raspberry-Pi is an excellent small server on which to run RedRatHub for managing and using your RedRat devices. This guide goes through the steps needed to setup a a Raspberry-Pi running Raspberry Pi OS (formally Raspian) and using NET 5.0 and RedRatHub 5.20 or greater.

A online demo of RedRatHub can be seen here.

RRX and R-Pi

Install .NET Core

The ARM32 Linux version of the .NET SDK needs to be downloaded from Microsoft and installed.

As the .NET SDK and runtime is updated fairly frequently, it is easiest to find the most recent version directly from the Microsoft .NET download page. At the time of writing, the SDK is at version 5.0.

On the Raspberry-Pi, the .NET package is downloaded unpacked in your home directory and then unpacked in an appropriate system location:

cd ~
sudo mkdir /opt/dotnet
sudo tar -xvf dotnet-sdk-5.0.100-linux-arm.tar.gz -C /opt/dotnet/
sudo ln -s /opt/dotnet/dotnet /usr/local/bin

Check that the setup is now OK by entering dotnet --info which should give something like:

.NET Core SDK (reflecting any global.json):
 Version:   5.0.100
 Commit:    5044b93829

Runtime Environment:
 OS Name:     raspbian
 OS Version:  10
 OS Platform: Linux
 RID:         linux-arm
 Base Path:   /opt/dotnet/sdk/5.0.100/

Host (useful for support):
  Version: 5.0.0
  Commit:  cf258a14b7

.NET SDKs installed:
  5.0.100 [/opt/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 5.0.0 [/opt/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 5.0.0 [/opt/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs:

Install LibUsb

This is the device driver needed for communicating with a RedRat-X plugged in via USB.

sudo apt-get install libusb-1.0-0-dev

Install RedRatHub

Download the most recent version from the RedRat website and then unpack:

cd ~
unzip ./ -d rrhub

This should now have extracted RedRatHub in to the directory rrhub.

It should now be possible to test running it:

cd rrhub/
sudo dotnet RedRatHub.dll

It needs to be run with sudo so that it can access the LibUsb device driver during the scan for RedRat devices.

If you do not have any RedRat devices available, then it can be run in evaluation mode using the --eval command line switch. This adds some dummy RedRat devices to RedRatHub's internal state, allowing some basic experimentation.

sudo dotnet RedRatHub.dll --eval

Once RedRatHub is running, find the IP address of the Raspberry-Pi and point a web browser at the following URL: http://IP-Of-Raspberry-Pi:5248/, for example

RedRatHub Home Page

Running RedRatHub on Startup

In most situations, it is useful to have RedRatHub startup automatically when the Raspberry-Pi boots up.

This is fairly straightforward to achieve with the systemd service manager. The first step is to place the RedRatHub code in a more suitable location on the Pi:

sudo mkdir /opt/rrhub
cd /opt/rrhub
sudo cp -r ~/rrhub/* .

Next, a startup script needs to be created to instruct systemd to run RedRatHub. This is placed in /lib/systemd/system.

cd /lib/systemd/system
sudo nano rrhub.service

This brings up the Nano editor to create the rrhub.service file. Copy and paste the following text into the file:

Description=RedRat Hub Server

ExecStart=/opt/dotnet/dotnet /opt/rrhub/RedRatHub.dll


Once this text has been entered, then do CTRL-X followed by Y to exit Nano and save the file.

The last step is to inform systemd about our new RedRatHub service:

sudo systemctl daemon-reload
sudo systemctl enable rrhub.service
sudo systemctl start rrhub.service

RedRatHub should now be running! Even if you reboot the raspberry-Pi, it should startup again and continue to operate.

If there are problems, then errors may be shown in /var/log/daemon.log or /opt/rrhub/logs/redrathub.log.