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.
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 ~ wget https://download.visualstudio.microsoft.com/download/pr/e8912d3b-483b-4d6f-bd3a-3066b3194313/20f2261fe4e16e55df4bbe03c65a7648/dotnet-sdk-5.0.100-linux-arm.tar.gz 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: https://aka.ms/dotnet-download
This is the device driver needed for communicating with a RedRat-X plugged in via USB.
sudo apt install libusb-1.0-0-dev
Download the most recent version from the RedRat website and then unpack. Check the RedRat Hub page for the most recent version. For example, for version 5.23:
cd ~ wget https://www.redrat.co.uk/downloads/RedRatHub-V5.23.zip unzip ./RedRatHub-V5.23.zip -d rrhub
This should now have extracted RedRatHub in to the directory
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
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
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:
[Unit] Description=RedRat Hub Server After=multi-user.target [Service] ExecStart=/opt/dotnet/dotnet /opt/rrhub/RedRatHub.dll WorkingDirectory=/opt/rrhub StandardOutput=inherit StandardError=inherit Restart=always [Install] WantedBy=multi-user.target
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