restructure, create overview
This commit is contained in:
35
doc/1-gateway/0-raspberry-pi-setup.md
Normal file
35
doc/1-gateway/0-raspberry-pi-setup.md
Normal file
@@ -0,0 +1,35 @@
|
||||
# Raspberry Pi Setup
|
||||
|
||||
Download the [Raspberry Pi Imager](https://flathub.org/apps/org.raspberrypi.rpi-imager) from Flathub (or elsewhere)
|
||||
|
||||
Download Raspberry Pi OS Lite 64-bit from the [Raspberry Pi download page](https://www.raspberrypi.com/software/operating-systems/)
|
||||
|
||||
Open the imager and do the following:
|
||||
|
||||
- Choose custom image (at the bottom)
|
||||
- Pick the OS file you downloaded
|
||||
- Choose your SD card for storage
|
||||
- Click the gear icon for settings
|
||||
- Set hostname, enable SSH, set username/password, set WiFI as desired
|
||||
- Click image
|
||||
|
||||
Once writing is done, put the SD card in and start up the Pi. Wait a minute for it to start and join the network.
|
||||
|
||||
Find the IP address of the Pi via your router (look for DHCP leases) and SSH in.
|
||||
|
||||

|
||||
|
||||
Change the IP address to be static by adding the following to the bottom of `/etc/dhcpcd.conf` (modify for your own environment, using `eth0` for wired):
|
||||
|
||||
```conf
|
||||
interface wlan0
|
||||
static ip_address=192.168.0.181
|
||||
static routers=192.168.0.1
|
||||
static domain_name_servers=192.168.0.1
|
||||
```
|
||||
|
||||
Update, upgrade, and install Git: `sudo apt update && sudo apt -y upgrade && sudo apt install -y git`.
|
||||
|
||||
Reboot and SSH in to the new static IP you assigned.
|
||||
|
||||
The Pi is ready for the packet forwarder to be installed.
|
||||
61
doc/1-gateway/1-gateway-bridge.md
Normal file
61
doc/1-gateway/1-gateway-bridge.md
Normal file
@@ -0,0 +1,61 @@
|
||||
# Gateway Bridge
|
||||
|
||||
Get the ChirpStack GPG key:
|
||||
|
||||
```sh
|
||||
# https://superuser.com/a/1773782
|
||||
gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys 1CE2AFD36DBCCA00 && \
|
||||
gpg --export 1CE2AFD36DBCCA00 | sudo tee /etc/apt/trusted.gpg.d/chirpstack.gpg >/dev/null && \
|
||||
gpg --batch --yes --delete-keys 1CE2AFD36DBCCA00
|
||||
```
|
||||
|
||||
This avoids using the deprecated `apt-key` command listed on the ChirpStack site.
|
||||
|
||||
Add the source at:
|
||||
|
||||
```conf
|
||||
echo "deb https://artifacts.chirpstack.io/packages/4.x/deb stable main" | sudo tee /etc/apt/sources.list.d/chirpstack.list
|
||||
```
|
||||
|
||||
Update and install:
|
||||
|
||||
```conf
|
||||
sudo apt update
|
||||
sudo apt install chirpstack-gateway-bridge
|
||||
```
|
||||
|
||||
See the following message:
|
||||
|
||||
```none
|
||||
---------------------------------------------------------------------------------
|
||||
The configuration file is located at:
|
||||
/etc/chirpstack-gateway-bridge/chirpstack-gateway-bridge.toml
|
||||
|
||||
Some helpful commands for chirpstack-gateway-bridge:
|
||||
|
||||
Start:
|
||||
$ sudo systemctl start chirpstack-gateway-bridge
|
||||
|
||||
Restart:
|
||||
$ sudo systemctl restart chirpstack-gateway-bridge
|
||||
|
||||
Stop:
|
||||
$ sudo systemctl stop chirpstack-gateway-bridge
|
||||
|
||||
Display logs:
|
||||
$ sudo journalctl -f -n 100 -u chirpstack-gateway-bridge
|
||||
---------------------------------------------------------------------------------
|
||||
```
|
||||
|
||||
Edit `/etc/chirpstack-gateway-bridge/chirpstack-gateway-bridge.toml` to match the port that the packet forwarder is using (1730 instead of 1700):
|
||||
|
||||
```toml
|
||||
upd_bind = "0.0.0.0:1730"
|
||||
```
|
||||
|
||||
Add/change some values:
|
||||
|
||||
```toml
|
||||
event_topic_template="us915_1/gateway/{{ .GatewayID }}/event/{{ .EventType }}"
|
||||
command_topic_template="us915_1/gateway/{{ .GatewayID }}/command/#"
|
||||
````
|
||||
66
doc/1-gateway/2-packet-forwarder.md
Normal file
66
doc/1-gateway/2-packet-forwarder.md
Normal file
@@ -0,0 +1,66 @@
|
||||
# Packet Forwarder
|
||||
|
||||
SSH to the Raspberry Pi.
|
||||
|
||||
Run `raspi-config` and
|
||||
|
||||
- Enable SPI
|
||||
- Enable I2C
|
||||
- Turn off login shell but keep serial port active
|
||||
- Reboot
|
||||
|
||||
Clone the packet forwarder repository: `git clone https://github.com/Lora-net/sx1302_hal.git`.
|
||||
|
||||
Go into the repo and run `make`.
|
||||
|
||||
Make pf user + give permissions
|
||||
|
||||
- `sudo useradd -m -s /usr/sbin/nologin pf`
|
||||
- `-m`: create home
|
||||
- `-s /usr/sbin/nologin`: don't allow logging in; the user's only purpose is to own the packet forwarder process
|
||||
- `pf`: the username
|
||||
- `sudo usermod -aG gpio,spi,i2c,dialout pf`
|
||||
|
||||
From the packet forwarder repo, copy files to pf user's home and set permissions:
|
||||
|
||||
```sh
|
||||
sudo cp packet_forwarder/{global_conf.json.sx1250.US915,lora_pkt_fwd} /home/pf
|
||||
sudo cp tools/reset_lgw.sh /home/pf
|
||||
sudo chown pf:pf /home/pf/{global_conf.json.sx1250.US915,lora_pkt_fwd,reset_lgw.sh}
|
||||
sudo chmod +x /home/pf/{lora_pkt_fwd,reset_lgw.sh}
|
||||
```
|
||||
|
||||
Modify the packet forward config at `/home/pf/global_conf.json.sx1250.US915`. Change `gateway_ID` to something nice (????). 8 bytes (16 uppercase hex characters)
|
||||
|
||||
Modify the `reset_lgw.sh` file to have the following GPIO values, [ref](https://wiki.seeedstudio.com/WM1302_module/#step4-run-semtech-sx1302-packet-forwarder):
|
||||
|
||||
```sh
|
||||
SX1302_RESET_PIN=17 # SX1302 reset
|
||||
SX1302_POWER_EN_PIN=18 # SX1302 power enable
|
||||
SX1261_RESET_PIN=5 # SX1261 reset (LBT / Spectral Scan)
|
||||
AD5338R_RESET_PIN=13 # AD5338R reset (full-duplex CN490 reference design)
|
||||
```
|
||||
|
||||
Create SystemD unit file at `/etc/systemd/system/packet-forwarder.service`:
|
||||
|
||||
```systemd
|
||||
[Unit]
|
||||
Description=SX1302 Packet Forwarder
|
||||
After=network.target
|
||||
StartLimitIntervalSec=0
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
Restart=always
|
||||
RestartSec=1
|
||||
User=pf
|
||||
WorkingDirectory=/home/pf
|
||||
ExecStart=/home/pf/lora_pkt_fwd -c global_conf.json.sx1250.US915
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
```
|
||||
|
||||
Start and enable `sudo systemctl enable --now packet-forwarder.service`.
|
||||
|
||||
Check that it is running with `sudo systemctl status packet-forwarder.service`.
|
||||
Reference in New Issue
Block a user