AWS for Industries

The Cow Collar Wearable: How Halter benefits from FreeRTOS

Who is Halter, and what IoT product are they building?

Halter (https://halterhq.com), based in New Zealand, is an agri-tech original equipment manufacturer (OEM) that focuses on cattle herd management. Halter creates GPS enabled, solar powered smart collars for cows. The collar hardware allows farmers to interact with an easy-to-use app to remotely set geographic boundaries for cattle or virtual fences. Farmers use Halter’s system to avoid physically herding cows, maximizing farmer time and productivity.

Halter uses microcontrollers (MCU) in their cow collars to shift cows, collect and send data to AWS IoT, and upgrade firmware and features over-the air (OTA). The connectivity protocols used, LoRA and Wi-Fi, are well-thought out. LoRA provides low power, low data rate connectivity for small sensor data packets in rural areas with spotty cellular connectivity. On the other hand, Wi-Fi provides high bandwidth connectivity to quickly update device firmware.

What problem is Halter solving for farmers?

Halter allows farmers to remotely manage and monitor their herd, improving their work-life balance, providing tools to precisely manage farm operations and maximize milk production.  The IoT data acquired from the cows can be fed into machine learning models to enable cattle management in real time and in production optimization strategies such as calving likelihood predictions as well as geo-fencing capabilities and animal movement patterns that ensure animal health and dairy productivity safety via temperature monitoring. Halter is able to perform machine learning through its data ingestion and enrichment pipelines with continued innovation and areas of opportunity available to its Data Scientists through a data lake strategy.

What was Halter’s problem in building a solar powered cow collar?

    1. High development time and cost: Updating millions of IoT devices with security patches, bug fixes and new features using the traditional method of calling technicians is expensive and impractical. Halter chose a cloud based over-the-air (OTA) update approach, but soon found it challenging and time-consuming to design an end-to-end, secure, reliable, and trusted OTA solution for their microcontroller-based devices with limited compute power and memory. Halter wanted to send real time log shipping, diagnostic commands with a simple scripting interface. It is challenging to design a solution that stores device logs locally, only sending logs to the cloud when the device is turned on.
    2. High power consumption: The cow collars are solar powered 24/7, with a very tight power budget. It’s important to minimize power consumption in the microcontrollers and radios that constitute the cow collars.
      Machine learning: The acquisition of IoT data and machine learning enables cattle management in real time and in production optimization strategies such as calving likelihood predictions as well as geo-fencing capabilities and animal movement patterns that ensure animal health and dairy productivity safety via temperature monitoring. Halter is able to perform machine learning through its data ingestion and enrichment pipelines with continued innovation and areas of opportunity available to its Data Scientists through a data lake strategy.

What is FreeRTOS?

FreeRTOS is an open source, real-time operating system for microcontrollers that makes small, low-power edge devices easy to program, deploy, secure, connect, and manage. There is no charge for using the MIT-licensed FreeRTOS, but customers may incur charges with FreeRTOS if their applications utilize other AWS services or transfer data.

How did FreeRTOS solve the problem for Halter?

  1. Integrated over-the-air (OTA) update feature: Halter used the OTA feature in FreeRTOS to easily send OTA updates to cow collars to allow rapid prototyping of new features and simple release to customers. It saved months of development effort on both firmware and back-end allowing Halter to re-purpose their investments in features.
  2. MQTT library: The MQTT library in FreeRTOS made it easier for Halter to send device logs to AWS IoT in the form of MQTT packets. FreeRTOS uses the same communication channel for OTA and MQTT connection, which reduced Halter’s implementation effort for new back-end integrations from days to hours.
  3. FreeRTOS tickless idle mode: The FreeRTOS tickless idle mode stops the periodic tick interrupt during idle periods (periods when there are no application tasks that are able to execute), then makes a correcting adjustment to the RTOS tick count value when the tick interrupt is restarted. This helped Halter to use low power modes in the microcontrollers in the cow collars to optimize for power consumption.

How could customers in the agriculture industry benefit from FreeRTOS and other AWS services?

Agriculture customers have to consider the unique design patterns of rural and remote environments.  This includes considerations of latency, power supply and ruggedized hardware.  These considerations have helped to shape the AWS services that support the unique innovation in workloads like Halter.  Their unique and proprietary solution required solving challenges from topography to power.  Abstracted are points of consideration and services that create an edge to cloud solution and machine learning enablement.

Figure 1: Edge to Cloud Reference Architecture using IoT

Through integration with edge services and AWS Lambda, devices can operate without Internet connectivity, and when connections are possible, they can connect with over 130 AWS services, as well as third-party services. With AWS IoT, devices collect data at the edge leveraging either FreeRTOS or AWS IoT Greengrass on the device or gateway and a variety of design patterns depending on the type of device (sensor, camera, video) can be leveraged to move the data to the cloud for model re-training (LoRa, Cellular, WiFi, BLE, Satellite). With IoT Core, customers can filter, transform and act upon device data on the fly, based on business rules they define.  This can include multiple pathways based on consumption needs.  Integration with existing systems can be facilitated using a key value store database like Amazon DyanmoDB.  As the flow of IoT data increases as the number of devices scales, AWS IoT Events can notify users based on configured user/administrator defined states.  Coupled with Amazon Simple Notification Service users can receive alerts directly on their devices regardless of their location and proximity.  Additionally, customers have told us that the noisy and intermittent nature of IoT data required a purpose built analytics functionality IoT Analytics. With IoT Analytics, customers can collect, process, store, analyze and build reports on their device data. Sharing of insights and trends over time enables farm managers to focus on key operational success criteria, or drill into specific detail such as the health or breeding insights of a specific animal using Amazon QuickSight.

With AWS IoT design patterns unique to the Agricultural application IoT data is a rich dataset for Machine Learning. Using Amazon SageMaker, customers can innovate in building and re-training machine learning models. In disconnected or intermittent connectivity environments customers often choose to deploy the machine learning models back to devices via over the air updates (OTA) to optimize run machine learning inference via AWS IoT Greengrass ML Inference at the edge as shown in Figure 2.  Containerization strategies, can further reduce the power footprint depending on the latency requirements of the actions derived from the edge inference.

Figure 2: Edge Inference

Customers like Halter that build LoRaWAN devices can also benefit from using AWS IoT Core for LoRaWAN. With AWS IoT LoRaWAN, customers can set up a private LoRaWAN network by connecting their own LoRaWAN devices and gateways to the AWS Cloud – without having to develop or operate a LoRaWAN Network Server (LNS) by themselves. This allows customers to eliminate the undifferentiated work of managing an LNS, and enables them to easily and quickly connect and secure LoRaWAN device fleets at scale.

To learn more about FreeRTOS, download the source code and connect your IoT devices to AWS IoT, visit FreeRTOS.org. You can search for IoT reference integrations, download the source code, and Getting Started Guide when you click on the reference microcontroller board of your choice. To learn more about various AWS and IoT services, see aws.amazon.com and aws.amazon.com/iot.

Tanmoy Sen

Tanmoy Sen

Tanmoy Sen is a Senior Product Manager at Amazon Web Services where he focuses on helping customers and embedded developers connect microcontroller-based devices to the cloud.

Arun Viswanathan

Arun Viswanathan

Arun Viswanathan is a Senior IoT Specialist Solutions Architect at Amazon Web Services where he focuses on helping customers in Agriculture connect their IoT devices to the cloud.