diff --git a/.DS_Store b/.DS_Store index 8ceca99186e9dbf32b4f6169866456794034b491..1233496ee8c02aeb959da593f5005b80dca75803 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/Autre/.DS_Store b/Autre/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..0f1a5df841094395828eb8202f84b49b75dbc893 Binary files /dev/null and b/Autre/.DS_Store differ diff --git a/Autre/pygate 2/boot.py b/Autre/pygate 2/boot.py new file mode 100644 index 0000000000000000000000000000000000000000..edd453ce4b2461644e2a42aa3120a2b9dbe94049 --- /dev/null +++ b/Autre/pygate 2/boot.py @@ -0,0 +1 @@ +# boot.py -- run on boot-up diff --git a/Autre/pygate 2/global_conf.json b/Autre/pygate 2/global_conf.json new file mode 100644 index 0000000000000000000000000000000000000000..023152eba197a0321414ccbf7d8d5939b9fcdad4 --- /dev/null +++ b/Autre/pygate 2/global_conf.json @@ -0,0 +1,188 @@ +{ + "SX1301_conf": { + "lorawan_public": true, + "clksrc": 1, + "antenna_gain": 0, + "radio_0": { + "enable": true, + "type": "SX1257", + "freq": 867500000, + "rssi_offset": -166, + "tx_enable": true, + "tx_freq_min": 863000000, + "tx_freq_max": 870000000 + }, + "radio_1": { + "enable": true, + "type": "SX1257", + "freq": 868500000, + "rssi_offset": -166, + "tx_enable": false + }, + "chan_multiSF_0": { + "enable": true, + "radio": 1, + "if": -400000 + }, + "chan_multiSF_1": { + "enable": true, + "radio": 1, + "if": -200000 + }, + "chan_multiSF_2": { + "enable": true, + "radio": 1, + "if": 0 + }, + "chan_multiSF_3": { + "enable": true, + "radio": 0, + "if": -400000 + }, + "chan_multiSF_4": { + "enable": true, + "radio": 0, + "if": -200000 + }, + "chan_multiSF_5": { + "enable": true, + "radio": 0, + "if": 0 + }, + "chan_multiSF_6": { + "enable": true, + "radio": 0, + "if": 200000 + }, + "chan_multiSF_7": { + "enable": true, + "radio": 0, + "if": 400000 + }, + "chan_Lora_std": { + "enable": true, + "radio": 1, + "if": -200000, + "bandwidth": 250000, + "spread_factor": 7 + }, + "chan_FSK": { + "enable": true, + "radio": 1, + "if": 300000, + "bandwidth": 125000, + "datarate": 50000 + }, + "tx_lut_0": { + "pa_gain": 0, + "mix_gain": 8, + "rf_power": -6, + "dig_gain": 0 + }, + "tx_lut_1": { + "pa_gain": 0, + "mix_gain": 10, + "rf_power": -3, + "dig_gain": 0 + }, + "tx_lut_2": { + "pa_gain": 0, + "mix_gain": 12, + "rf_power": 0, + "dig_gain": 0 + }, + "tx_lut_3": { + "pa_gain": 1, + "mix_gain": 8, + "rf_power": 3, + "dig_gain": 0 + }, + "tx_lut_4": { + "pa_gain": 1, + "mix_gain": 10, + "rf_power": 6, + "dig_gain": 0 + }, + "tx_lut_5": { + "pa_gain": 1, + "mix_gain": 12, + "rf_power": 10, + "dig_gain": 0 + }, + "tx_lut_6": { + "pa_gain": 1, + "mix_gain": 13, + "rf_power": 11, + "dig_gain": 0 + }, + "tx_lut_7": { + "pa_gain": 2, + "mix_gain": 9, + "rf_power": 12, + "dig_gain": 0 + }, + "tx_lut_8": { + "pa_gain": 1, + "mix_gain": 15, + "rf_power": 13, + "dig_gain": 0 + }, + "tx_lut_9": { + "pa_gain": 2, + "mix_gain": 10, + "rf_power": 14, + "dig_gain": 0 + }, + "tx_lut_10": { + "pa_gain": 2, + "mix_gain": 11, + "rf_power": 16, + "dig_gain": 0 + }, + "tx_lut_11": { + "pa_gain": 3, + "mix_gain": 9, + "rf_power": 20, + "dig_gain": 0 + }, + "tx_lut_12": { + "pa_gain": 3, + "mix_gain": 10, + "rf_power": 23, + "dig_gain": 0 + }, + "tx_lut_13": { + "pa_gain": 3, + "mix_gain": 11, + "rf_power": 25, + "dig_gain": 0 + }, + "tx_lut_14": { + "pa_gain": 3, + "mix_gain": 12, + "rf_power": 26, + "dig_gain": 0 + }, + "tx_lut_15": { + "pa_gain": 3, + "mix_gain": 14, + "rf_power": 27, + "dig_gain": 0 + } + }, + "gateway_conf": { + "gateway_ID": "2462ABFFFEF4C0B0", + "server_address": "eu1.cloud.thethings.network", + "serv_port_up": 1700, + "serv_port_down": 1700, + "servers": [ + { + "gateway_ID": "2462ABFFFEF4C0B0", + "server_address": "eu1.cloud.thethings.network", + "serv_port_up": 1700, + "serv_port_down": 1700, + "serv_enabled": true + } + ] + } +} \ No newline at end of file diff --git a/Autre/pygate 2/main.py b/Autre/pygate 2/main.py new file mode 100644 index 0000000000000000000000000000000000000000..24602c4d94104dcb60939710b4eb4c7dc586a16e --- /dev/null +++ b/Autre/pygate 2/main.py @@ -0,0 +1,57 @@ +from network import WLAN +import time +import machine +from machine import RTC +import pycom + +print('\nStarting LoRaWAN concentrator') +# Disable Hearbeat +pycom.heartbeat(False) + +# Define callback function for Pygate events +def machine_cb (arg): + evt = machine.events() + if (evt & machine.PYGATE_START_EVT): + # Green + pycom.rgbled(0x103300) + elif (evt & machine.PYGATE_ERROR_EVT): + # Red + pycom.rgbled(0x331000) + elif (evt & machine.PYGATE_STOP_EVT): + # RGB off + pycom.rgbled(0x000000) + +# 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='ObjetsConnectes', auth=(WLAN.WPA2, 'Pandemie2021')) +#wlan.connect(ssid='iPhone de Charlotte', auth=(WLAN.WPA2, 'azilisenoraalan')) + +while not wlan.isconnected(): + print('.', end='') + time.sleep(1) +print(" OK") + +# Sync time via NTP server for GW timestamps on Events +print('Syncing RTC via ntp...', end='') +rtc = RTC() +rtc.ntp_sync(server="pool.ntp.org") + +while not rtc.synced(): + print('.', end='') + time.sleep(.5) +print(" OK\n") + +# Read the GW config file from Filesystem +with open('/flash/global_conf.json','r') as fp: + buf = fp.read() + +# Start the Pygate +machine.pygate_init(buf) +# disable degub messages +# machine.pygate_debug_level(1) + +# To stop the Pygate at any time press Ctrl-C on the REPL and run machine.pygate_deinit(). It will take a few seconds to stop the gateway tasks and safely power-off the concentrator. \ No newline at end of file diff --git a/Autre/pygate 2/project.pymakr b/Autre/pygate 2/project.pymakr new file mode 100644 index 0000000000000000000000000000000000000000..a00bf29d0ae68d518ac11db27d99a2128d2aa579 --- /dev/null +++ b/Autre/pygate 2/project.pymakr @@ -0,0 +1 @@ +[["global_conf.json","f","0b7f1cd0e5713e9ac7c8545200e7a878ec3d5f0e63256fae78c9f85f16a4ea1e",3585],["main.py","f","43545e81570daa6f8f324427fcb4e80f42f70d882168b4a119c3c8f9bf29b460",1383]] \ No newline at end of file diff --git a/Autre/pygate 2/pymakr.conf b/Autre/pygate 2/pymakr.conf new file mode 100644 index 0000000000000000000000000000000000000000..dd042bd24f4fe7c1525b01bcd3dd4eb0a3ed412e --- /dev/null +++ b/Autre/pygate 2/pymakr.conf @@ -0,0 +1,10 @@ +{ + "py_ignore": [ + ".vscode", + ".gitignore", + ".git", + "env", + "venv" + ], + "name": "pygate" +} \ No newline at end of file