/zephyr-coaps-client

CoAP / DTLS 1.2 CID client for Zephyr - Reliable - Efficient - Encrypted

Primary LanguageCEclipse Public License 2.0EPL-2.0

Zephyr logo

Zephyr - Coaps Demo Client with Eclipse/TinyDtls

Reliable - Efficient - Encrypted

Version 0.10.0 - August 2024

This zephyr client demonstrates to use coaps (CoAP over DTLS 1.2) with the Eclipse/TinyDtls Library. In combination with Eclipse/Californium as Cloud-Server, it enables a device to use DTLS 1.2 Connection ID, which obsolete the commonly used frequently DTLS handshakes and eliminates that expensive overhead. Reducing the messages exchange mostly down to two ip-messages (one request, one response), it enables your device for

  • reliable,
  • efficient, and
  • end-to-end encrypted

communication for messages up to a few hundred bytes. In combination with cellular LTE-M/NB-IoT technolopy, CoAP / DTLS 1.2 CID enables to build mobile applications with

  • zero-install and
  • high cost-efficiency.

The demo client itself is in development stage. In "good and normal weather", the Thingy:91 runs from battery for 7-15 months, exchanging every hour a message. In "storm" it may require to be switched off and on again in very rare exceptions.

Thingy:91 Chart

179-22:26:04 [d-hh:mm:ss], Thingy:91 v0.9.0+0, 0*4499, 1*48, 2*0, 3*0, failures 4
!3873 mV 63% (358 days left) battery
!CE: down: 8, up: 1, RSRP: -95 dBm, CINR: 12 dB, SNR: 13 dB
  • 180 days, about 4500 messages, some retransmissions, 1%% failures.
  • 63% battery left
  • quite good signal conditions.

The demo client is intended as groundwork for your own ideas. "Out-of-the-box" this application is useful to easily check, if cellular IoT works at the locations and environment you want to use it. The demo reports also some details about the cellular network functions. To build products and applications on this protocol stack requires to implement a production client and to adapt the coap-server for your function. The demo targets therefore people, which are already common with zephyr, or, even better, common with the development for the Thingy:91 itself. Without that knowledge it will be time consuming to make benefit out of this demo.

Note: The demo client is considered to use CoAP/DTLS 1.2 CID. Without server-side support for DTLS 1.2 CID, it will not work proper. Please ensure, that your server supports that.

Supported Devices

For now, only nRF9160 based devices are supported.

Device
Nordic Semiconductor, Thingy:91
Works "out-of-the-box" in the "wild".
Not easy to extend with custom sensors.
Circuit Dojo, nRF9160 feather v5
Requires additional batteries, antennas, and closures to
work in the "wild". The design of the feather allows to
easily add custom sensors.
Nordic Semiconductor, nRF9160 DK
Works "out-of-the-box" on the desk.
The design allows to easily add custom sensors.

The demo works with ncs-2.6.1.

To benefit from the newer modem features, please consider to use the modem firmware 1.3.6. See "Getting started with Thingy:91" below how to apply it.

In the meantime it also supports the nRF9161-DK and the mfw 2.0.0 for that.

Experimentally Supported Devices

The demo supports experimentally two new upcoming devices based on the nRF9161.

Device
Circuit Dojo, nRF9161 feather
With 2-channel USB and onboard OCD.
Conexio Stratus Pro
With built-in solar energy harvesting.
Includes a SIM card with 500MB in 10 years.

Note: for both experimentally supported boards you need to copy the board definitions in folder extra into the destination folders.

See extras/README for more information.

More Devices

Maybe other modems and devices gets supported over the time as well. For some of the nRF9160 based devices porting should not be too hard.

nRF9160 based candidates
Sparkfun Thing Plus nRF9160
Qwiic and 2x5 plug for JTAG.
Icarus IoT Board v2
Includes a eSIM.
Conexio Stratus
With built-in solar energy harvesting.
Includes a SIM card with 500MB in 10 years.
Fanstel LN60E
Reduced to the minimum. Unfortunately
the current version uses a LDO with 50µA
quiescent current.
MIKROE LTE IoT 4 Click
Even less, but with power LED.
If you want to use it, remove the LED or cut the
connects to the ground-plane next the LED.

Required HW-Tools for Thingy:91

In order to use this demo with a Thingy:91, you need:

  • a Thingy:91 (maybe better two ;-)).
  • the Thingy:91 is usually shipped with a SIM card. Check, if that covers your area/country. If not, you need a SIM card for your area/country. (Sometimes the Thingy:91 is shipped with an expired SIM card. Then you will need also an other one.)
  • a debug probe to flash the device.

Note: the Thingy:91 uses 1.8V VDD and requires the Jlink to support 1.8V as well. Not all Jlinks supporting that, ensure you get a right one! If the nRF9160-DK is used, ensure you select 1.8V for VDD-IO (SW9 on the DK).

Required HW-Tools for nRF9160 feather v5

In order to use this demo with a nRF9160 feather v5, you need:

  • a nRF9160 feather v5 (maybe better two ;-)).
  • the nRF9160 feather v5 is shipped with a SIM card. Check, if that covers your area/country. If not, you need a SIM card for your area/country.
  • a debug probe to flash the device.

Note: the nRF9160 feather v5 uses 3.3V VDD and requires the Jlink to support 3.3V as well. Therefore a nRF5340-DK can be used. If the nRF9160-DK is used, ensure you select 3.0V for VDD-IO (SW9 on the DK).

Required HW-Tools for nRF9160-DK

In order to use this demo with a nRF9160-DK, you need:

  • a nRF9160-DK (maybe better two ;-)).
  • the nRF9160-DK is usually shipped with a SIM card. Check, if that covers your area/country. If not, you need a SIM card for your area/country. (Sometimes the nRF9160-DK is shipped with an expired SIM card. Then you will need also an other one.)
  • the nRF9160-DK comes with a internal debug probe to flash the device. No additional equipment is required.

Note: the nRF9160-DK is a great tool to develop apps for the nRF9160 on your desk. For the "wild", a Thingy:91 or nRF9160 feather v5 does a better job.

Required HW-Tools for nRF9161-DK

In order to use this demo with a nRF9161-DK, you need:

  • a nRF9161-DK (maybe better two ;-)).
  • the nRF9161-DK is usually shipped with a Onomondo SIM card and provides a 30 days test free of charge. Check, if that covers your area/country. If not, or you need connectivity for longer, you need a SIM card for your area/country or a subscription from Onomondo.
  • the nRF9161-DK comes with a internal debug probe to flash the device. No additional equipment is required.

Note: the nRF9161-DK is a great tool to develop apps for the nRF9161 on your desk. For the "wild", a Thingy:91 or nRF9160 feather v5 does a better job.

Run It - Fast Track

If you only want to use for testing cellular coverage, you may start with using a pre-build firmware binary. Usually that will take about 1h to send a first message with your Thingy:91.

Fast Track

Build It - Build Track

In order to be able to build the demo-client, you need to install the development environment. That will take up to an afternoon to send your a message with your Thingy:91.

Build Track

Next Steps

As mentioned at the introduction, the demo is intended as groundwork for your own ideas.

Next Steps

See also Roadmap for the plan of the next months.

If you want to consider the power consumption in your idea, please see Power Consumption and if you want to make own measurements may be helpful.

Sometimes it is interesting, which mobile networks are available at some locations. Thingy:91 - Cellular Explorer helps here. It comes also with support for a firmware update using XMODEM and some additional function in order to test the features of the mobile network.

The demo comes also with some functions for Remote Control to configure the device remote from the server.

For a more elaborated example see mobile-beehive-scale.

Licenses

This demo itself is licensed under EPL-2.0.

Some files are used especially for the Thingy:91 and are licensed under Nordic-5. This files are only licensed to be used with Nordic Semiconductor devices. See boards and child_image.

The demo uses several third-party content, please refer to NOTICE for details.