Skip to content

Commit

Permalink
Changing shield examples (#396)
Browse files Browse the repository at this point in the history
* changed shield examples

* changed shield links

* added example text

* added getting-started

* added getting started

* upate shield getting started

* add new examples

* add sleep and scan examples

* update links

* changed links to release
  • Loading branch information
gijsio committed Apr 28, 2021
1 parent 4de8b43 commit 895d795
Show file tree
Hide file tree
Showing 14 changed files with 466 additions and 51 deletions.
40 changes: 14 additions & 26 deletions config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -427,46 +427,34 @@ theme = "doc-theme"
parent = "tutorials"
weight = 50
[[menu.main]]
name = "Pygate"
url = "/tutorials/expansionboards/pygate/"
identifier = "tutorials@expansionboards@pygate"
name = "Tracking"
url = "/tutorials/expansionboards/tracking/"
identifier = "tutorials@expansionboards@tracking"
parent = "tutorials@expansionboards"
weight = 10
[[menu.main]]
name = "pysense"
url = "/tutorials/expansionboards/pysense/"
identifier = "tutorials@expansionboards@pysense"
name = "Sensing"
url = "/tutorials/expansionboards/sensing/"
identifier = "tutorials@expansionboards@sensing"
parent = "tutorials@expansionboards"
weight = 20
[[menu.main]]
name = "pysense 2.0 X"
url = "/tutorials/expansionboards/pysense2/"
identifier = "tutorials@expansionboards@pysense2"
name = "Scanning"
url = "/tutorials/expansionboards/scanning/"
identifier = "tutorials@expansionboards@scanning"
parent = "tutorials@expansionboards"
weight = 30
[[menu.main]]
name = "pytrack"
url = "/tutorials/expansionboards/pytrack/"
identifier = "tutorials@expansionboards@pytrack"
name = "Pysleep"
url = "/tutorials/expansionboards/sleep/"
identifier = "tutorials@expansionboards@sleep"
parent = "tutorials@expansionboards"
weight = 40
[[menu.main]]
name = "pytrack 2.0 X"
url = "/tutorials/expansionboards/pytrack2/"
identifier = "tutorials@expansionboards@pytrack2"
parent = "tutorials@expansionboards"
weight = 50
[[menu.main]]
name = "pyscan"
url = "/tutorials/expansionboards/pyscan/"
identifier = "tutorials@expansionboards@pyscan"
parent = "tutorials@expansionboards"
weight = 60
[[menu.main]]
name = "Sleep"
url = "/tutorials/expansionboards/sleep/"
identifier = "tutorials@expansionboards@sleep"
parent = "tutorials@basic"
parent = "tutorials@expansionboards"
weight = 20
[[menu.main]]
name = "Advanced"
Expand Down Expand Up @@ -1068,7 +1056,7 @@ theme = "doc-theme"
weight = 60

[[menu.main]]
name = "Expansion Boards and Shields"
name = "Shields"
url = "/datasheets/expansionboards/"
identifier = "datasheets@boards"
parent = "datasheets"
Expand Down
10 changes: 9 additions & 1 deletion content/datasheets/expansionboards/pygate.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,15 @@ aliases:
---
**Store**: [Buy Here](https://pycom.io/product/pygate/)

## ![](/gitbook/assets/pygate.png)
The Pygate is an 8-channel LoRa Gateway

## Getting started
1. Upload the latest stable `pygate` firmware release using the [firmware updater](/updatefirmware/device/).
1. Follow the [tutorial](/tutorials/expansionboards/pygate/) to get your Pygate up and connected to The Things Network.

## Features

![](/gitbook/assets/pygate.png)

## Datasheet

Expand Down
19 changes: 16 additions & 3 deletions content/datasheets/expansionboards/pyscan.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,21 @@ aliases:
---
**Store**: [Buy Here](https://pycom.io/product/pyscan/)

![](/gitbook/assets/pyscan-new.png)
The Pyscan shield allows you to scan RFID and NFC tags and includes an accelerometer and light sensor.

## Getting started
1. Find the libraries for the Pyscan in the [Pycom libraries](https://github.com/pycom/pycom-libraries/releases/) repository on Github.
1. Download the files and extract them into the project folder in Pymakr
1. Click the `upload project to device` button. This will store all necessary files on the device and allow you to import them in the example `main.py`.
1. Check the REPL. If you have Pybytes activated, the example will send the sensor data to Pybytes automatically. Note that the Pyscan will return command to the REPL while it scans for NFC cards in the background. Note that the example also allows the decoding of cards by changing the variable `DECODE_CARD = True`

### Examples
The Pyscan has several examples:
* [Scanning](/tutorials/expansionboards/scanning/)

## Features

![](/gitbook/assets/pyscan-pinout-1.png)
## Datasheet & Pinout

The pinout and datasheet of the Pyscan is available as a [PDF File](/gitbook/assets/pyscan-pinout.pdf)
Expand All @@ -18,7 +31,7 @@ The pinout and datasheet of the Pyscan is available as a [PDF File](/gitbook/ass
The Pyscan is certified for:
* [ROHS certification](/gitbook/assets/RoHs_declarations/RoHS-for-Pyscan(8286-00031P)-20190523.pdf)

![](/gitbook/assets/pyscan-pinout-1.png)


## Pyscan Libraries

Expand Down Expand Up @@ -50,4 +63,4 @@ The board features a single cell Li-Ion/Li-Po charger with a JST PHR‑2 connect

## 3D model for case design

* Please see the [3D model] (/gitbook/assets/PyScan_v0.7.step) (step format)
* Please see the [3D model](/gitbook/assets/PyScan_v0.7.step) (step format)
22 changes: 20 additions & 2 deletions content/datasheets/expansionboards/pysense.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,26 @@ aliases:
---
**Store**: [Buy Here](https://pycom.io/product/pysense/)

The Pysense shield allows you to sense the environment using 5 different sensors:
* Accelerometer (LIS2HH12)
* Light Sensor (LTR329ALS01)
* Pressure Sensor (MPL3115A2)
* Temperature / Humidity Sensor (SI7006A20)

![](/gitbook/assets/pysense.png)
## Getting started
1. Find the libraries for the Pysense in the [Pycom libraries](https://github.com/pycom/pycom-libraries/releases/) repository on Github.
1. Download the files and extract them into the project folder in Pymakr
1. Click the `upload project to device` button. This will store all necessary files on the device and allow you to import them in the example `main.py`.
1. Check the REPL. If you have Pybytes activated, the example will send the sensor data to Pybytes automatically.


### Examples
The Pysense has several examples:
* [Sensing](/tutorials/expansionboards/sensing/)

## Features

![](/gitbook/assets/pysense-pinout-1.png)

## Datasheet

Expand All @@ -24,7 +42,7 @@ The Pysense is certified for:
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
Expand Down
19 changes: 19 additions & 0 deletions content/datasheets/expansionboards/pysense2.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,25 @@ aliases:
- chapter/datasheets/boards/pysense2
---

The Pysense 2.0 X shield allows you to sense the environment using 5 different sensors:
* Accelerometer (LIS2HH12)
* Light Sensor (LTR329ALS01)
* Pressure Sensor (MPL3115A2)
* Temperature / Humidity Sensor (SI7006A20)

## Getting started
1. Find the libraries for the Pysense 2.0 X in the [Pycom libraries](https://github.com/pycom/pycom-libraries/releases/) repository on Github.
1. Download the files and extract them into the project folder in Pymakr
1. Click the `upload project to device` button. This will store all necessary files on the device and allow you to import them in the example `main.py`.
1. Check the REPL. If you have Pybytes activated, the example will send the sensor data to Pybytes automatically.


### Examples
The Pysense has several examples:
* [Sensing](/tutorials/expansionboards/sensing/)

## Features

![](/gitbook/assets/pysense2_desc.png)

## Datasheet
Expand Down
15 changes: 15 additions & 0 deletions content/datasheets/expansionboards/pytrack.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,21 @@ aliases:
---
**Store**: [Buy Here](https://pycom.io/product/pytrack/)

The Pytrack shield allows you track your location using the onboard GPS and accelerometer.

## Getting started
1. Find the libraries for the Pytrack in the [Pycom libraries](https://github.com/pycom/pycom-libraries/releases/) repository on Github.
1. Download the files and extract them into the project folder in Pymakr
1. Click the `upload project to device` button. This will store all necessary files on the device and allow you to import them in the example `main.py`.
1. Check the REPL. If you have Pybytes activated, the example will send the location data to Pybytes automatically.


### Examples
The Pytrack has several examples:
* [Tracking](/tutorials/expansionboards/tracking/)

## Features

![](/gitbook/assets/pytrack.png)


Expand Down
15 changes: 15 additions & 0 deletions content/datasheets/expansionboards/pytrack2.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,21 @@ aliases:
- chapter/datasheets/boards/pytrack2
---

The Pytrack 2.0 X shield allows you track your location using the onboard GPS and accelerometer.

## Getting started
1. Find the libraries for the Pytrack 2.0 X in the [Pycom libraries](https://github.com/pycom/pycom-libraries/releases/) repository on Github.
1. Download the files and extract them into the project folder in Pymakr
1. Click the `upload project to device` button. This will store all necessary files on the device and allow you to import them in the example `main.py`.
1. Check the REPL. If you have Pybytes activated, the example will send the location data to Pybytes automatically.


### Examples
The Pytrack has several examples:
* [Tracking](/tutorials/expansionboards/tracking/)

## Features

![](/gitbook/assets/pytrack2_decs.png)

## Datasheet
Expand Down
2 changes: 1 addition & 1 deletion content/firmwareapi/pycom/expansionboards/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Note that this functionality is not built into the firmware, and you will need t
The API pages are separated per sensor:
* [Accelerometer](lis2hh12/) (LIS2HH12)
* [Light Sensor](ltr329als01/) (LTR329ALS01)
* [Temperature Sensor](si7006a20/) (SI7006A20)
* [Temperature / Humidity Sensor](si7006a20/) (SI7006A20)
* [Pressure Sensor](mpl3115a2/) (MPL3115A2)
* [RFID / NFC](mfrc630/) (MFRC630)
* [GPS](l76gnss/) (L76GNSS)
Expand Down
4 changes: 2 additions & 2 deletions content/gettingstarted/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ In the previous section we got code running on on your Pycom module using the `r
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/)|
|[ Pygate](/datasheets/expansionboards/pygate/)| [Pysense](/datasheets/expansionboards/pysense/) | [Pysense 2.0 X](/datasheets/expansionboards/pysense2/)| [Pytrack](/datasheets/expansionboards/pytrack/)| [Pytrack 2.0 X](/datasheets/expansionboards/pytrack2/)| [PyScan ](/datasheets/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/) |
| [![](/gitbook/assets/expansionboards/pygate.png)](/datasheets/expansionboards/pygate/)|[![](/gitbook/assets/expansionboards/pysense1.png)](/datasheets/expansionboards/pysense/) | [![](/gitbook/assets/expansionboards/pysense2.png)](/datasheets/expansionboards/pysense2/)| [![](/gitbook/assets/expansionboards/pytrack1.png)](/datasheets/expansionboards/pytrack/)| [![](/gitbook/assets/expansionboards/pytrack2.png)](/datasheets/expansionboards/pytrack2/)| [![](/gitbook/assets/expansionboards/pyscan.png)](/datasheets/expansionboards/pyscan/) |

## Step 5: Connecting to a network

Expand Down
14 changes: 7 additions & 7 deletions content/tutorials/expansionboards/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ 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/)
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](sleep/)

* [Asset tracking](tracking/)
* [Environment sensing](sensing/)
* [Scanning RFID / NFC Tags](scanning/)
* [Pysleep](sleep/)
* [Movement detection](/accelerometer/)


* [Pygate](../expansionboards/pygate/)
* [Pysense](../expansionboards/pysense/)
* [Pysense 2.0 X](../expansionboards/pysense2/)
* [Pytrack](../expansionboards/pytrack/)
* [Pytrack 2.0 X](../expansionboards/pytrack2/)
* [Pyscan](../expansionboards/pyscan/)


>Note: Make sure to click `upload to device` to be able to `import` the appropriate libraries in your code!
58 changes: 58 additions & 0 deletions content/tutorials/expansionboards/scanning.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
Title: "Scanning"
---

>This example can be used on the **Pyscan**
You can use the example below to scan RFID / NFC cards presented to the scanner:
```python
from pyscan import Pyscan
from MFRC630 import MFRC630
import time
import pycom
import _thread

VALID_CARDS = [[0x43, 0x95, 0xDD, 0xF8],
[0x43, 0x95, 0xDD, 0xF9]]

py = Pyscan()
nfc = MFRC630(py)

RGB_BRIGHTNESS = 0x8

RGB_RED = (RGB_BRIGHTNESS << 16)
RGB_GREEN = (RGB_BRIGHTNESS << 8)
RGB_BLUE = (RGB_BRIGHTNESS)

# Make sure heartbeat is disabled before setting RGB LED
pycom.heartbeat(False)

# Initialise the MFRC630 with some settings
nfc.mfrc630_cmd_init()

def check_uid(uid, len):
return VALID_CARDS.count(uid[:len])

def discovery_loop(nfc, id):
while True:
# Send REQA for ISO14443A card type
atqa = nfc.mfrc630_iso14443a_WUPA_REQA(nfc.MFRC630_ISO14443_CMD_REQA)
if (atqa != 0):
# A card has been detected, read UID
uid = bytearray(10)
uid_len = nfc.mfrc630_iso14443a_select(uid)
if (uid_len > 0):
if (check_uid(list(uid), uid_len)) > 0:
pycom.rgbled(RGB_GREEN)
else:
pycom.rgbled(RGB_RED)
else:
# No card detected
pycom.rgbled(RGB_BLUE)
nfc.mfrc630_cmd_reset()
time.sleep(.5)
nfc.mfrc630_cmd_init()

# This is the start of our main execution... start the thread
_thread.start_new_thread(discovery_loop, (nfc, 0))
```

0 comments on commit 895d795

Please sign in to comment.