From 10cc08ceb0239684f59bc09f5b0c73a67678bade Mon Sep 17 00:00:00 2001 From: Peter Putz Date: Wed, 22 Jul 2020 15:04:07 +0200 Subject: [PATCH 1/2] pygate: say hello and wait for ntp --- content/tutorials/PyGate.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/content/tutorials/PyGate.md b/content/tutorials/PyGate.md index 08b4ad5..49f306a 100644 --- a/content/tutorials/PyGate.md +++ b/content/tutorials/PyGate.md @@ -56,6 +56,7 @@ import machine from machine import RTC import pycom +print('\nStarting LoRaWAN concentrator') # Disable Hearbeat pycom.heartbeat(False) @@ -75,19 +76,26 @@ def machine_cb (arg): # register callback function machine.callback(trigger = (machine.PYGATE_START_EVT | machine.PYGATE_STOP_EVT | machine.PYGATE_ERROR_EVT), handler=machine_cb) +print('Connecting to WiFi...', end='') # Connect to a Wifi Network wlan = WLAN(mode=WLAN.STA) wlan.connect(ssid='', auth=(WLAN.WPA2, "")) while not wlan.isconnected(): + print('.', end='') time.sleep(1) - -print("Wifi Connection established") +print(" OK") # Sync time via NTP server for GW timestamps on Events +print('Syncing RTC via ntp...', end='') rtc = RTC() rtc.ntp_sync(server="0.pool.ntp.org") +while not rtc.synced(): + print('.', end='') + time.sleep(.5) +print(" OK\n") + # Read the GW config file from Filesystem fp = open('/flash/config.json','r') buf = fp.read() From fc94234a2a041a77aa46f52c2b49d2ed7e8175bc Mon Sep 17 00:00:00 2001 From: gijsio <67470426+gijsio@users.noreply.github.com> Date: Fri, 24 Jul 2020 09:37:35 +0200 Subject: [PATCH 2/2] moved the file to the new location added antenna instructions --- content/tutorials/{PyGate.md => expansionboards/pygate.md} | 1 + 1 file changed, 1 insertion(+) rename content/tutorials/{PyGate.md => expansionboards/pygate.md} (98%) diff --git a/content/tutorials/PyGate.md b/content/tutorials/expansionboards/pygate.md similarity index 98% rename from content/tutorials/PyGate.md rename to content/tutorials/expansionboards/pygate.md index 49f306a..8fcc957 100644 --- a/content/tutorials/PyGate.md +++ b/content/tutorials/expansionboards/pygate.md @@ -16,6 +16,7 @@ To connect your Pygate to a LoRa server, please follow these steps: 1. Attach a WiPy 3, GPy or LoPy 4 to the Pygate. The RGB LED of the development board should be aligned with the USB port of the Pygate. 1. Attach the LoRa Antenna to the Pygate. +>Note: Do not attach the antenna to the Lopy4 module. Also, make sure you disabled the Pybytes LoRa connection. 1. Flash the Pycom Device with with a firmware build where Pygate functionality is enabled. In the firmware update tool, please choose pygate as the firmware type. 1. Create a `config.json` for your Pygate and upload it (please check the template further below). 1. Create a `main.py` that creates an uplink (wifi, ethernet or lte) and runs the LoRa packet forwarder (see example below).