1、#EMBEDDEDOSSUMMITOpen Source Ultra-Wideband RTLS with Zephyr Developent ExperienceAleksander Wjtowicz,AVSystem Aleksander Wjtowicz vooytovitch https:/ Fresh CS graduate AGH UST,Krakw Embedded Software Engineer AVSystem we do IoT device management,based on LwM2M I work on Anjay,our LwM2M client and i
2、ts ports,including ZephyrAbout me I didnt know about Zephyr before joining AVSystem It was also the very first thing I worked on!About me what are Real Time Locating Systems?whats Ultra-Wideband?how UWB-based RTLSs work?project showcase implementation details and my experience with Zephyr how it hel
3、ps with quick development?how it helps with making generic software?problems Ive encountered many tips&tricksTalk plan#EMBEDDEDOSSUMMITReal Time Locating Systems andUltra-Wideband real time asset tracking vehicles,tools,workforce location data is loggedto some service indoor setting cant use GPS tra
4、ckersWhat are RTLSs forIn practiceIn practice various methods RSSI-based is the most popular array of“anchors”around the area“tag”on moving object stronger signal-closer you are to anchor multiple measurements-location estimationIn practicepros:cheap trackers works indoorscons:RSSI changes due to ma
5、ny factors,not just distance that 1 m accuracy may be still not good enoughSignal strength with Bluetooth/Wi-Fi yet another radio technology recent growth of use in consumer electronics since 2007,also a PHY in IEEE 802.15.4 merged to main spec in 2011 unique physical properties for accurate distanc
6、e measurement works in non-line-of-sight scenarios this can be used to build an accurate RTLSWhats Ultra-Wideband?Apple AirTagPhoto:ApplePhoto:AppleBMW Digital Key PlusPhoto:https:/ to 10 GHz,bandwidth:=500 MHz(!)high RX time measurement resolution+multipath detectiontime of flight calculationdistan
7、ce=ToF*speed of lightmultiple distances to anchorslocationUWB use in RTLSSingle-Sided Two-Way Ranging 20 cm easily for SS-TWR clock drift correction is needed with additional processing,antenna calibration,etc.up to 2 cmAccuracyTrue-range multilateration 2DTrue-range multilateration 2DTrue-range mul
8、tilateration 2DTrue-range multilateration 2DTrue-range multilateration 3DPhoto:ciechanow.ski/gps accident prevention track workforce and heavy machines asset tracking shorter access time usage analysis shopping carts with navigation!High accuracy RTLS use cases#EMBEDDEDOSSUMMITProject showcase open
9、source UWB RTLS made as part of engineering thesis coauthored with Sebastian Szczepaski supervised by professor Tomasz Szydo https:/ find also thesis full text thereHyperRTLS Zephyr-based apps for hardware tags and anchors default target:Decawave MDEK1001 nRF52832(with BLE),DW1000 UWB IC gateway app
10、 requires BLE and IP stackFeaturesPhoto:https:/ Backend software Node.js app connects to Mosquitto and PostgreSQL serves REST API for RTLS management,location retrieval supposed to be used by end products with business logic example app using the REST APIFeaturesData flow engineering thesis,obviousl
11、y theres no end-to-end open source UWB RTLS solution theres tens of companies which offer commercial systems theyre pricey;entry barrier is high,while UWB modules are rather cheap MDEK1001(bundle of 12 devices)is 300 USD learning purposes even Decawaves positioning stack is a binary blobMotivationDe
12、mo#EMBEDDEDOSSUMMITImplementation and development experience no IP stack on devkits,so no MQTT observation:anchors and tags are always in Bluetooth range idea:use mesh networking anchors are backbone wed like to use OpenThread but no support on nRF52832:(Gateway Linux SBC(like Raspberry Pi)and scrip
13、t talking to BlueZ through dbus cool,since it could run on dev PC as well but both dbus and BlueZ API are too complex=(wrappers didnt help Zephyr?use the same API everywhere!but rest of development experience will be worseOptions turns out:we still can get away with bringing no real HW Zephyr has ma
14、ny emulators QEMU(closest to running on real HW),native_posix(Zephyr as Linux process),at first they sound useless emulators are supposed to emulate,right?but:you can proxy real peripherals to them we went with QEMUOr wont it?TUN or TAP interface SLIP proxied over Unix socket Intel E1000 virtualized
15、 over TAP iface by QEMU the preferred wayIP stack on QEMUIn practiceIn practiceTarget-specific hacksTarget-specific hackspcap!Host and Mesh implementation are just software Controller is linked using HCI and runs on the same chip(as in nRF52),uses RAM external chip(as in nRF9160DK),uses UART a perip
16、heral BLE controller on host PC in case of QEMU:btproxy forwards Linux Bluetooth socket to Unix socket,forwarded to Zephyr as a serial deviceBluetooth Low EnergyIn practiceData flow-my setup NCS is a fork of Zephyr for Nordic Semi products most APIs compatible with upstream Zephyr Bluetooth well doc
17、umented,ton of examples some things dont work OOTB because of e.g.macros unavailable in upstream just inline them;)Side note:nRF Connect SDK Zephyr has 802.15.4 API and driver for DW1000 at first it seemed useless used just to send data,no control over TX/RX timestamps turns out:you can,but the API
18、is weird flexible net_pkt API has many optional functions behind a Kconfig option(CONFIG_NET_PKT_TIMESTAMP)takeaway:complex APIs without examples are useless:(UWB on Zephyr:DW1000 driverPorting the driverBewareDevicetree:the double-edged swordMaking devicetree less painfulMaking devicetree less pain
19、fulhttps:/youtu.be/w8GgP3h0M8M location is calculated from distances theyre measured by tags two options:send measurements to central server,calculate location,optionally send it back to tag calculate location on tag,optionally send it to the server we went with doing the calculation on the tagsQuic
20、k maths implementing all functions from ground-up is NOT an option(pseudo)-inverse is the hardest to implement many options on full-size computers Python:NumPy?C:GSL(GNU Scientific Library)good luck with trying to compile that for embedded Zephyr has Zephyr Scientific Library!for some reason not ZSL
21、 but zscilibLinear algebra on ZephyrDeja vu easy to add entry in.yml manifest west update CONFIG_ZSL=y abuses VLAs some functions are stack heavy CONFIG_MAIN_STACK_SIZE=32768 to the rescue multithreading?use CONFIG_FPU_SHARING=yzscilib Zephyr is not the silver bullet but certainly a good painkiller!is the project successful?we graduated,so I guess yes!Wrap upemulatorsbuild systemperipheral APIsconnectivitylibraries#EMBEDDEDOSSUMMITThank you!questions?