Integration of GPS Location Tracking for Mobile Raspberry Pi Module
In the past, the major shortcoming of the mobile stations has been the inability to visualize collected data within the context of geographical location. This is an important part of data analysis, as it allows users to provide context for potential causes of correlations by allowing for geographical factors such as buildings and/or other man-made activities to be taken into account.
To implement this feature, we built a comprehensive Python 3 script integrating GPS data with temperature, air quality (PM 2.5), pressure, humidity, radiation (both total dose-rate and identified isotopes), and CO2 concentration. This sensor data was collected from existing acquisition scripts authored by Dr. Hanks and was communicated to our script through RabbitMQ. We then proceeded to plot the correlations between location and this data onto an HTML file using Folium, an online Python wrapper for the javascript library Leaflet, which allows for interactive location tracking similar to that of Google Maps provided the device is connected to wifi (or a phone hotspot). Points were plotted on the map with a color corresponding to a custom color bar with max and min values specifically tailored to the value being visualized, providing an easy way to track real-time fluctuations. In the case that precise quantitative measurements were desired, we also incorporated a popup feature which displays all the data from all active sensors at that location. To enhance the user-friendliness of the program, we designed a GUI that allows the user to easily start and stop plotting, change parameters such as the data recording rate or name of the data file, and control the type of data visualized on screen.
This version of the device allows for the implementation of all currently available sensors, among which include Air Quality (measured by the concentration of particulate matter in the air), CO2, temperature, pressure, humidity, and radiation. Radiation in particular was also split into 4 subcategories, integrated counts, potassium counts, thallium counts, and bismuth counts. The three isotopes were selected based on the fact that they are (or are daughters of) the most common radioactive sources – potassium, thorium, and uranium.
Preliminary tests with the new integrated device were conducted around the UC Berkeley campus, most of which showed no significant correlation between sensor values and location, with the exception of the expected variations in atmospheric measurements such as temperature, pressure, and humidity. A map of campus showing a track around the perimeter of campus is shown in Figure 1 below and a version showing a track through part of central campus is shown in Figure 2.
These sets of data are by no means final; as of now, there are too many unaccounted variables to concretely say how location might affect atmospheric conditions, air quality, or radiation levels. For instance, for temperature and humidity, the time of day the test is being run during plays a significant role in perceived fluctuations. In both of the Figures shown here, some interesting variation can be seen, but even though within the context of one testing session, these measurements may be sensitive to location, attempting to develop a comprehensive map of a certain area based on these time-dependent values may prove challenging.
Figure 1: Map of UC Berkeley campus with interactive layers showing sensor data results recorded on a path around the perimeter of campus. To see the data for any of the measurements recorded, select that layer from the drop-down menu that will appear when you hover over the layers icon in the upper right of the figure.
Another issue with these tests is the precision of the sensors themselves, which don’t always work as intended and may only collect meaningful data in certain scenarios. For this project in particular, the sensors that exhibited this behavior were the Air Quality sensor, which intermittently failed to collect data, and the CO2 sensor, which required time to adjust to the CO2 level of the current location. The issue with the CO2 sensor can be addressed by simply staying in the desired location for at least a minute or longer if the sensor was previously in an area of high CO2 concentration.
Figure 2: Map of UC Berkeley campus with interactive layers showing sensor data results recorded on a path through a portion of central campus. To see the data for any of the measurements recorded, select that layer from the drop-down menu that will appear when you hover over the layers icon in the upper right of the figure.
Overall, our code provides a basic way for data to be mapped according to location, which will hopefully be useful for future trials in the field. Further improvements can be made, but the ultimate goal of this project was to provide a way of visualizing real-time data on a street map. We hope to see it being used to gather information in other places to give a sense of how environmental measurements are affected by geographical location.