An all-in-one gateway solution for Raspberry Pi + LoRaWAN using BasicStation and Grafana.
This project provides a complete LoRaWAN gateway solution that runs on a Raspberry Pi. It includes configuration for BasicStation for LoRaWAN connectivity, integration with Telegraf via TTN MQTT, and Grafana for monitoring. The solution simplifies the deployment of LoRaWAN gateways on edge devices by packaging all necessary services together.
Before you begin, ensure you have the following installed on your Raspberry Pi:
- Open a terminal on your Raspberry Pi.
- Clone the repository using Git:
git clone https://github.com/cosmic-pulse/PiWAN.git
- Navigate to the project directory:
cd PiWAN
-
Rename the
gatewaySAMPLE.conftogateway.conf. -
Open the
gateway.conffile in a text editor:nano gateway.conf
-
Replace the placeholder values with your actual configuration:
YOUR_INFLUXDB_USER: Your InfluxDB username.YOUR_INFLUXDB_PASSWORD: Your InfluxDB password.YOUR_ORGANIZATION_NAME: Your InfluxDB organization name.CHOOSE_A_TOKEN: Generate an InfluxDB admin token.YOUR_TTN_APP_ID: Your TTN application ID.YOUR_TTN_API_KEY: Your TTN API key.YOUR_TTN_REGION: Your TTN region (e.g.,nam1).YOUR_GATEWAY_EUI: Your gateway's EUI.YOUR_GATEWAY_API_KEY: Your gateway's API key.
Save and exit the file.
-
Find the docker group of your RPi/host:
getent group docker
-
Modify the
docker-compose.ymlfile to set the correct group ID for theTelegrafservice. Replace999:0with the actual group ID you found in the previous step:telegraf: container_name: Telegraf user: "999:<your_group_id>"
-
Build and start the Docker containers:
docker-compose up --build -d
- To start the gateway, run:
docker-compose up -d
- To stop the gateway, run:
docker-compose down
- To view logs for the BasicStation container, run:
docker-compose logs -f basicstation
Once the containers are running, the gateway will connect to the LoRaWAN network and start forwarding data. You can monitor the gateway's performance and metrics using Grafana.
Open your web browser and navigate to http://<your-raspberry-pi-ip>:3000.
Set the folder permissions for Grafana before starting the containers:
cd PiWAN
sudo chown -R 472:472 ./grafanaContributions are welcome! Please fork the repository and submit a pull request with your changes.
This project is licensed under the MIT License.
For further details, please see the LICENSE file.
