DigiKey-emag-Wireless Modules-Vol-8

Use a cellular and GPS SiP to implement asset tracking for agriculture and smart cities

extend this software package to implement their own asset tracking applications or use its code examples to implement their own application architecture.

static void work_init(void) { k_work_init(&sensors_start_work, sensors_start_ work_fn); k_work_init(&send_gps_data_work, send_gps_ data_work_fn); k_work_init(&send_button_data_work, send_ button_data_work_fn); k_work_init(&send_modem_at_cmd_work, send_ modem_at_cmd_work_fn); k_delayed_work_init(&send_agps_request_work, send_agps_request); k_delayed_work_init(&long_press_button_work, long_press_handler); k_delayed_work_init(&Cloud_reboot_work, Cloud_ reboot_handler); k_delayed_work_init(&cycle_Cloud_connection_ work, cycle_Cloud_connection); k_delayed_work_init(&device_config_work, device_ config_send); k_delayed_work_init(&Cloud_connect_work, Cloud_ connect_work_fn); k_work_init(&device_status_work, device_status_ send); k_work_init(&motion_data_send_work, motion_ data_send); k_work_init(&no_sim_go_offline_work, no_sim_go_ offline); #if CONFIG_MODEM_INFO k_delayed_work_init(&rsrp_work, modem_rsrp_ data_send); #endif /* CONFIG_MODEM_INFO */ } Listing 2: The Nordic asset tracker sample application demonstrates the basic design pattern for transmitting data including sensor data as shown in this code snippet. Code source: Nordic Semiconductor

Listing 1: The Nordic asset tracker sample application builds on Zephyr RTOS utilities for queue management to create a series of queues with associated callback routines for handling various tasks such as sensor data acquisition and transmission to the Cloud. Code source: Nordic Semiconductor if (env_sensors_get_humidity(&env_data) == 0) { if (cloud_is_send_allowed(CLOUD_CHANNEL_ HUMID, env_data.value) && cloud_encode_env_sensors_data(&env_data, &msg) == 0) { err = cloud_send(cloud_backend, &msg); cloud_release_data(&msg); if (err) { goto error; } } } [code deleted] static void env_data_send(void) { [code deleted] if (env_sensors_get_temperature(&env_data) == 0) { if (cloud_is_send_allowed(CLOUD_CHANNEL_ TEMP, env_data.value) && cloud_encode_env_sensors_data(&env_data, &msg) == 0) { err = cloud_send(cloud_backend, &msg); cloud_release_data(&msg); if (err) { goto error; } } }

Conclusion

Using conventional methods, the ability to track valuable packages or locate high value assets across agricultural

or smart city environments has been limited to wireless technologies such as RFID tags, Bluetooth, and Wi-Fi. Designers need greater range and more accurate location information over longer periods of time. Low-power LTE cellular standards like LTE-M or NB-IoT combined with GPS can meet these requirements, but implementation can be challenging due to the difficulty and nuances of RF design. As shown, a Nordic Semiconductor SiP provides a near drop-in solution for long-range, low power asset tracking. Using this pre-certified SiP and its development kits, developers can quickly evaluate cellular connectivity, prototype cellular-based GPS enabled asset tracking applications, and build custom asset tracking devices that take full advantage of the extended range and low power requirements of LTE-M and NB-IoT cellular connectivity.

Figure 8: The Nordic Semiconductor NRF9160-DK kit offers a comprehensive development platform for implementation of custom cellular-based applications for asset tracking and other IoT solutions. Image source: Nordic Semiconductor

one initialization routine configures the modem and establishes the LTE connection by sending a series of attention (AT) strings to define connection parameters and invoke the modem’s built-in functionality to connect to the carrier network. Another initialization routine, work_init, initializes a set of Zephyr RTOS work queues including those for sensor, GPS, and development board buttons (Listing 1). During this initialization phase, the functions associated with each work queue initialization invocation perform their own specific initialization tasks, including those required to perform any required updates. For example, the

sensors_start_work_fn function called by work_init sets up a polling mechanism that can periodically invoke a function, env_data_send, that sends sensor data to the Cloud (Listing 2). When running the asset tracker sample application on the Nordic Semiconductor NRF6943 THINGY:91 cellular IoT development kit, the application sends actual data from the THINGY:91’s onboard sensors. When running on the Nordic Semiconductor NRF9160- DK development kit, it sends simulated data using a sensor simulator routine included in the SDK. Developers can easily

we get technical

16

17

Powered by