2020-11-23 18:41:55 +00:00
|
|
|
|
# Introduction (WIP)
|
2019-11-23 14:09:44 +00:00
|
|
|
|
|
2020-11-23 18:41:55 +00:00
|
|
|
|
An attempt to create a remote weather station hub on the Raspberry Pi.
|
2019-11-23 14:09:44 +00:00
|
|
|
|
|
2020-11-23 18:41:55 +00:00
|
|
|
|
The repository consists on several modules written in C# and an Android application written in Java.
|
2020-02-02 14:47:47 +00:00
|
|
|
|
|
2020-11-23 18:41:55 +00:00
|
|
|
|
Communication between the Raspberry and the Android application is done via [gRPC](https://grpc.io/).
|
2019-11-30 13:41:50 +00:00
|
|
|
|
|
2020-11-23 18:41:55 +00:00
|
|
|
|
**The project is still undergoing development and it's not production ready.**
|
2019-11-23 14:09:44 +00:00
|
|
|
|
|
2020-11-23 18:41:55 +00:00
|
|
|
|
[![CircleCI](https://circleci.com/gh/dnutiu/NucuCar.svg?style=svg)](https://circleci.com/gh/dnutiu/NucuCar)
|
2019-11-23 14:09:44 +00:00
|
|
|
|
|
2020-11-23 18:41:55 +00:00
|
|
|
|
# Architecture
|
2019-11-23 14:09:44 +00:00
|
|
|
|
|
2020-11-23 18:41:55 +00:00
|
|
|
|
TBD
|
2020-05-01 08:29:59 +00:00
|
|
|
|
|
2020-11-23 18:41:55 +00:00
|
|
|
|
# Installing and Developing
|
2020-05-01 08:29:59 +00:00
|
|
|
|
|
2020-11-23 18:41:55 +00:00
|
|
|
|
## Requirements
|
2020-05-01 08:29:59 +00:00
|
|
|
|
|
2020-11-23 18:41:55 +00:00
|
|
|
|
To build this project you will need to install .Net Core 3.1 and Android Studio.
|
2020-05-01 08:29:59 +00:00
|
|
|
|
|
2020-11-23 18:41:55 +00:00
|
|
|
|
* https://docs.microsoft.com/en-us/dotnet/core/install/
|
|
|
|
|
* https://developer.android.com/studio
|
2019-11-23 14:09:44 +00:00
|
|
|
|
|
2020-11-23 18:41:55 +00:00
|
|
|
|
To run this project on the Raspberry Pi you will need dotnet core 3.1. installed.
|
2019-11-23 14:09:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-11-23 18:41:55 +00:00
|
|
|
|
## Building
|
2019-11-09 16:01:16 +00:00
|
|
|
|
|
2020-11-23 18:41:55 +00:00
|
|
|
|
The following script provides instructions on how to build the whole project and deploy the NucuCar.Sensors module on the Raspberry Pi.
|
2019-11-09 16:01:16 +00:00
|
|
|
|
|
2020-11-23 18:41:55 +00:00
|
|
|
|
#### Manual
|
2019-11-09 16:01:16 +00:00
|
|
|
|
|
|
|
|
|
```$xslt
|
2020-11-23 18:41:55 +00:00
|
|
|
|
// Build project
|
2020-10-25 13:24:34 +00:00
|
|
|
|
dotnet build --runtime linux-arm -p:PublishSingleFile=true --configuration Release
|
2020-11-23 18:41:55 +00:00
|
|
|
|
|
|
|
|
|
// Navigate to desired project directory, for example NucuCar.Sensors.
|
|
|
|
|
cd NucuCar.Sensors
|
|
|
|
|
|
|
|
|
|
// Create .tar
|
|
|
|
|
tar -zcvf nh.tar.gz .\bin\Release\netcoreapp3.1\linux-arm\*
|
|
|
|
|
|
|
|
|
|
// Copy onto pi (replace with your ip, user)
|
|
|
|
|
sftp pi@192.168.0.100
|
|
|
|
|
sftp> put nh.tar.gz
|
|
|
|
|
sftp> exit
|
|
|
|
|
|
|
|
|
|
// SSH into pi
|
|
|
|
|
ssh pi@192.168.0.100
|
|
|
|
|
|
|
|
|
|
// Extract the archive and cd into it
|
|
|
|
|
tar -zxvf nh.tar.gz
|
|
|
|
|
cd bin/Release/netcoreapp3.1/linux-arm/
|
|
|
|
|
|
|
|
|
|
// Grant execution permissions
|
|
|
|
|
chmod +x NucuCar.Sensors
|
|
|
|
|
|
|
|
|
|
// Run the program
|
|
|
|
|
./NucuCar.Sensors
|
2019-11-09 16:01:16 +00:00
|
|
|
|
```
|
2020-11-24 16:55:07 +00:00
|
|
|
|
|
|
|
|
|
To make it easier for you to run the project, you may define a SystemD service for it:
|
|
|
|
|
|
|
|
|
|
1\. Create the SystemD service file with the following command:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
sudo nano /etc/systemd/system/nucucar_sensors.service
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
2\. Paste the following contents and make sure to update the WorkingDirectory and ExecStarts paths:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
[Unit]
|
|
|
|
|
Description=NucuCar.Sensors SystemD Service.
|
|
|
|
|
After=network.target
|
|
|
|
|
|
|
|
|
|
[Service]
|
|
|
|
|
User=pi
|
|
|
|
|
Group=pi
|
|
|
|
|
WorkingDirectory=/home/pi/NucuCar/bin/Release/netcoreapp3.1/linux-arm
|
|
|
|
|
ExecStart=/home/pi/NucuCar/bin/Release/netcoreapp3.1/linux-arm/NucuCar.Sensors
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Install]
|
|
|
|
|
WantedBy=multi-user.target
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
3\. SystemD commands
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
sudo systemctl start nucucar_sensors
|
|
|
|
|
sudo systemctl stop nucucar_sensors
|
|
|
|
|
sudo systemctl restart nucucar_sensors
|
|
|
|
|
sudo systemctl status nucucar_sensors
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Enable starts the service after the pi has booted, disable undoes what enable does.
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
sudo systemctl enable nucucar_sensors
|
|
|
|
|
sudo systemctl disable nucucar_sensors
|
|
|
|
|
```
|
|
|
|
|
|
2020-08-16 12:45:36 +00:00
|
|
|
|
---
|
|
|
|
|
|
2020-11-23 18:41:55 +00:00
|
|
|
|
#### Docker-Compose
|
|
|
|
|
|
2020-08-16 12:45:36 +00:00
|
|
|
|
To run the project you can take advantage of `docker-compsose` and run it with the following commands:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
git clone https://github.com/dnutiu/NucuCar.git
|
|
|
|
|
cd NucuCar
|
|
|
|
|
docker-compose up
|
2020-11-23 18:41:55 +00:00
|
|
|
|
```
|
|
|
|
|
_(This is not recommended as the performance will take a significant hit.)_
|
|
|
|
|
|
|
|
|
|
## Directory Structure Overview
|
|
|
|
|
|
|
|
|
|
### NucuHub.Android
|
|
|
|
|
|
|
|
|
|
Holds the Android application.
|
|
|
|
|
|
|
|
|
|
We are currently targeting Android API 29+.
|
|
|
|
|
|
|
|
|
|
### NucuCar.Domain
|
|
|
|
|
|
|
|
|
|
Holds common classes and interfaces that are required by the projects,
|
|
|
|
|
provides all the types that are generated via protocol buffers and some utility classes.
|
|
|
|
|
|
|
|
|
|
### NucuCar.Telemetry
|
|
|
|
|
|
|
|
|
|
Holds concrete implementation for telemetry publishers and workers.
|
|
|
|
|
The Telemetry project can be used by other projects such as
|
|
|
|
|
NucuCar.Sensors to send telemetry into the cloud.
|
|
|
|
|
|
|
|
|
|
This project is not deployed.
|
|
|
|
|
|
|
|
|
|
### NucuCar.Sensors
|
|
|
|
|
|
|
|
|
|
Manages all the sensors. For more info see the readme file located in the project directory.
|
|
|
|
|
|
|
|
|
|
This module is runnable and is deployed on the Raspberry Pi.
|
|
|
|
|
|
|
|
|
|
### NucuCar.TestClient
|
|
|
|
|
|
|
|
|
|
Command line utility to play around with the car functionality.
|
|
|
|
|
You can use it to remotely read data from the sensors via gRPC methods and
|
|
|
|
|
to publish and read telemetry data.
|
|
|
|
|
|
|
|
|
|
### Docs
|
|
|
|
|
|
|
|
|
|
Holds project resources and documentation.
|