Thingy:91#
Integrate your Nordic Thingy:91 board with Coiote IoT DM using the Anjay LwM2M client.
Prerequisites#
- The Thingy:91 board with a USB cable and SIM card.
- Installed minicom or RealTerm (for Linux or Mac) or PuTTy (for Windows) or other serial communication program.
- A user with access to the Coiote IoT Device Management platform.
Prepare binaries#
Use an already built binary#
To get the latest binary file and flash the board:
- Go to Anjay-zephyr-client.
- Download the
demo_thingy91_app_signed.hex
file. - Jump to the flashing part of the tutorial.
Start development using samples#
Note
If you've gone through the Use an already built binary step, you can jump to Connect to the LwM2M Server.
Part 1: Get Zephyr and Python dependencies#
To get the Zephyr SDK and dependencies follow the first 4 steps of the instruction provided by the Zephyr Project.
- Select and Update OS
- Install dependencies
- Get Zephyr and install Python dependencies
- Install Zephyr SDK
Part 2: Clone the Anjay Zephyr repository#
Open the command line interface on your machine, then paste and run the following command:
git clone https://github.com/AVSystem/Anjay-zephyr-client
Part 3: Compile the demo project#
- Connect the Thingy:91 board to a USB port of your machine.
-
Set West manifest path to
Anjay-zephyr-client/demo
, manifest file towest-nrf.yml
, and runwest update
:west config manifest.path Anjay-zephyr-client/demo west config manifest.file west-nrf.yml west update
-
Go to the directory
Anjay-zephyr-client/demo
. -
Compile the project for Thingy:91 using the command:
west build -b thingy91_nrf9160ns
Note
[Optional] Configuration of the Anjay client can be done using menuconfig. This allows you, among others, to enable the GPS and cell-based location services. To open the configuration menu, run the command:
west build -b thingy91_nrf9160ns -p -t menuconfig
A config screen will open:
After making the configuration changes, close the config menu by pressing
Q
and save it by pressing the keyY
.To build the project using the new configuration, run:
west build
-
Find the
app_signed.hex
file under thebuild/zephyr
directory in the project folder.
Flash the binaries#
To program the board, go through the process of flashing Thingy:91. Use the nRF Connect Programmer with the downloaded .hex
file and follow the program the nRF9160 SiP application section.
After successful flashing, reboot the board and go to the next step.
Connect to the LwM2M Server#
To connect to Coiote IoT Device Management platform, please register at https://eu.iot.avsystem.cloud.
To connect the board:
- Log in to Coiote IoT DM and from the left side menu, select Device Inventory.
- In Device Inventory, click Add device.
- Select the Connect your LwM2M device directly via the Management server tile.
-
In the Device credentials step:
- In the Endpoint name field, enter your board endpoint name e.g.
test_device
(remember to set the same name in the next section). - In the Security mode section, select the Pre-Shared Key mode:
- In the Key identity field, type the same name as in the
Endpoint name
field. -
In the Key field, type a shared secret used for the device-server authentication.
Note
This is your password which you create yourself, you will need it in the next steps.
- In the Key identity field, type the same name as in the
- In the Endpoint name field, enter your board endpoint name e.g.
-
Click the Add device button and Confirm in the confirmation pop-up.
- While in the Connect your device step, follow the next section to run the client and connect it to the server.
Configure the Client#
-
With the board still connected to a serial port interface, open a serial communication program.
-
Use the
anjay
command to list possible options:Tip
To show available subcommands, use the Tab key.
-
Check your default credentials by following the instructions in the program:
anjay config show
-
Update your device credentials:
-
To make any changes to the configuration, stop the client:
anjay stop
-
To update the endpoint name run the command:
anjay config set endpoint <endpoint name>
-
To update the Pre-Shared Key, run the command
anjay config set psk <key>
-
-
Start the client using the new configurations:
anjay start
-
Go to the Coiote IoT DM to check if your device is connected.
Note
When Anjay has no connection with the server or network for a long time, warning
at_monitor: No heap space for incoming notification: <notification>
may appear.
It does not affect the operation of the application and will no longer appear after reconnection.
Next Steps#
After configuring the Anjay Client, you can use the nRF Cloud Location Service to enable cell-based location services, or assisted GPS. Learn how to do it here.
Note
Thingy:91 uses the same radio for GPS and LTE connectivity. GPS signal is
caught between LTE transmissions and in case GPS "cold" fix acquisition takes
too much time, Anjay turns off LTE transmissions for the time of fix acquisition.
It can be seen by the following warning: gps_nrf: GPS was interrupted multiple
times by the LTE modem when producing a fix
. Anjay is notified by it, enters
offline mode and reconnects when the first fix is acquired and LTE is enabled back.