Merge pull request #312 from pycom/pysense2-pytrack2

Pysense2 pytrack2
This commit is contained in:
gijsio
2020-12-21 19:57:45 +01:00
committed by GitHub
20 changed files with 287 additions and 139 deletions

View File

@@ -397,31 +397,31 @@ theme = "doc-theme"
weight = 10
[[menu.main]]
name = "pysense"
url = "/tutorials/expansionboards/pysense"
url = "/tutorials/expansionboards/pysense/"
identifier = "tutorials@expansionboards@pysense"
parent = "tutorials@expansionboards"
weight = 20
[[menu.main]]
name = "pysense 2.0 X"
url = "/tutorials/expansionboards/pysense2"
url = "/tutorials/expansionboards/pysense2/"
identifier = "tutorials@expansionboards@pysense2"
parent = "tutorials@expansionboards"
weight = 30
[[menu.main]]
name = "pytrack"
url = "/tutorials/expansionboards/pytrack"
url = "/tutorials/expansionboards/pytrack/"
identifier = "tutorials@expansionboards@pytrack"
parent = "tutorials@expansionboards"
weight = 40
[[menu.main]]
name = "pytrack 2.0 X"
url = "/tutorials/expansionboards/pytrack2"
url = "/tutorials/expansionboards/pytrack2/"
identifier = "tutorials@expansionboards@pytrack2"
parent = "tutorials@expansionboards"
weight = 50
[[menu.main]]
name = "pyscan"
url = "/tutorials/expansionboards/pyscan"
url = "/tutorials/expansionboards/pyscan/"
identifier = "tutorials@expansionboards@pyscan"
parent = "tutorials@expansionboards"
weight = 60

View File

@@ -7,6 +7,8 @@ aliases:
- chapter/datasheets/boards/pysense
---
**Store**: [Buy Here](https://pycom.io/product/pysense/)
![](/gitbook/assets/pysense.png)
## Datasheet
@@ -18,10 +20,10 @@ The datasheet of the Pysense is available as a [PDF File](/gitbook/assets/pysens
## Pinout
The pinout of the Pysense is available as a [PDF File](/gitbook/assets/pysense-pinout.pdf)
* The user button is connected to `P14`. This button can also be used to put the Pysense board in `dfu-bootloader` mode to update the firmware.
![](/gitbook/assets/pysense-pinout-1.png)
## Notes
### Battery Charger

View File

@@ -15,7 +15,10 @@ The datasheet of the Pysense 2.0X is available as a [PDF File](/gitbook/assets/P
## Pinout
The PyPort connector is for a 6 lead mini ribbon cable. Part: Amphenol 20021511-00006T4LF
The PyPort connector is for a 6 lead mini ribbon cable, part: Amphenol 20021511-00006T4LF. The external IO header power pins are labelled as follows
* 3V3AUX - The power provided by the development module
* 3V3AUX_LP - the power provided by the development module for the SD card (This can be switched off)
* 3V3 - The power provided by the Pysense 2, for the USB-Serial converter.
The pinout of the Pysense is available as a [PDF File](/gitbook/assets/pysense2-pinout.pdf)

View File

@@ -15,13 +15,26 @@ The datasheet of the Pytrack is available as a [PDF File](/gitbook/assets/PyTrac
## Pinout
The PyPort connector is for a 6 lead mini ribbon cable. Part: Amphenol 20021511-00006T4LF
The pinout of the Pytrack is available as a [PDF File](/gitbook/assets/pytrack2-pinout.pdf)
The PyPort connector is for a 6 lead mini ribbon cable. Part: Amphenol 20021511-00006T4LF.
The external IO header power pins are labelled as follows
* 3V3AUX - The power provided by the development module
* 3V3AUX_LP - the power provided by the development module for the SD card (This can be switched off)
* 3V3 - The power provided by the Pysense 2, for the USB-Serial converter. This is also used to power the GPS in standby mode.
The pinout of the Pytrack is available as a [PDF File](
/gitbook/assets/pytrack2-pinout.pdf)
The Pytrack 2.0 X features a SMA connector that allows for the connection of an external active or passive GPS antenna. The SMA connector has an internal switch that switches the connection from the internal to the external antenna automatically upon connection of the external antenna.
![](/gitbook/assets/pytrack2-pinout.png)
## Notes
### Antenna
The Pytrack 2.0 X board has an internal GPS antenna built in. You can find it on the front side near the bottom, labelled `RFI1`. When you are not using the external antenna, remove the jumper labeled `AON`. If you want better reception and faster fix times, you can use the external GPS antenna with the Pytrack 2.0 X. The SMA connector on the side does **NOT** work with the LoRa or WiFi whip antennas you might already have! You can purchase the appropiate GPS antenna from our webshop [here](https://pycom.io/product/external-gps-antenna/).
### Battery Charger
The board features a single cell Li-Ion/Li-Po charger with a JST PHR2 connector. When the board is being powered via the micro USB connector, it will charge the battery (if connected).

View File

@@ -16,7 +16,7 @@ In the following guide, we will explain the basic process to get started using y
1. [Setting up the hardware](#step-1-setting-up-the-hardware)
2. [Setting up your computer](#step-2-setting-up-your-computer)
3. [Programming the module](#step-3-programming-your-module)
4. [Using your Expansionboard](#step-4-using-your-expansionboard)
<!-- ![](/gitbook/assets/getting_started%20%281%29.png) -->
@@ -35,7 +35,7 @@ This step works the same for all our development boards and expansion boards. In
## Step 2: Setting up your computer
Now that your module is successfully connected, you will need to install some software on your computer to interface with it. For this, we use Pymakr, a plugin for both Visual Studio Code and Atom IDE. Through either one of the environments, we can connect to the board and talk Python!
Now that your module is successfully connected, you will need to install some software on your computer to interface with it. For this, we use Pymakr, a plugin for both Visual Studio Code and Atom IDE. Through either one of the environments, we can connect to the board and talk Python!
Follow the link below for the installation instructions:
@@ -82,7 +82,7 @@ import time
This will import two libraries, `pycom` which is responsible for Pycom specific features, such as the on-board LED and `time` which is a standard library used for timing and delays.
>You may have noticed that when you power up your Pycom module, the on-board LED blinks blue on a regular basis. This "heartbeat" is used as a way of know that your module has powered up and started correctly.
>You may have noticed that when you power up your Pycom module, the on-board LED blinks blue on a regular basis. This "heartbeat" is used as a way of know that your module has powered up and started correctly.
Before we can change the colour of this LED we need to disable this heart beat. Below your imports you will need to add the following:
@@ -92,7 +92,7 @@ pycom.heartbeat(False)
```
Now it's time to test your code. On the Pymakr pane, you will see a `run` button, but als an `upload (to device)` button. For now, we will use `run`.
Now it's time to test your code. On the Pymakr pane, you will see a `run` button, but als an `upload (to device)` button. For now, we will use `run`.
After running the example code above, you should see that that on-board LED stops blinking blue. Now, we can complete our script to blink the LED like so:
@@ -127,8 +127,21 @@ If you need to remove files from your device you can use the following commands:
>>> os.fsformat('/flash')
```
## Step 4: Further references
Now that we got the basic example running, you can proceed to develop your own application! For further references, you can check the links below:
## Step 4: Using your expansionboard
From here on, you can continue to use the additional features of your expansionboard:
>Note The Expansionboard requires no additional libraries and all functions work out of the box!
|[ Pygate](/tutorials/expansionboards/pygate/)| [Pysense](/tutorials/expansionboards/pysense/) | [Pysense 2.0 X](/tutorials/expansionboards/pysense2/)| [Pytrack](/tutorials/expansionboards/pytrack/)| [Pytrack 2.0 X](/tutorials/expansionboards/pytrack2/)| [PyScan ](/tutorials/expansionboards/pyscan/)|
|:----|:-----|:-----|:-----|:-----|:----|
| [![](/gitbook/assets/expansionboards/pygate.png)](/tutorials/expansionboards/pygate/)|[![](/gitbook/assets/expansionboards/pysense1.png)](/tutorials/expansionboards/pysense/) | [![](/gitbook/assets/expansionboards/pysense2.png)](/tutorials/expansionboards/pysense2/)| [![](/gitbook/assets/expansionboards/pytrack1.png)](/tutorials/expansionboards/pytrack/)| [![](/gitbook/assets/expansionboards/pytrack2.png)](/tutorials/expansionboards/pytrack2/)| [![](/gitbook/assets/expansionboards/pyscan.png)](/tutorials/expansionboards/pyscan/) |
## Step 5: Connecting to a network
|[WiFi](/tutorials/networks/wlan/) | [LoRa](/tutorials/networks/lora/) | [SigFox](/tutorials/networks/sigfox/) | [BLE](/tutorials/networks/ble/) | [LTE](/tutorials.networks/lte/) | Ethernet |
|:---|:---|:---|:---|:---|:---|
## Further references
Now that we got the basic example running, you can continue with the links below.
* [Tutorials and examples](/tutorials/)

View File

@@ -6,10 +6,12 @@ aliases:
- chapter/tutorials/expansionboards
disable_breadcrumbs: true
---
>Note: Before using the Pysense, Pytrack and Pyscan boards, check the [GitHub](https://github.com/pycom/pycom-libraries) for the latest version of the libraries.
To use the Pysense, Pytrack or Pyscan, make a folder inside your project folder and call it `lib`. Then, copy the appropiate sensor libraries from the github repository to the folder. Always copy the `pysense.py` or `pytrack.py` and `pycoproc.py` files if you want to use the boards' functions. The `pycoproc.py` library also allows for a special sleep mode. An example for this is provided [here](../expansionboards/sleep/)
* [Pygate](../expansionboards/pygate/)
* [Pysense](../expansionboards/pysense/)
* [Pysense 2.0 X](../expansionboards/pysense2/)
@@ -18,4 +20,4 @@ To use the Pysense, Pytrack or Pyscan, make a folder inside your project folder
* [Pyscan](../expansionboards/pyscan/)
>Note: Make sure to click `upload to device` to be able to `import` the appropriate libraries in your code!
>Note: Make sure to click `upload to device` to be able to `import` the appropriate libraries in your code!

View File

@@ -1,16 +1,22 @@
## Pygate
---
title: "Pygate"
---
The Pygate is an 8-channel LoRaWAN gateway. This page will help you get started with it.
{{% hint style="info" %}}
While the Pygate shield has the radio chips required to act as a LoRaWAN gateway, it will require a WiPy3, GPy or LoPy4 to run the LoRaWAN gateway software and provide connectivity to the LoRaWAN server (TTN / ChirpStack etc.) via WiFi, Ethernet (with the optional PyEthernet adapter) or LTE-M (a GPy with a mobile subscription is required for LTE-M connectivity).
{{% /hint %}}
A USB connection is recommended for the initial firmware update of the Pycom development module (WiPy 3, GPy, LoPy4) and to upload the configuration & start-up script. The module can be updated over the air via WiFi / LTE-M (depending on network capabilities) or via Ethernet connection which allows installation of the gateway in remote locations.
A USB connection is recommended for the initial firmware update of the Pycom development module (WiPy 3, GPy, LoPy4) and to upload the configuration & start-up script. The module can be updated over the air via WiFi / LTE-M (depending on network capabilities) or via Ethernet connection which allows installation of the gateway in remote locations.
The Pygate board can have the PyEthernet adapter connected which allows an Ethernet connection. The PyEthernet also supports PoE. Please check the separate [page and warning for PoE-NI!](/tutorials/networkprotocols/poe/)
### Quickstart
What is discussed in this example:
1. [Setup](#setup)
2. [TTN](#example-ttn-wifi)
3. [Config file](#config-file)
4. [Logs expalantion](#pygate-logs)
## Setup
To connect your Pygate to a LoRa server, please follow these steps:
@@ -27,12 +33,9 @@ To connect your Pygate to a LoRa server, please follow these steps:
Make sure you supply a config matching your region (EU868, US915, etc), e.g. https://github.com/Lora-net/packet_forwarder/tree/master/lora_pkt_fwd/cfg. If you are in EU region, it should be sufficient to update the example below with your GW ID, the LoRa server address and port number.
{{% hint style="info" %}}
**Note** Running the LoRa gateway on a GPy can get you close to the memory limit of the device. To avoid running out of memory one should not *run* the WiFi task and the LTE task at the same time. This shouldn't really restrict your use of the Pygate, since you wouldn't be *using* WiFi and LTE at the same time. The tasks *run* when you explicitly initialize them with ``wlan = WLAN()`` or ``lte = LTE()``, or when they get automatically started upon boot based on the settings ``pycom.wifi_on_boot(True)`` or ``pycom.lte_modem_en_on_boot(True)``. Bottom line, if you have trouble starting the LoRa packet forwarder, please double check these settings and make sure at least the network that you don't use is not automatically started.{{% /hint %}}
Running the LoRa gateway on a GPy can get you close to the memory limit of the device. To avoid running out of memory one should not *run* the WiFi task and the LTE task at the same time. This shouldn't really restrict your use of the Pygate, since you wouldn't be *using* WiFi and LTE at the same time. The tasks *run* when you explicitly initialize them with ``wlan = WLAN()`` or ``lte = LTE()``, or when they get automatically started upon boot based on the settings ``pycom.wifi_on_boot(True)`` or ``pycom.lte_modem_en_on_boot(True)``. Bottom line, if you have trouble starting the LoRa packet forwarder, please double check these settings and make sure at least the network that you don't use is not automatically started.
### Example TTN Wifi
## Example TTN WiFi
The following example shows the script and json file to run the Pygate over Wifi connecting to [The Things Network](https://www.thethingsnetwork.org/).
@@ -42,7 +45,7 @@ The following example shows the script and json file to run the Pygate over Wifi
1. make up a EUI (8 byte hexadecimal value) and register it on the TTN website
1. enter the EUI in your `config.json` under `gateway_ID` (Just enter the hex digits without the "eui-" prefix and without spaces)
1. select your Frequency Plan
1. select a router - also enter the hostname in your `config.json` under `server_address`
1. select the router for your region.
1. enter your wifi SSID and password in `main.py`
1. upload `config.json` and `main.py` and reset the board
1. you will see how it creates the uplink connection and then start the LoRa GW. It will print out some debug information while it is running. After some initialization it will print "LoRa GW started" and the LED will turn green.
@@ -106,19 +109,38 @@ machine.pygate_init(buf)
# machine.pygate_debug_level(1)
```
A sample `config.json` file for gateway configuration in EU868 region:
## Config file
1. You can find the config file for your region [here](https://github.com/TheThingsNetwork/gateway-conf)
2. Make a file called `config.json` in your project and paste the appropriate region settings to that file
3. Add the following to the bottom of the `config.json` file:
```json
...
} ],
"gateway_ID": "XXXXXXXXXXXXXXXX",
"keepalive_interval": 10,
"stat_interval": 30,
"push_timeout_ms": 100,
"forward_crc_valid": true,
"forward_crc_error": false,
"forward_crc_disabled": false
}
}
4. Edit the `gateway_ID` to reflect yours.
5. An example for EU868 is shown here:
```json
{
"SX1301_conf": {
"lorawan_public": true,
"clksrc": 1,
"clksrc_desc": "radio_1 provides clock to concentrator for most devices except MultiTech. For MultiTech set to 0.",
"antenna_gain": 0,
"antenna_gain_desc": "antenna gain, in dBi",
"radio_0": {
"enable": true,
"type": "SX1257",
"freq": 867500000,
"rssi_offset": -164.0,
"rssi_offset": -166.0,
"tx_enable": true,
"tx_freq_min": 863000000,
"tx_freq_max": 870000000
@@ -127,50 +149,59 @@ A sample `config.json` file for gateway configuration in EU868 region:
"enable": true,
"type": "SX1257",
"freq": 868500000,
"rssi_offset": -164.0,
"rssi_offset": -166.0,
"tx_enable": false
},
"chan_multiSF_0": {
"desc": "Lora MAC, 125kHz, all SF, 868.1 MHz",
"enable": true,
"radio": 1,
"if": -400000
},
"chan_multiSF_1": {
"desc": "Lora MAC, 125kHz, all SF, 868.3 MHz",
"enable": true,
"radio": 1,
"if": -200000
},
"chan_multiSF_2": {
"desc": "Lora MAC, 125kHz, all SF, 868.5 MHz",
"enable": true,
"radio": 1,
"if": 0
},
"chan_multiSF_3": {
"desc": "Lora MAC, 125kHz, all SF, 867.1 MHz",
"enable": true,
"radio": 0,
"if": -400000
},
"chan_multiSF_4": {
"desc": "Lora MAC, 125kHz, all SF, 867.3 MHz",
"enable": true,
"radio": 0,
"if": -200000
},
"chan_multiSF_5": {
"desc": "Lora MAC, 125kHz, all SF, 867.5 MHz",
"enable": true,
"radio": 0,
"if": 0
},
"chan_multiSF_6": {
"desc": "Lora MAC, 125kHz, all SF, 867.7 MHz",
"enable": true,
"radio": 0,
"if": 200000
},
"chan_multiSF_7": {
"desc": "Lora MAC, 125kHz, all SF, 867.9 MHz",
"enable": true,
"radio": 0,
"if": 400000
},
"chan_Lora_std": {
"desc": "Lora MAC, 250kHz, SF7, 868.3 MHz",
"enable": true,
"radio": 1,
"if": -200000,
@@ -178,6 +209,7 @@ A sample `config.json` file for gateway configuration in EU868 region:
"spread_factor": 7
},
"chan_FSK": {
"desc": "FSK 50kbps, 868.8 MHz",
"enable": true,
"radio": 1,
"if": 300000,
@@ -185,114 +217,192 @@ A sample `config.json` file for gateway configuration in EU868 region:
"datarate": 50000
},
"tx_lut_0": {
"pa_gain": 0,
"mix_gain": 5,
"rf_power": 9,
"dig_gain": 3
},
"tx_lut_1": {
"pa_gain": 0,
"mix_gain": 5,
"rf_power": 9,
"dig_gain": 3
},
"tx_lut_2": {
"pa_gain": 0,
"mix_gain": 5,
"rf_power": 9,
"dig_gain": 3
},
"tx_lut_3": {
"pa_gain": 0,
"mix_gain": 5,
"rf_power": 9,
"dig_gain": 3
},
"tx_lut_4": {
"pa_gain": 0,
"mix_gain": 5,
"rf_power": 9,
"dig_gain": 3
},
"tx_lut_5": {
"pa_gain": 0,
"mix_gain": 5,
"rf_power": 9,
"dig_gain": 3
},
"tx_lut_6": {
"pa_gain": 0,
"mix_gain": 5,
"rf_power": 9,
"dig_gain": 3
},
"tx_lut_7": {
"pa_gain": 0,
"mix_gain": 6,
"rf_power": 11,
"dig_gain": 3
},
"tx_lut_8": {
"pa_gain": 0,
"mix_gain": 5,
"rf_power": 13,
"dig_gain": 2
},
"tx_lut_9": {
"desc": "TX gain table, index 0",
"pa_gain": 0,
"mix_gain": 8,
"rf_power": 14,
"dig_gain": 3
"rf_power": -6,
"dig_gain": 0
},
"tx_lut_10": {
"pa_gain": 0,
"mix_gain": 6,
"rf_power": 15,
"dig_gain": 2
},
"tx_lut_11": {
"pa_gain": 0,
"mix_gain": 6,
"rf_power": 16,
"dig_gain": 1
},
"tx_lut_12": {
"pa_gain": 0,
"mix_gain": 9,
"rf_power": 17,
"dig_gain": 3
},
"tx_lut_13": {
"tx_lut_1": {
"desc": "TX gain table, index 1",
"pa_gain": 0,
"mix_gain": 10,
"rf_power": 18,
"dig_gain": 3
"rf_power": -3,
"dig_gain": 0
},
"tx_lut_14": {
"pa_gain": 0,
"mix_gain": 11,
"rf_power": 19,
"dig_gain": 3
},
"tx_lut_15": {
"tx_lut_2": {
"desc": "TX gain table, index 2",
"pa_gain": 0,
"mix_gain": 12,
"rf_power": 0,
"dig_gain": 0
},
"tx_lut_3": {
"desc": "TX gain table, index 3",
"pa_gain": 1,
"mix_gain": 8,
"rf_power": 3,
"dig_gain": 0
},
"tx_lut_4": {
"desc": "TX gain table, index 4",
"pa_gain": 1,
"mix_gain": 10,
"rf_power": 6,
"dig_gain": 0
},
"tx_lut_5": {
"desc": "TX gain table, index 5",
"pa_gain": 1,
"mix_gain": 12,
"rf_power": 10,
"dig_gain": 0
},
"tx_lut_6": {
"desc": "TX gain table, index 6",
"pa_gain": 1,
"mix_gain": 13,
"rf_power": 11,
"dig_gain": 0
},
"tx_lut_7": {
"desc": "TX gain table, index 7",
"pa_gain": 2,
"mix_gain": 9,
"rf_power": 12,
"dig_gain": 0
},
"tx_lut_8": {
"desc": "TX gain table, index 8",
"pa_gain": 1,
"mix_gain": 15,
"rf_power": 13,
"dig_gain": 0
},
"tx_lut_9": {
"desc": "TX gain table, index 9",
"pa_gain": 2,
"mix_gain": 10,
"rf_power": 14,
"dig_gain": 0
},
"tx_lut_10": {
"desc": "TX gain table, index 10",
"pa_gain": 2,
"mix_gain": 11,
"rf_power": 16,
"dig_gain": 0
},
"tx_lut_11": {
"desc": "TX gain table, index 11",
"pa_gain": 3,
"mix_gain": 9,
"rf_power": 20,
"dig_gain": 3
"dig_gain": 0
},
"tx_lut_12": {
"desc": "TX gain table, index 12",
"pa_gain": 3,
"mix_gain": 10,
"rf_power": 23,
"dig_gain": 0
},
"tx_lut_13": {
"desc": "TX gain table, index 13",
"pa_gain": 3,
"mix_gain": 11,
"rf_power": 25,
"dig_gain": 0
},
"tx_lut_14": {
"desc": "TX gain table, index 14",
"pa_gain": 3,
"mix_gain": 12,
"rf_power": 26,
"dig_gain": 0
},
"tx_lut_15": {
"desc": "TX gain table, index 15",
"pa_gain": 3,
"mix_gain": 14,
"rf_power": 27,
"dig_gain": 0
}
},
"gateway_conf": {
"gateway_ID": "XXXXXXXXXXXXXXXX",
"server_address": "router.eu.thethings.network",
"serv_port_up": 1700,
"serv_port_down": 1700,
"keepalive_interval": 10,
"stat_interval": 30,
"push_timeout_ms": 100,
"forward_crc_valid": true,
"forward_crc_error": false,
"forward_crc_disabled": false
"servers": [ {
"server_address": "router.eu.thethings.network",
"serv_port_up": 1700,
"serv_port_down": 1700,
"serv_enabled": true
} ],
"gateway_ID": "XXXXXXXXXXXXXXXX",
"keepalive_interval": 10,
"stat_interval": 30,
"push_timeout_ms": 100,
"forward_crc_valid": true,
"forward_crc_error": false,
"forward_crc_disabled": false
}
}
```
> Note: You can add the GPS coordinates to your Pygate by including the following lines in the `'gateway_conf'` object of the config file.
>```
>"fake_gps": true,
>"ref_latitude": lat,
>"ref_longitude": lon,
>"ref_altitude": z
>```
## Pygate logs
Disambiguation of the Pygate logs:
1. By default the Pygate will print a status overview every 30 seconds (set by `stat_interval` in the config file). It will give an overview of what happened in the last 30 seconds. look sort of like this:
```python
[epoch time] lorapf: INFO_ [main] report
##### [Date] [Time] GMT #####
### [UPSTREAM] ###
RF packets received by concentrator: 4 # <-- Amount of LoRa packets received from nodes
CRC_OK: 75.00%, CRC_FAIL: 25.00%, NO_CRC: 0.00% # <-- Redundancy check
RF packets forwarded: 3 (69 bytes) # <-- Actual LoRa packets forwarded to TTN
PUSH_DATA datagrams sent: 4 (728 bytes) # <-- Packets forwarded to TTN (1 status update packet)
PUSH_DATA acknowledged: 100.00% # <-- Acknowledgments received from TTN
### [DOWNSTREAM] ###
PULL_DATA sent: 3 (100.00% acknowledged) # <-- Checked TTN for Downlink packets this amount
PULL_RESP(onse) datagrams received: 0 (0 bytes) # <-- Actual downlink packets available from TTN
RF packets sent to concentrator: 0 (0 bytes) # <-- LoRa downlink packets actually sent out
TX errors: 0 # <-- Amount of errors when sending LoRa packets to nodes, if there are any TX errors, they will be explained below
### [JIT] ### # <-- Just In Time TX scheduling
[jit] queue is empty
### [GPS] ### # <-- GPS sync
GPS sync is disabled
##### END #####
```
2. Now for the actual logs in between there are a number of variants and are structured like the first line:
```python
[epoch time] lorapf: LEVEL_ [method] arguments
[epoch time] lorapf: INFO_ [up ] received pkt from mote: {redacted}, RSSI -51.0 # <-- Properly received packet from node
[epoch time] lorapf: WARN_ [up ] PUSH_ACK recieve timeout 0 # <-- No acknowledgement received from TTN
[epoch time] lorapf: WARN_ [up ] PUSH_ACK recieve timeout 1 # <-- No acknowledgement received from TTN, second try
[epoch time] lorapf: WARN_ [up ] ignored out-of sync PUSH_ACK packet {redacted} # <-- out of sync acknowledgement from TTN
[epoch time] lorapf: INFO_ jitqueue: Current concentrator {redacted} # <-- sceduled a downlink packet
[epoch time] lorapf: WARN_ jitqueue: IGNORED: not REJECTED, already too late to send it {redacted} # <-- downlink LoRa packet received too late, but sent anyways
```
Print level can be set custom using `machine.pygate_debug_level(level)` and are set as following:
* `DEBUG`: 4
* `INFO`: 3
* `WARNING`: 2
* `ERROR`: 1

View File

@@ -5,9 +5,15 @@ aliases:
- tutorials/pysense.md
- chapter/tutorials/pysense
---
The Pysense board includes 4 additional sensors to be used with your pycom device! You can find an example on how to use the sensors below, but first we need to install the libraries. You can find more information about the Pysense and its sensors in the [datasheet section](/datasheets/expansionboards/pysense/)
## All sensors
>Note: You can find this example in the [GitHub repository](https://github.com/pycom/pycom-libraries/tree/master/pysense). Over there, you can also find the relevant libraries.
## Install libraries
To use the Pysense board, you will first need to add some libraries to your project:
1. Go the the [GitHub repository](https://github.com/pycom/pycom-libraries/) and download the archive.
2. Extract the archive and copy the files from the pysense folder into your project folder
3. Upload the project to your device. This will enable the functionality.
## Use sensors
```python
#!/usr/bin/env python
#
@@ -64,7 +70,7 @@ time.sleep(3)
py.setup_sleep(10)
py.go_to_sleep()
```
## Accelerometer
## Accelerometer example
This basic example shows how to read pitch and roll from the on-board accelerometer and output it in comma separated value (CSV) format over serial.

View File

@@ -7,7 +7,7 @@ aliases:
---
Both the Pysense and Pytrack use the same accelerometer. Please see the [Pysense Examples](../pysense) to see how to use the accelerometer.
>Note: You can find this example in the [GitHub repository](https://github.com/pycom/pycom-libraries/tree/master/pytrack). Over there, you can also find the relevant libraries.
>Note: You can find this example in the [GitHub repository](https://github.com/pycom/pycom-libraries/tree/master/pytrack). Over there, you can also find the relevant libraries.
## GPS Example
@@ -53,4 +53,3 @@ while (True):
* [micropyGPS](https://github.com/inmcm/micropyGPS)
* [Alternative L76GNSS module](https://github.com/andrethemac/L76GLNSV4/blob/master/L76GNSV4.py)

View File

@@ -48,4 +48,4 @@ acc.enable_activity_interrupt(2000, 200)
# go to sleep for 5 minutes maximum if no accelerometer interrupt happens
py.setup_sleep(300)
py.go_to_sleep()
```
```

View File

@@ -27,14 +27,14 @@ import socket
lte = LTE()
lte.init()
#some carriers have special requirements, check print(lte.send_at_cmd("AT+SQNCTM=?")) to see if your carrier is listed.
#when using verizon, use
#when using verizon, use
#lte.init(carrier=verizon)
#when usint AT&T use,
#when usint AT&T use,
#lte.init(carrier=at&t)
#some carriers do not require an APN
#also, check the band settings with your carrier
lte.attach(band=20, apn="your apn")
lte.attach(band=20, apn="your apn")
print("attaching..",end='')
while not lte.isattached():
time.sleep(0.25)
@@ -58,11 +58,12 @@ lte.deinit()
```
The last line of the script should return a tuple containing the IP address of the Pycom webserver.
>Note: the first time, it can take a long while to attach to the network.
>Note: the first time, it can take a long while to attach to the network.
## LTE Connectivity loss
> You need firmware 1.20.2.r2 or later for this functionality
It is possible that the LTE modem loses connectivity. It could be due to some radio interference, maybe the reception in the location of the module is not too good. Or if the module is being physically moved to another location with worse reception.
If the connectivity is lost this will in general not be reflected when you check `lte.isconnected()`. However, the lte modem sends a `UART break` signal. You can receive these events by using the `lte_callback` functionality. When connectivity is lost, the modem will try it's best to re-establish connectivity and this also works well in general. When connectivity is re-established, the modem will send another break signal, ie, the `lte_callback` will fire again.
@@ -151,7 +152,7 @@ Below, we review the responses from `print(lte.send_at_cmd('AT!="fsm"'))`. If yo
* Later, the `RRC TOP FSM` goes from `SCANNING` to `SYNCING`
* There are some states in between not discussed here.
* If it is stuck at `WAIT_RSSI`, check the antenna connection
* If the system returns multiple times from `SYNCING` to `CAMPED`, check the network availability, simcard placement and / or the firmware version.
* If the system returns multiple times from `SYNCING` to `CAMPED`, check the network availability, simcard placement and / or the firmware version.
```
@@ -238,8 +239,7 @@ Below, we review the responses from `print(lte.send_at_cmd('AT!="fsm"'))`. If yo
import sqnsupgrade
sqnsupgrade.info()
```
* Versions LR5.xx are for CAT-M1
* Versions LR6.xx are for NB-IoT
* Versions LR5.xx are for CAT-M1
* Versions LR6.xx are for NB-IoT
* Potential other errors:
* `OSError: [Errno 202] EAI_FAIL`: Check the data plan / SIM activation status on network
* `OSError: [Errno 202] EAI_FAIL`: Check the data plan / SIM activation status on network

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB