Geotagging data from DoseNet systems
Kevin Wu, Aaron Ely, Garry Li
Introduction
Original mapping features on portable systems with D3S (CsI) detectors utilized dedicated Ultimate GPS modules; however, such modules were unreliable for mapping purposes as fixes either took too long to acquire or were never acquired at all. The GPS modules work by connecting to a small network of satellites orbiting Earth and need to be connected to multiple satellites for accurate coordinates to be produced. Modern smartphones, in contrast, combine assisted GPS (A-GPS), multilateration, and other methods that involve not only GPS satellites but also connected Wi-Fi/cellular networks and other technology. These combinations result in significantly increased reliability, with one’s coordinates able to be acquired almost instantly.
There are two new options for using a smartphone to geotag data as it is collected: a Flask app that hosts a web app to be visited on a smartphone, and an Expo app that can be installed on smartphones via the Expo Go app.
Usage
Portable system with D3S (CsI) detector
- Setting up a new system for the first time requires SSL certificates to be generated, to allow coordinates to be transmitted between the Raspberry Pi and a smartphone. These certificates are set up to be valid for 365 days and thus need to be regenerated every 365 days. To generate the certificates, enter the mobile folder and run ./gen_cert.sh.
- Connect to a smartphone’s hotspot (currently requires keyboard and mouse/touchscreen).
- Open the data app. By default, GPS acquisition is set to use the smartphone; find the web address indicated by the option in the dropdown menu and visit the site on the smartphone.
- On the smartphone, accept the self-signed certificates.
Portable sodium iodide (NaI) scintillation detector
- Setting up a new system for the first time requires SSL certificates to be generated, to allow coordinates to be transmitted between the Raspberry Pi and a smartphone. These certificates are set up to be valid for 365 days and thus need to be regenerated every 365 days. To generate the certificates, enter the mobile folder and run ./gen_cert.sh.
- Connect to a smartphone’s hotspot (currently requires keyboard and mouse/touchscreen).
- For the NaI detectors, there is currently no display for the web address that needs to be connected to. It can, however, be found by entering hostname in the terminal, and placing the output of the command between https:// at the front and :5000 at the back (example: https://172.20.10.4:5000). If the output of the command is the name of the Raspberry Pi and not an IP address, add .local between the hostname and :5000 (example: https://raspberrypi.local:5000). Visit the site on the smartphone.
- On the smartphone, accept the self-signed certificates.
Web app
Entering the address into a smartphone that the Raspberry Pi is connected to, via hotspot, produces a simple website that can control location transmission.
The first button, on the left, allows users to switch between the high and low accuracy options of the Geolocation API. Based on testing, there appears to be little to no difference between the two options, so it is recommended to use the (default) low accuracy option as the high accuracy option should consume more power. The second button on the right starts/stops location collection and transmission.
If at any point the app/tab is switched, or the screen turns off, while collection and transmission are running, coordinates will no longer be transmitted. Thus, when the start button is pressed, the web app will request a wake lock in an attempt to at least keep the screen on for the user. This is one of many reasons why an alternative Expo app was pursued, as it would allow for location information to be collected in the background with the screen off—saving power—or with another app/tab active; a web API for background location has been discussed for years but has never been implemented due to a variety of battery/privacy/etc. reasons. When a user does leave the web app, the portable system with the CsI detector, as well as the portable NaI detector system, will continue to record the latest pair of coordinates for up to one minute. After one minute, both systems will record the “default” location, (0, 0), as the current location, so it should be obvious that up-to-date coordinates were no longer available as (0, 0) is in the South Atlantic Ocean, off the African coast.
Alternative Expo app
The Expo app is similar to the web app in sending a user’s location data from a smartphone to a Raspberry Pi, though the Expo app continues this process in the background as well. As a result, the inconvenience of needing the app to be constantly open while collecting data is eliminated.
When first opened, the Expo app will ask the user to allow the app to use their location data, before repeatedly sending the user’s coordinates to the Raspberry Pi every 60 seconds. The app will display the last coordinates that were sent, as well as a timestamp of when that data was sent.
Conclusions
Both the web app, hosted by Flask, as well as the Expo app, are reliable options for geotagging DoseNet systems’ data. While the web app may be easier to get started with, the Expo app may be a better option for those collecting data in longer sessions—where usage of a smartphone is not as conveniently sacrificed.
Future steps include:
- [General] Filling the app’s empty space with live data/mapping (though this will consume more power)
- [General] Syncing location collection interval with that of the portable systems
- [General] Considering transmission of coordinates over Bluetooth
- [Web app] Automatically handling expiration of SSL certificates
- [CsI] Integrating GPS acquisition with the rewritten data app
- [NaI] Adding web app’s address information to the NaI detector interface
Code
CsI detector web app and receiving side: https://gitlab.com/1kwu/dosenet-mapping
NaI detector web app and receiving side: https://gitlab.com/wlmchen/bp