Pycom Pygate setup
Overview
The aim of this lesson is to learn is to learn how to setup a Pycom Pygate LoRa WAN Gateway. This gateway is useful for testing LoRa sensors to ensure that they are working correctly and sending data to The Things Network. Even though LoRa WAN Gateways are installed in several local government areas (and also be hobbyists) it is more reliable to have a LoRa WAN Gateway within close range and/or a gateway where the traffic can be monitored using a computer.
In this application, we are using the Pycom Pygate expansion board and a Pycom WiPy microcontroller. The LoRa antenna is connected to the Pygate expansion board. The WiPy 3.0 connects to a home or school WiFi router so that LoRa data can be sent to The Things Network.
In addition to the instructions in this lesson you can visit the following URL https://docs.pycom.io/tutorials/expansionboards/pygate/
Learning Objectives
- Learn how to update the firmware on the Pycom Pygate and WiPy units.
- Learn how to register a LoRa Gateway on The Things Network.
- Learn how to configure and upload micropython software for the Pygate gateway.
Pycom Pygate Setup
Update the firmware on the Pycome Pygate and WiPy combination
- It is very important to always keep the firmware on a microcontroller updated to the most current stable version. * Firmware is software that is installed on hardware that is similar to a small operating system.
- It should be updated monthly to help ensure that latest updates and security patches are installed.
- Ensure that the Pycom WiPy microcontroller is plugged into the Pycom Pygate board.
- You will need a USB type-C plug for the Pygate expansion board and a USB 2.0 type-A plug for your computer.
- Connect the Pygate assembly to your computer.
- Download and install the Pycom Firmware Updater tool and start the software.
- The Welcome page should appear. Click Continue.
- At the Setup Instructions page click Continue.
- At the Communication page select Type: pygate.
- Click Continue.
- At Pybytes registration click Skip.
- Under Advanced Settings ensure that the settings are the same. Click Continue.
- The Pycom Firmware updater will now update the firmware.
- A notification will appear when the upgrade is complete.
Register the gateway with The Things Network (TTN)
- Login to The Things Stack (The Things Network – TTN)
- Click on Go to gateways.
- Click on the button + Add gateway.
- Enter Gateway ID. This is a name for our new gateway it is quokka-1
- We will need to generate a random Gateway EUI
- The Gateway EUI is a 64 bit extended unique identifier. Each 4 bits will be represented by one hexadecimal number (0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f) – so we will need 16 hexadecimal numbers in total.
- Open the Terminal on your computer.
- Enter the command python3 to start python
- Load the secrets library with the command import secrets
- To generate 16 hexadecimal numbers we only need to generate the equivalent of 8 characters.
- So the python command is secrets.token_hex(8)
- Copy the 16 hexadecimal numbers.
- Back in The Things Network gateway setup, enter the Gateway EUI and the Gateway name
- Check the Gateway Server address is au1.cloud.thethings.network
- Make the Gateway status public
- Uncheck the Gateway location.
- Under LoRaWAN options select the frequency plan for Australia TTN.
- Keep other settings as the default or as shown below.
- Click on Create gateway to complete the setup of the gateway on the Things Network.
- The quokka-1 LoRa Gateway page will appear as shown.
- Note that the gateway has not connected to The Things Network.
- Click on Global configuration button which shows – Download global_conf.json located at the bottom left of the page.
Using Atom to install the Pygate software on the Pycom WiFi microcontroller
- Go to the following URL https://docs.pycom.io/tutorials/expansionboards/pygate/
- Copy the python code. Note that only a representative sample is shown here. The actual code is 54 lines long.

















