Access the TTN website and create/log into a personal account
, and select a cluster in the Console
to start adding node devices and gateways.
Go to applications
-> Add application
-> Fill in the Application ID
and application name as desired, then click Create application
to finish creating.
Enter the created application page and click Add end device
to start adding a node device. Choose Manually
to custom create.
Select the frequency band to be used according to the region where you are located and the device, and ensure that the frequency band used by the device you are using matches the sub-frequency band option used by the gateway. The LoRaWAN version and regional parameters need to be selected according to the protocol version supported by the actual hardware (for details, please refer to the corresponding product document page).
In the device creation stage, the connection method OTAA/ABP that the device will adopt can be configured:
Under the ABP mode, the device communicates using the pre-configured fixed key, and there is no need to execute the network access process, so it can directly start data interaction.
In the OTAA mode, the device will dynamically obtain the communication key each time it accesses the network, which has higher security. However, due to the existence of the JoinAccept (join acceptance) process during network access, the device needs to perform a series of interaction and verification operations with the server to obtain the key and complete the network access. Therefore, the network access connection speed is relatively slower than that in the ABP mode.
For OTAA (Over-The-Air-Activation) connection mode
, save the Device EUI
, APP EUI
, APP KEY
parameters for later use in device connection. You can enter preset configurations or click Generate
to automatically generate new keys. Click Register end device
to complete creation.
For ABP (Activation By Personalization) connection mode
, save the Device address
, AppSKey
, NwkSKey
parameters for later use in device connection. You can enter preset configurations or click Generate
to automatically generate new keys. Click Register end device
to complete creation.
In the previous steps, we successfully created a device in TTN. Next, we need to program the device to connect it to the gateway. Please enter the connection parameters obtained in the previous step in the example programs below for different platforms, depending on the connection method.
Device EUI
, APP EUI
, APP KEY
.Device address
, AppSKey
, NwkSKey
.Below is an example using the UNIT LoRaWAN, fill in the connection parameters obtained in the previous steps into the configuration program, and ensure the frequency band
, Class Mode
, Rx2 frequency window
, etc., match your actual settings. Then, run the program for testing.
Click the links below to obtain the example programs and driver libraries for the corresponding devices. Refer to the configuration functions below to modify the program's contents, entering the connection parameters obtained in the previous step.
LoRaWAN.configOTTA(
"70B3D57ED004E460", // Device EUI
"0000000000000000", // APP EUI
"6BEBAED3A9FA853ED6885D6E50497736", // APP KEY
"2" // Upload Download Mode
);
LoRaWAN.configABP(
"260B6E5C",//Device ADDR
"63F68EE76CC3034D142B6F1695B70D43",//APP SKEY
"3CB3FA729FD7191061F963F5E8167837",//Nwk SKEY
"2"//Upload Download Mode
);
After completing the program editing/running operation, if the device is successfully connected to the gateway, we can see the device's connection logs and the uplink data information in the TTN management page.
Clicking Messaging
allows manual data transmission to the device. Note: The latest data from the gateway is obtained only when the device uploads data
.
Obtain TTN server data through the MQTT Client for data retrieval/transmission. The MQTT SERVER URL, port, and login user information can be obtained on the TTN page.
v3/{application id}@{tenant id}/devices/{device id}/up
v3/{application id}@{tenant id}/devices/{device id}/down/push
base64
encoding format.For more detailed tutorials on TTN integration interfaces (MQTT, Webhooks, Storage Integration, AWS IoT, Azure IoT Hub, LoRa Cloud), please refer to TTN Integration Development Documentation .