{"id":848,"date":"2023-06-25T01:11:55","date_gmt":"2023-06-25T01:11:55","guid":{"rendered":"https:\/\/zli.one\/?p=848"},"modified":"2023-07-02T03:51:43","modified_gmt":"2023-07-02T03:51:43","slug":"848","status":"publish","type":"post","link":"https:\/\/zli.one\/?p=848","title":{"rendered":"LoRa IoT Device Firmware Update through Cloud Over-the-Air Interfaces"},"content":{"rendered":"\n<div class=\"wp-block-cover alignfull is-light\"><span aria-hidden=\"true\" class=\"wp-block-cover__background has-background-dim-100 has-background-dim\" style=\"background-color:#ffffff\"><\/span><div class=\"wp-block-cover__inner-container is-layout-flow wp-block-cover-is-layout-flow\">\n<div class=\"wp-block-media-text alignfull is-stacked-on-mobile is-image-fill\" style=\"grid-template-columns:47% auto\"><figure class=\"wp-block-media-text__media\" style=\"background-image:url(https:\/\/zli.one\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-24-at-7.02.06-PM.png);background-position:50% 50%\"><img loading=\"lazy\" decoding=\"async\" width=\"531\" height=\"876\" src=\"https:\/\/zli.one\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-24-at-7.02.06-PM.png\" alt=\"\" class=\"wp-image-882 size-full\" srcset=\"https:\/\/zli.one\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-24-at-7.02.06-PM.png 531w, https:\/\/zli.one\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-24-at-7.02.06-PM-182x300.png 182w\" sizes=\"auto, (max-width: 531px) 100vw, 531px\" \/><\/figure><div class=\"wp-block-media-text__content\">\n<h2 class=\"wp-block-heading has-text-color\" style=\"color:#000000;font-size:32px\"><strong>LoRa IoT Device Firmware Update through Cloud Over-the-Air Interfaces<\/strong><\/h2>\n\n\n\n<p>Firmware is an integral part of devices, which refers to the software that instructs the hardware to function and commu- nicate with other software running on a device. Firmware updates are necessary to address security or performance issues during the lifetime of IoT (Internet of Things) devices. Over-the-Air (OTA) updates enable firmware updates to be completed remotely and securely, without the need to re- move devices from their deployment.<\/p>\n\n\n\n<p>This paper introduces a LoRa (Long Range) OTA procedure to enable cloud-based resources to initiate and complete updates to LoRa-connected IoT devices. This differs from existing OTA over LoRa solutions by allowing the LoRa gateway to simply push updates from upstream servers man- aging the deployment of devices. Upstream servers expose APIs to allow devices communicating over a TTS instance to initiate the OTA procedure. A PyCom FiPy was chosen as the IoT device on which to perform OTA.<\/p>\n\n\n\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button is-style-fill\"><a class=\"wp-block-button__link wp-element-button\" href=\"https:\/\/zli.one\/wp-content\/uploads\/2023\/06\/CS219_Cloud_Spring_2023_Report.pdf\" target=\"_blank\" rel=\"noreferrer noopener\">Paper<\/a><\/div>\n<\/div>\n<\/div><\/div>\n<\/div><\/div>\n\n\n\n<p><strong>Background<\/strong><\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:66.66%\">\n<ul class=\"wp-block-list\">\n<li>LoRa is a long-range, low-power networking protocol that allows IoT devices to communicate securely. It allows devices to be managed by base stations while allowing them to function for years without depleting on-board batteries.<\/li>\n\n\n\n<li>Over-the-Air (OTA) updates have enabled security patches and mission-critical updates to be delivered to increasingly important IoT devices.<\/li>\n\n\n\n<li>As part of managing these devices, it makes sense to be able to carry out OTA updates over LoRa.<\/li>\n\n\n\n<li><strong>Our Goal: <\/strong>Enable LoRa OTA between Cloud and LoRa Devices.<\/li>\n<\/ul>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:33.33%\">\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh5.googleusercontent.com\/6WshzKix7GsqIq2K9x68WEGEARa4osvHcnF37dQMwHY6KofTtLqqPwzKNYKlyjmP1LrphSYKK8ALN6yzy81SH0jxOENJ8APYEpRfH6oRy6Rft4vX3RfuR-IW3-9KOa8AKhffNij3fjyUWWCPHej9i7e-Uw=s2048\" alt=\"\"\/><\/figure>\n<\/div>\n<\/div>\n\n\n\n<p><strong>Procedure:<\/strong><\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:66.66%\">\n<ol class=\"wp-block-list\">\n<li>Device connects with server over WiFi<\/li>\n\n\n\n<li>Device requests manifest<\/li>\n\n\n\n<li>Server sends builds &amp; sends manifest<\/li>\n\n\n\n<li>Device receives manifest and updates application and firmware files accordingly\n<ol class=\"wp-block-list\">\n<li>Requests files that are not on device from server<\/li>\n\n\n\n<li>Backs up old files that needs to be updated<\/li>\n\n\n\n<li>Deletes obsolete files per manifest directives<\/li>\n<\/ol>\n<\/li>\n\n\n\n<li>For every firmware file, write firmware to OTA partition on device and set flag to boot from OTA instead of partition<\/li>\n\n\n\n<li>Machine resets to complete update<\/li>\n<\/ol>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:33.33%\">\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/zli.one\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-24-at-6.42.53-PM-2-762x1024.png\" alt=\"\" class=\"wp-image-872\" width=\"209\" height=\"281\" srcset=\"https:\/\/zli.one\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-24-at-6.42.53-PM-2-762x1024.png 762w, https:\/\/zli.one\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-24-at-6.42.53-PM-2-223x300.png 223w, https:\/\/zli.one\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-24-at-6.42.53-PM-2-768x1032.png 768w, https:\/\/zli.one\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-24-at-6.42.53-PM-2.png 781w\" sizes=\"auto, (max-width: 209px) 100vw, 209px\" \/><\/figure>\n<\/div>\n<\/div>\n\n\n\n<p>Implementation Steps<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/zli.one\/wp-content\/uploads\/2023\/06\/LoRaOTAProcedure-1-1024x513.png\" alt=\"\" class=\"wp-image-878\" width=\"1237\" height=\"620\" srcset=\"https:\/\/zli.one\/wp-content\/uploads\/2023\/06\/LoRaOTAProcedure-1-1024x513.png 1024w, https:\/\/zli.one\/wp-content\/uploads\/2023\/06\/LoRaOTAProcedure-1-300x150.png 300w, https:\/\/zli.one\/wp-content\/uploads\/2023\/06\/LoRaOTAProcedure-1-768x385.png 768w, https:\/\/zli.one\/wp-content\/uploads\/2023\/06\/LoRaOTAProcedure-1-496x248.png 496w, https:\/\/zli.one\/wp-content\/uploads\/2023\/06\/LoRaOTAProcedure-1.png 1400w\" sizes=\"auto, (max-width: 1237px) 100vw, 1237px\" \/><\/figure>\n\n\n\n<p>Setup Configurations<\/p>\n\n\n\n<p><strong>LoRa Socket:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>LoRaWAN Mode &#8211; US-compliant bandwidth, channels, and frequencies (Zone: US915)<\/li>\n\n\n\n<li>LoRa OTAA (Over the Air Authentication)<\/li>\n\n\n\n<li>Blocking set &#8211; device waits for packets to be received<\/li>\n\n\n\n<li>Socket timeout set to 15 seconds &#8211; client triggers retransmission after 15 seconds of not receiving an expected packet<\/li>\n<\/ul>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<p><strong>Triggers\/ACKs\/NACKs:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>No OTA protocol for LoRa: start, stop, data format etc.\n<ul class=\"wp-block-list\">\n<li>Example WiFi OTA code only send arbitrary bytes as trigger &#8211; we do the same thing<\/li>\n\n\n\n<li>Using arbitrary bytes<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>LoRa also does not have ACKs &#8211; we set our own bytestring to ACK\n<ul class=\"wp-block-list\">\n<li>After server receives ACK, disposes of the last binary chunk \/ the last packet sent<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>LoRa also does not have NACKs &#8211; we set another bytestring to serve as NACK\n<ul class=\"wp-block-list\">\n<li>After server receives NACK, retransmits the last binary chunk \/ the last packet sent<\/li>\n\n\n\n<li>Use of NACK is not ideal, but it works very well! Retransmission is guaranteed in case of packet drop\/transmission failure<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"508\" src=\"https:\/\/zli.one\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-24-at-5.56.36-PM-1-1024x508.png\" alt=\"\" class=\"wp-image-876\" srcset=\"https:\/\/zli.one\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-24-at-5.56.36-PM-1-1024x508.png 1024w, https:\/\/zli.one\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-24-at-5.56.36-PM-1-300x149.png 300w, https:\/\/zli.one\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-24-at-5.56.36-PM-1-768x381.png 768w, https:\/\/zli.one\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-24-at-5.56.36-PM-1-1536x762.png 1536w, https:\/\/zli.one\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-24-at-5.56.36-PM-1-496x246.png 496w, https:\/\/zli.one\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-24-at-5.56.36-PM-1.png 2001w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/div>\n<\/div>\n\n\n\n<p><strong>Data Segmentation:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Data segmentation of the binary is done on the server<\/li>\n\n\n\n<li>Our current chunk size is 40 bytes<\/li>\n<\/ul>\n\n\n\n<p><strong>Achieved:<\/strong><\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<ul class=\"wp-block-list\">\n<li>Transfer of files from webserver to LoRa device<\/li>\n\n\n\n<li>Concatenation of chunks on end device to a file<\/li>\n\n\n\n<li>Writing of files into OTA (firmware) partition<\/li>\n\n\n\n<li>Retransmission of the last message from the server to the device if the device times out<\/li>\n<\/ul>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/zli.one\/wp-content\/uploads\/2023\/06\/Evalution-1.jpg\" alt=\"\" class=\"wp-image-875\" width=\"601\" height=\"126\" srcset=\"https:\/\/zli.one\/wp-content\/uploads\/2023\/06\/Evalution-1.jpg 537w, https:\/\/zli.one\/wp-content\/uploads\/2023\/06\/Evalution-1-300x63.jpg 300w, https:\/\/zli.one\/wp-content\/uploads\/2023\/06\/Evalution-1-496x104.jpg 496w\" sizes=\"auto, (max-width: 601px) 100vw, 601px\" \/><\/figure>\n<\/div>\n<\/div>\n\n\n\n<p>Demo<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"CS 219 Project 15 LoRa OTA Demo\" width=\"1032\" height=\"581\" src=\"https:\/\/www.youtube.com\/embed\/66CyTx488pY?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Background Procedure: Implementation Steps Setup Configurations LoRa Socket: Triggers\/ACKs\/NACKs: Data Segmentation: Achieved: Demo<\/p>\n","protected":false},"author":1,"featured_media":849,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"class_list":["post-848","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-projects"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/zli.one\/index.php?rest_route=\/wp\/v2\/posts\/848","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zli.one\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zli.one\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zli.one\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/zli.one\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=848"}],"version-history":[{"count":8,"href":"https:\/\/zli.one\/index.php?rest_route=\/wp\/v2\/posts\/848\/revisions"}],"predecessor-version":[{"id":902,"href":"https:\/\/zli.one\/index.php?rest_route=\/wp\/v2\/posts\/848\/revisions\/902"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/zli.one\/index.php?rest_route=\/wp\/v2\/media\/849"}],"wp:attachment":[{"href":"https:\/\/zli.one\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=848"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zli.one\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=848"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zli.one\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=848"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}