-
Notifications
You must be signed in to change notification settings - Fork 12
Description
I'm trying to follow the LoRA Node tutorial for Raspberry Pi here:
https://learn.pi-supply.com/make/getting-started-with-the-raspberry-pi-lora-node-phat
I'm getting stuck during the hello world script due to the serial interface timing out. But not all the time. Sometimes it times out waiting for a response from a gateway (I don't have my own) and once or twice I got a handshake to appear on the TTN console.
Using
- Raspberry Pi Zero W
- Raspbian Buster Lite
- IoT LoRa pHAT node
- rak811 version 0.8.1
- Tutorial here: https://learn.pi-supply.com/make/getting-started-with-the-raspberry-pi-lora-node-phat
Steps to Reproduce
- Install the pHAT node onto the Pi as per tutorial.
- Enable serial but disable serial console, and set
dtoverlay=pi3-miniuart-btin/boot/config.txtas per tutorial. - Install RAK811 library as per tutorial.
- Get Device EUI with commands:
$ rak811 -vd hard-reset DEBUG:rak811.serial:Serial initialized Hard reset complete $ rak811 -vd get-config dev_eui DEBUG:rak811.serial:Serial initialized DEBUG:rak811.serial:Sending: >at+get_config=dev_eui\r\n< DEBUG:rak811.serial:Received: >OK34************14< 34************14 - Create an Application on the V2 console for The Things Network.
- Application ID & Description: Set
- Handler:
ttn-handler-eu(Automatically selected) - Application EUI: (Automatically chosen on v2 console.)
- 1 Device:
- Application ID: (Matches high-level application ID)
- Device ID: (I typed something in)
- Activation Method: OTAA
- Device EUI: (Use my device EUI)
- Application EUI: (Matches high-level application EUI)
- App Key: (Auto Generated)
- NOTES on V3 Console:
- When adding device, use
OTAA- Specify LoRaWAN version
MAC V1.0.2 - Server
nam1.cloud.thethings.network - Regional Parameters version
PHY V1.0.2 REV B.
- AppEUI is not automatically provided anymore. You make something up or make it match your old v2 app EUI.
- Frequency Plan:
US915 FSB 2 - Regional Parameters Rev B
- LoRaWAN Class Capabilities: Leave all unchecked.
- However, I think I saw Rak811 Datasheet state that it supports Class C.
- AppKey: Randomly generated
- (All this stuff I got from the Migration Tutorial (https://www.thethingsnetwork.org/docs/the-things-stack/migrate-to-v3/migrate-using-console/)
- When adding device, use
- Create the lora_node.py script as per tutorial.
- Notes:
from rak811 import Mode, Rak811doesn't work any more. Now, you have to usefrom rak811.rak811 import Mode, Rak811.- Dev EUI, App Key, App EUI set according to how the TTN app configured.
- Band: US915 (Because I live in Canada)
- Additional channel masks set as per tutorial for US915, inserted between the
lora.set_config(dev_eui, app_eui, app_key)andlora.join_otaa()commands. - Run
chmod +xon the script.
- Notes:
- Run the script.
Expected Behavior
It either works, or maybe I'll get errors about talking to a gateway because I live a long ways away from one. (I bought the device for P2P communication primarily)
Observed Behavior
I get "Timeout while waiting for data" on the lora.join_otaa() step.
$ ./lora_node.py
Traceback (most recent call last):
File "./lora_node.py", line 18, in <module>
lora.join_otaa()
File "/usr/local/lib/python3.7/dist-packages/rak811/rak811.py", line 411, in join_otaa
self._send_command('join=otaa')
File "/usr/local/lib/python3.7/dist-packages/rak811/rak811.py", line 237, in _send_command
response = self._serial.receive()
File "/usr/local/lib/python3.7/dist-packages/rak811/serial.py", line 156, in receive
raise Rak811TimeoutError('Timeout while waiting for data')
rak811.serial.Rak811TimeoutError: Timeout while waiting for data
Run the script again. This time I get a similar timeout error on lora.mode = Mode.LoRaWan.
Okay, so I've got serial problems. But why did the first couple of commands go through? Let's try them again.
$ rak811 -vd get-config dev_eui
DEBUG:rak811.serial:Serial initialized
DEBUG:rak811.serial:Sending: >at+get_config=dev_eui\r\n<
RAK811 timeout: Timeout while waiting for data
Any ideas?