{"id":21477722,"url":"https://github.com/edward62740/ot-ipr","last_synced_at":"2025-06-14T17:04:29.023Z","repository":{"id":64854285,"uuid":"532499484","full_name":"edward62740/ot-IPR","owner":"edward62740","description":"Battery powered radar indoor presence sensor with OpenThread IPv6 connectivity","archived":false,"fork":false,"pushed_at":"2024-01-05T06:38:04.000Z","size":2152484,"stargazers_count":5,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-14T17:04:27.709Z","etag":null,"topics":["coap","influxdb","iot","ipv6","openthread","presence-detection","radar"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/edward62740.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2022-09-04T09:55:27.000Z","updated_at":"2024-09-16T09:46:23.000Z","dependencies_parsed_at":"2024-01-14T15:23:05.984Z","dependency_job_id":"0aaf48ab-14d2-491b-948c-5d45cdabc5ef","html_url":"https://github.com/edward62740/ot-IPR","commit_stats":{"total_commits":65,"total_committers":3,"mean_commits":"21.666666666666668","dds":"0.10769230769230764","last_synced_commit":"637d24393e08d1315bdc83d19debf5092943a4e2"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/edward62740/ot-IPR","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edward62740%2Fot-IPR","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edward62740%2Fot-IPR/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edward62740%2Fot-IPR/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edward62740%2Fot-IPR/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/edward62740","download_url":"https://codeload.github.com/edward62740/ot-IPR/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edward62740%2Fot-IPR/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259851697,"owners_count":22921628,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["coap","influxdb","iot","ipv6","openthread","presence-detection","radar"],"created_at":"2024-11-23T11:14:53.373Z","updated_at":"2025-06-14T17:04:28.995Z","avatar_url":"https://github.com/edward62740.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OpenThread Radar Presence Detection Sensor (IPR)\n\n## Overview\nThis is a presence sensor that uses 60GHz [radar](https://www.acconeer.com/products/) pulses to detect human presence indoors.\u003cbr\u003e\nThe sensor communicates over the OpenThread protocol, utilizing existing IPv6 infrastructure (without the need for a IoT protocol \"translator\"). In order to facilitate low-power operation, CoAP is used for the sensor to notify a server of state changes.\u003cbr\u003e\nRefer here for the [CoAP Server](https://github.com/edward62740/ot-coap-server).\u003cbr\u003e\n\n\n## Hardware Design\nThe IPR is designed on a 6-layer POFV, impedance controlled PCB. The components run off a single 1.8v supply, due to limitations of the radar IO voltage, in order to avoid level-translators. The main controller on the board is of the [EFR32MG24 Series](https://www.silabs.com/wireless/zigbee/efr32mg24-series-2-socs). Due to chip shortages, more than one part in this series was used with little effect on the actual functionality.\u003cbr\u003e\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://github.com/edward62740/ot-IPR/blob/master/Documentation/ipr.png\" width=\"800\" /\u003e\u003cbr\u003e\n \u003cbr\u003e\n  \u003cem\u003eIPR v2 PCB\u003c/em\u003e\n\u003c/p\u003e\u003cbr\u003e\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/edward62740/ot-IPR/blob/master/Documentation/enclosure.png\" width=\"350\" /\u003e\n  \u003cimg src=\"https://github.com/edward62740/ot-IPR/blob/master/Documentation/IPR%20v2.png\" width=\"350\" /\u003e\n  \u003cbr\u003e\n  \u003cem\u003e3D printed enclosure and CAD drawings\u003c/em\u003e\n\u003c/p\u003e\n\n\n## Detection Principles\nRadar was chosen for this project due to its ability to detect micro movements and perform 'filtering' by estimating distance/speed of target. This makes it suitable for certain applications where traditional sensing methods such as PIRs may be insufficient, such as needing to sense presence in specific areas, or in areas of high traffic. It also helps to overcome limitations of PIRs in detecting human presence without significant motion, which would be an issue in certain areas, i.e. a study area. \u003cbr\u003e\u003cbr\u003e\nFor example, consider an open space with multiple lighting zones, such as a public library or a large living/dining room. The constant motion of people walking by will need to be filtered to only activate when someone sits down or stays in a particular zone. This automatically rules out the PIR (which would be far superior in terms of power usage). \u003cbr\u003e\u003cbr\u003e\nThus, radar appears to be an obvious choice, as well as some other solutions such as [VL53L5X](https://www.st.com/resource/en/datasheet/vl53l5cx.pdf) and [CH201](https://invensense.wpenginepowered.com/wp-content/uploads/2022/04/DS-000379-CH201-v1.2.pdf), which appear to consume similar amounts of power for this application.\u003cbr\u003e\nThe obvious downside of radar over other similar technologies such as ToF, IR, etc. is that it is computationally expensive, as described below.\u003cbr\u003e\u003cbr\u003e\n\nIn general, the IPR uses the following software layers to process the radar data into useful detection information:\n\n| SW Layers             | Type                | Purpose                                        |\n| ----------------------|:-------------------:|:----------------------------------------------:|\n| Application Algorithm | Custom              | Filters presence algo and manages power usage  |\n| Presence Algorithm    | RSS (Proprietary)   | Provides useful interpretation of service data |\n| Sparse Service        | RSS (Proprietary)   | Pre-processes sensor data                      |\n| HAL                   | Platform            | Provide a generic HW interface to the RSS      |\n\n## Details of Detection Algorithms\nDocumentation on RSS can be found [here](https://docs.acconeer.com/en/latest/exploration_tool/algo/a111/presence_detection_sparse.html).\n\nFor the application layer, the main constraints are a compromise between power consumption and sensor performance/responsiveness.\nHence, the application will adjust the sampling rate of the sensor based on the presence or absence of a target.\u003cbr\u003e\nMore specifically, the sensor will sample at a rate of approx. 0.33 frames/s (radio gets priority since this is not time-critical), and based on the results of this detection, the frame rate can be increased up to 2Hz. Note that each frame contains 63 consecutive sweeps of the detection range. The application also introduces a hystersis-like behavior to the detection state. The table below shows the parameters used during testing.\n\u003cbr\u003e\nHence, the maximum time (excluding radio subsystem yields) required to switch to a \"detected\" state is $$\\sum_{\\substack{k=1 \\ k \\text{ odd}}}^{\\left\\lfloor \\frac{\\text{TH}{+}}{10} \\right\\rfloor} \\max\\left(\\frac{IFD_{\\max}}{k}, IFD_{\\min}\\right), \\quad \\text{TH}_{+} \\in \\mathbb{N}$$  each value is clipped by the minimum frame spacing (IFD\u003csub\u003eMIN\u003c/sub\u003e) as a lower bound. Using the configuration below, this value is 5100ms. In practice, the state often switches within 3s, as the first frame is not necessarily sampled 3000ms after presence begins.\u003cbr\u003e\nThrough limited testing, this configuration yielded a false positive (i.e spurious detections without any apparent presence) rate of $4.96 \\times 10^{-6}$, which is sufficient for the purposes of this project. It is yet to be determined what the false negative rate is, but the number is also trivial.\n\n\u003ctable style=\"width: 145px;\"\u003e\n\u003ctbody\u003e\n\u003ctr style=\"height: 23px;\"\u003e\n\u003ctd style=\"width: 105.891px; height: 23px;\"\u003e\u003cstrong\u003e\u0026nbsp;Parameter\u003c/strong\u003e\u003c/td\u003e\n\u003ctd style=\"width: 19.1094px; height: 23px;\"\u003e\u003cstrong\u003eValue\u0026nbsp;\u003c/strong\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr style=\"height: 23px;\"\u003e\n\u003ctd style=\"width: 105.891px; height: 23px;\"\u003eStart/End Distance\u003c/td\u003e\n\u003ctd style=\"width: 19.1094px; height: 23px;\"\u003e0.2/1.75m\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr style=\"height: 23px;\"\u003e\n\u003ctd style=\"width: 105.891px; height: 23px;\"\u003eThreshold (TH+/TH-/THMAX)\u003c/td\u003e\n\u003ctd style=\"width: 19.1094px; height: 23px;\"\u003e80/20/100\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr style=\"height: 23px;\"\u003e\n\u003ctd style=\"width: 105.891px; height: 23px;\"\u003edTH/dt(+/-)\u003c/td\u003e\n\u003ctd style=\"width: 19.1094px; height: 23px;\"\u003e20/5\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr style=\"height: 23.5px;\"\u003e\n\u003ctd style=\"width: 105.891px; height: 23.5px;\"\u003eRx Gain\u003c/td\u003e\n\u003ctd style=\"width: 19.1094px; height: 23.5px;\"\u003e0.5\u0026nbsp;\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr style=\"height: 23px;\"\u003e\n\u003ctd style=\"width: 105.891px; height: 23px;\"\u003eHWAAS\u003c/td\u003e\n\u003ctd style=\"width: 19.1094px; height: 23px;\"\u003e63\u0026nbsp;\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr style=\"height: 23px;\"\u003e\n\u003ctd style=\"width: 105.891px; height: 23px;\"\u003ePower Mode\u003c/td\u003e\n\u003ctd style=\"width: 19.1094px; height: 23px;\"\u003eOff\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr style=\"height: 23px;\"\u003e\n\u003ctd style=\"width: 105.891px; height: 23px;\"\u003eDetection Threshold\u003c/td\u003e\n\u003ctd style=\"width: 19.1094px; height: 23px;\"\u003e2000\u0026nbsp;\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr style=\"height: 23px;\"\u003e\n\u003ctd style=\"width: 105.891px; height: 23px;\"\u003ePCA Noise Reduction\u003c/td\u003e\n\u003ctd style=\"width: 19.1094px; height: 23px;\"\u003e1\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr style=\"height: 23px;\"\u003e\n\u003ctd style=\"width: 105.891px; height: 23px;\"\u003eService Profile\u003c/td\u003e\n\u003ctd style=\"width: 19.1094px; height: 23px;\"\u003e4\u0026nbsp;\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr style=\"height: 23px;\"\u003e\n\u003ctd style=\"width: 105.891px; height: 23px;\"\u003eMax Inter-frame Delay (IFD\u003csub\u003eMAX\u003c/sub\u003e)\u003c/td\u003e\n\u003ctd style=\"width: 19.1094px; height: 23px;\"\u003e3000ms\u0026nbsp;\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr style=\"height: 23px;\"\u003e\n\u003ctd style=\"width: 105.891px; height: 23px;\"\u003eMin Inter-frame Delay (IFD\u003csub\u003eMIN\u003c/sub\u003e)\u003c/td\u003e\n\u003ctd style=\"width: 19.1094px; height: 23px;\"\u003e750ms\u0026nbsp;\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003cbr\u003e\nOnly the data from the detection algo is sent over CoAP (i.e state changes) together with some other stuff (ambient brightness, battery levels etc.).\n\n## Communication\nThe IPR utilizes CoAP for low-power communication with a remote server. In this project, the server runs on the same hardware as the border router.\n| Server (OTBR)         |                      | Client (IPR)       | Message                                        |\n| ----------------------|:-------------------:|:-------------------:|:----------------------------------------------:|\n|                       | \u003c------------------ |        DNS-SD       | Register SLAAC IPv6 with SRP server            |\n|         GET           | ------------------\u003e |                     | Informs client of the server IP and uri        |\n|                       | \u003c------------------ |        ACK          | Ack (must be received or will not proceed)     |\n|           .           |         .           |          .          |                       .                        |\n|           .           |         .           |          .          |                       .                        |\n|                       | \u003c------------------ |        PUT          | If change of detection state AND periodically  |\n|         ACK           | ------------------\u003e |                     | Ack                                            |\n\nIt is noteworthy that CoAP has many security issues like MQTT, but they were not of particular concern in this application since CoAP communication never leaves mesh-local.\u003cbr\u003e\u003cbr\u003e\n![Communication](https://github.com/edward62740/ot-IPR/blob/master/Documentation/comm.png \"Communication\")\n\u003cbr\u003e\nThere is also IPv6 address discovery implemented over DNS-SD (RFC6763), to allow the CoAP server to discover nodes that are connected to other routers.\n\n## Performance and Future Improvements\nCurrently, the sensor has an average power consumption of approx. 140-160uA @ 1.8v, which can be reduced at the cost of performance (shown below)\u003cbr\u003e\n![Power Consumption](https://github.com/edward62740/ot-IPR/blob/master/Documentation/pwr.png \"Power Consumption\")\u003cbr\u003e\nThis gives the sensor a battery life of \u003e1 year on 2 x LR03 cells.\n\nFuture improvements are to replace the sensor with the pin-compatible [A121](https://developer.acconeer.com/download/a121-datasheet-pdf/), which is an improved version of the radar sensor with significantly lower idle vtx/rx currents, and should offset the avg. current by -60uA. Another obvious improvement is to disable the sensor at night.\n\u003cbr\u003e\nThe CoAP server allows for data collected to be visualized as shown below: \u003cbr\u003e\n![Visualization](https://github.com/edward62740/ot-IPR/blob/master/Documentation/grafana.png \"Visualization\")\u003cbr\u003e\n\n\n## Field Testing and Deployment\nOverall, the DUT (3 nos.) remained stable during the field test, for the duration of \u003e 1 year. This included power cycling of the border router, sporadic disconnections from the Internet, restarts of the SRP server etc. \u003cbr\u003e \nThe radar performance met expectations, with the exception of a single event (during the entire duration of the test) consisting of erroneous triggers lasting for approx. 5 minutes, for one DUT. Due to the nature of the event, it may have been caused by some form of interference or an unexpected strong reflector (i.e metal). Users should be aware of the possibilities of this occurence with radar. \u003cbr\u003e\n\nThe battery life calculations were corroborated by the measured battery life, which averaged no less than 1 yr (m = 1.1y, std = 0.06y). All tested units ran 24/7.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedward62740%2Fot-ipr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fedward62740%2Fot-ipr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedward62740%2Fot-ipr/lists"}