This is a .NET Backend API project and has the following features :
- Remotely maneuvre a robot through a web browser [Feb 2022 Release]
- Retrieve and monitor IoT sensor data displayed on the dashboard [Feb 2022 Release]
- Camera video streaming in real-time [Apr 2022 Release]
-
Robot Control Panel module
- SignalR and BackgroundService to enable real-time IoT sensor monitoring (Temperature, Humidity, Pressure)
- Ultrasonic sensor integration to detect collision
- Robot speed sensor integration to monitor the rover's speed
- Battery status integration to monitor the leftover battery on the RaspberryPi
- Camera stream integration
-
Weather Station module
- Line chart to monitor sensor trends for T-10 seconds
- MongoDB to store IoT sensor data
-
DevSecOps
- Perform Static Code Analysis with SonarCloud โ
- Perform unit testing with XUnit
- Integrate unit testing into CI Pipeline and generate code coverage
Technology | Remarks |
---|---|
.NET Web API | Backend API logic built with .NET 5 |
RaspberryPi | Server to host the Backend API logic and to host the Azure DevOps agent for CICD |
Docker | Containerization platform to host the Backend API logic |
Azure DevOps | Continuous Integration/Continuous Deployment platform |
Pi-Top Robotics Kit | Hardware to maneuver the robot by Pi-Top - Pi-Top OS is used to integrate with the peripherals |
SenseHat | Hardware to capture IoT sensor data |
The following hardware is required prior to installing the software
- RaspberryPi 4B+
- Pi-Top Robotics Kit
- SenseHat
- Install Docker engine on the RaspberryPi
- Install .NET 5 / .NET 6 on the RaspberryPi
- Download the docker image :
amirashrafizham/be-iort
- Run the following docker command :
sudo docker run --privileged -p 5000:80 --name be-iort --detach --restart unless-stopped amirashrafizham/be-iort
The project follows the Repository pattern, where C# classes called Services will be instantiated into the Controller using Dependency Injection
- RobotWheel - This is the service to manoeuvre the robot
- PiSenseHat - This is the service to retrieve the Iot sensor data
- IoT.Device.Bindings
- Pi-Top
- Pi-Top.MakerArchitecture
- System.Device.Gpio
Due to the limitation of the 32-bit Pi-Top OS as of Apr 2022, the project will be built using .NET 6 on local machine and configured to .NET 5 on the server. These are the steps to build and release the code to the RaspberryPi Server
- From local machine, push the latest code update to Github
- Azure Pipelines will automatically trigger the CI pipeline
- The CI pipeline will download .csproj and Dockerfile.stg hosted on Azure DevOps secure file. These files are configured for .NET5
- Overwrite .csproj and store Dockerfile.dev from
$(Agent.TempDirectory) to $ (Build.Repository.LocalPath) - Build and containerize the code using Dockerfile.stg. The Dockerfile has the following main commands
-
docker stop
old image -
docker remove
old image -
docker run
new image with privileged access, detached mode, restart-unless-stop and point to port 5000
-
- Push to Dockerhub for backup
- Azure Pipelines will then automatically trigger the CD pipeline with the following main commands
-
docker stop
old image -
docker remove
old image -
docker run
new image with privileged access, detached mode, restart-unless-stop and point to port 5000 -
docker remove
images on the server with label<none>
-
To access the Swagger API, simply point the IP address of the RaspberryPi with port 5000 and the extension /swagger/index.html