“Learn how to send messages to The Things Network with MicroPython. You will need a The Things Network Gateway near you.
First, make sure that there is a The Things Network gateway near you. You can find out with the world map on https://www.thethingsnetwork.org. If there is no gateway near, you can setup your own. Instructions for adding gateways can be found here https://www.thethingsindustries.com/docs/gateways/adding-gateways.
Due to regulatory differences, The Things Network uses different frequency plans in different regions of the world. Please make sure that you have the correct version of LoRaWAN Unit: 868 is the right one for Europe, Russia, the Middle East and Africa and 915 is the one for Australia and the Americas. Detailed and authoritative information on frequency plans can be found here https://www.thethingsnetwork.org/docs/lorawan/frequencies-by-country.
Registering at The Things Network
If you do not have an account at The Things Network please sign up at https://www.thethingsnetwork.org.
After that, you can login to the console at https://console.cloud.thethings.network. I am located in Europe that is why I am using “Europe 1” in the cluster picker. If you were residing in other parts of the world, you would choose maybe “North America 1” or “Australia 1”.
Click on “Go to applications” and then on “Add application”, fill out the form and submit it. You now see the detail page of your application. The application will collect the data from all your devices. So let’s create a first device.
Click on “Add end device” and switch to the tab “Manually”. Choose “Over the air activation (OTAA)” and “LoRaWAN Version MAC V1.0.2”. Click “Start”.
Enter an id for your device in “End device ID” and a name in “End device name”; fill “AppEUI” with “0000000000000000” and “DevEUI” with 16 random hex digits. Click “Network layer settings”.
Choose the correct “Frequency plan” and “Regional parameters version” for your country and device. For me, that is “Europe 863-870 MHz (SF9 for RX2 - recommended)” and “PHY V1.0.2 REV B”. Choose “Supports class C” and click “Join settings”.
Generate a random AppKey with the button right to the input field. Click “Add end device”. You now see the detail page of your device.”