Air Quality Control through Bike Sharing Fleets
AAir Quality Control through Bike Sharing Fleets
Stefan Ciprian Voinea, Armir Bujari, Claudio Enrico Palazzi
Department MathematicsUniversity of Padua
Padua, [email protected], [email protected], [email protected]
Abstract —Air quality and the presence of tiny particularmatter are crucial factors in human health, especially when con-sidering urban scenarios. In this context, smart mobility coupledwith low-cost sensors can create a distributed and sustainableplatform for social sensing able to provide pervasive data tocitizens and public administrations. Sustainable and eco-awaredecisions can then be supported by empirical evidence, resultingin an improved life and city administration. In this paper, wepresent ArduECO, a simple Arduino-based wireless device ableof collecting air quality data. Without loss of generality, we havedesigned our device as a box that can be installed on a bike; inthis way, beyond private bikes, municipalities could exploit theirbike sharing fleets as pervasive sensing systems.
Index Terms —Arduino, bike sharing fleet, embedded, air-quality, sensing
I. I
NTRODUCTION
People and governments around the world are more andmore aware of the importance of air quality and how muchhaving clean and pollution-free air can influence our lives, bothon the small and large scale, especially in urban scenarios [1]–[3]. To have clean air, all of us have to do something to avoidpolluting it.For short commutes, bicycles, skateboards and scooters havestarted to arise and conquer cities, either in their battery-powered or old-school human-powered form. Since not ev-eryone necessarily owns one of these green methods oftransportation, various companies have seen the opportunityto enter the market of shared transportation, proposing a pay-per-use solution for bikes, electric scooters and othersimilar vehicles. Each company has its own phone application,network infrastructure and smart devices aboard their vehicles,gathering data like GPS (Global Positioning System) position,time spent by the user, parking spot, etc. to send them in thecloud and compute information like the cost of the ride andcharging it to the customer.All this falls under the
IoT (Internet of Things) paradigm,which has become a well-described market with new ideasand business opportunities being presented every day [4]–[6].Among the data collected by these companies, none is aboutair pollution.
This work is partially funded by the Department of Mathematics of theUniversity of Padua through the BIRD191227 project.
This article describes
ArduECO , a wireless device basedon an Arduino-like board capable of gathering data about airquality (and more with simple extensions) and sending themto the cloud, to be processed and displayed. To this aim, takinginspiration from related work and without loss of generality,we have designed our tool as a device that can be attached toa bicycle [7], [8]. Although any citizen could install ArduECOon her/his bike, we believe that municipalities should play amajor role in this by endowing their bike sharing fleets withit in order to create an effective pervasive sensing systems.II. P
ROBLEM S TATEMENT AND B ACKGROUND O VERVIEW
Tracking air quality is an important task usually tied toweather agencies involving trucks seen parked or going aroundthe city, collecting data like
PM 2.5 and
PM 10 values. PM stands for Particulate Matter and indicates the term for amixture of solid particles and liquid droplets found in the air,with diameters around 2.5 or 10 micrometers. Some particles,such as dust, dirt, soot, or smoke, are large or dark enough tobe seen with the naked eye, others can only be detected usingan electron microscope.In many cities, a great percentage of PM production hasbeen cut down by decreasing the number of cars that cancirculate and introducing more ways of public transportation:for example pay-per-use bike services have seen in the lastyear a vast amount of users. For instance, since Mobike’slaunch in Padua, Italy, in 2019, its users have biked over330,000 Km across the city and reduced CO emissionsby over 60 tons. CO (Carbon Monoxide) and CO (CarbonDioxide) are gasses that become important pollutants whenassociated with cars, planes, power plants, and other humanactivities that involve the burning of fossil fuels such asgasoline and natural gas.Two general strategies can be used to deploy an environ-mental monitoring system: creating a network of fixed sensorsand resorting to mobile sensors. The former can monitor onlypredetermined locations where the sensors are deployed [9].The latter allows to monitor different parts of the city with thecontinuous and pervasive movements of the sensors, exploitingmobile units, smartphones and other wearables [10]–[12].Focusing on low-cost mobile sensing units, CambridgeUniversity proposed hand-held devices with electro-chemicalsensors to collect and store data or send them in real time to acentral computer for analysis [13]. Similar devices exist alsoas proprietary devices sold to consumers interested in their a r X i v : . [ c s . N I] J u l ig. 1. ArduECO schematicsFig. 2. ArduECO device personal well-being. These devices are usually implementedusing low-cost sensors like the ones in MQ-series, madeof a heating element an electro-chemical sensor, which willreact only when it reaches certain temperatures. ArduECO hasbeen designed using the MQ-7 sensor, sensible for
CarbonMonoxide . III. P
ROPOSED SOLUTION
ArduECO is a wireless IoT device that represents one of thepossible combinations of open source hardware and software.This wireless device is able to detect the amount of CO and thelevel of pollution in the air in order to send this information tothe cloud over Wi-Fi. The schematics for this project, designedusing the Fritzing CAD software for the design of electronicshardware and can be seen in Fig. 1, whereas the real deviceis shown in Fig. 2.The goal is to design and create a device small enough tofit on several means of transportation, including our chosencase study, i.e., bicycles. ArduECO represents indeed a viablesolution: for instance, it could easily fit under the basket andbe powered by batteries, solar cells or dynamos that alreadypower the headlight and other circuitry allowing this bikesharing fleets to be connected with the vendor’s cloud. Given the modularity of ArduECO, its circuit can easily be adaptedto fit other cases and forms.
A. The circuit
ArduECO is composed by four main components: • NodeMCU : this board embodies the heart and brain of thedevice as an an open-source development kit based on theESP8266 chip that allows for prototyping IoT devices; • MicroSD card reader : it allows for collecting and keepingdata cached for the current ride and permanently on aremovable memory card; • GPS sensor : this is used to localize the device and hasan onboard LED that blinks when it has establishedcommunication with a satellite; • MQ sensor : the MQ-7can easily be exchanged with othersensors that use the same board and connectors.The other components, LEDs and button, are used as I/Ofor interacting with the user.In Section IV, we explain how the project can be improvedboth in hardware and software.In Fig. 1 there is no indication of a power supply since thisprototype version has been powered using an external batterywith a standard output of 5V and 1A.
B. The Arduino software
For ArduECO we chose to use Arduino’s programming lan-guage instead of MicroPython because of the large communitysupporting it and the vast interoperability with other boards.The main functions in the Arduino programming language are“ void setup()[] ” and “ void loop()[] ”: the first one runs a singletime when the device boots initializing and setting the initialvalues while the second one loops consecutively, allowing theprogram to change and respond. ArduECO.ino is the mainfile executed by the NodeMCU and contains the previouslydescribed functions.In ArduECO’s software, the setup function contains theinstructions to correctly initialize serial communication withthe GPS module, create the files in the SD card, initialize thepin-outs, gather the certificates for communicating with thecloud and create a random id for identifying the ride, sinceeach time the device boots is considered as a single ride.An important part of the configuration of ArduECO is thefile params.json . This file contains the configuration of severalparameters such as the network SSID and password, topicsfor communicating with the MQTT server and its endpoint(network address). If this file is not present in the SD card atboot-time and correctly formatted, ArduECO will not end theboot sequence, returning an error and rebooting after 10 s.The loop function contains the instructions for the boardto acquire a reading of its surroundings every 5 s by firstdetecting if a GPS fix if present and by reading the valuefrom the analog pin connected to the MQ sensor. Each readis then appended on two separate text files ( cache log.txt and perm log.txt ) in JSON format. The cache log.txt file is createdeach time ArduECO boots is related to a single session while erm log.txt contains reads about each ride taken, includingthe sensor’s id, the air quality and the coordinates of the data.The external LEDs are used to communicate when the setupsequence has finished correctly or with errors, as well as forindicating whether the SSID specified in the params.json fileis in range and ArduECO is transmitting data. When the buttonis pressed, ArduECO searches the list of networks in range forthe specified one and, if present, connects to it. Afterwards, itestablishes communications with the MQTT server specifiedby the endpoint, also sending an initial message notifying thenumber of the following messages that will be sent. Each rowof the cache file is then transmitted to the server. At the endof this sequence the cache file is deleted and created againawaiting new reads.The other files that implement this project contain specificfunctions for either setting up the device or connecting theserver.
C. The cloud
When the button is pressed, ArduECO connects to the ac-cess point with the SSID specified in the params.json file andsends the contents of cache log.txt to the cloud, specificallyto AWS (Amazon Web Services).
IoT core and
Lambda arethe services that are used for this project.ArduECO sends data to the MQTT server in IoT core spec-ified as endpoint in params.js . It connects to this server usingcertificates created in the IoT core console and that are loadedin ArduECO’s memory, this means that they are uploaded viathe Arduino IDE. The MQTT (Message Queuing TelemetryTransport) server is designed as a lightweight messagingprotocol that uses publish/subscribe operations to exchangedata between clients and server, fast in data transmission.This service in IoT core is connected to a serverless Lambdafunction written in Python, triggered each time a new messagearrives from ArduECO, which receives the JSON message asa parameter and calls a PHP page on ardueco.altervista.org,where the front end of the service is hosted. Altervista is afree website hosting platform with PHP and MySQL database.After being saved in the MySQL database in Altervista isthen displayed on the homepage using Google Maps’ APIs.Therefore gathered, aggregated and elaborated data can bedisplayed on a frontend map, with each marker indicating areading from the device, as shown in Fig. 3. Each marker onthe map represents a reading and, if clicked on, shows thevalue read by ArduECO’s sensor. Markers are connected withdifferent colors indicating the ride they belong to. D. Hardware cost
Because the components used for this project are open-source, they can be found sold on various websites from manyvendors. Here are some examples of prices taken from theChinese e-commerce AliExpress at the time of writing. • NodeMCU: ∼ e • MicroSD car reader: ∼ e • GPS sensor: ∼ e • MQ gas sensor: ∼ e Fig. 3. Frontend map with markers and reads from ArduECO.
The total cost of these items amounts to ∼ e , consideringshipping and costs of remaining components (cables, LEDs,button, SD card), it can arrive to less than 15 e . Note thatthe indicated prices refer to single pieces and in case of bulkpurchases (at least 5 or 10 of each piece) the total cost wouldbe much lower.IV. F UTURE IMPROVEMENTS
ArduECO is a feasible implementation that the consideredhardware and software can create; yet, there are variousimprovements which could bring to an even better device.
A. Hardware improvements
The circuit described in Section III-A has a single air sensordue to the limitation of the NodeMCU and ESP8266 chip thathave only one analog input pin. By connecting the board to an
ADC (Analog to Digital Converter) it becomes possible to addmultiple sensors expanding the analog inputs. ADCs convertan analog voltage on a pin to a digital number.In order to upgrade the transmission method and use mobiledata instead of Wi-Fi (which is limited to 2.4GHz on theNodeMCU) it is possible to switch the board to an ArduinoLeonardo or an Arduino Uno. Modules capable to add mobileconnectivity can be easily found on sites like AliExpress anddo not brig much additional overall cost (in this case ∼ e ).Given the small size of the components, this project can beeasily fitted within a custom made box easily installable on abicycle. A solution could be to design and 3D print a customplastic case in which fit the whole device, considering that theair sensor should remain outside of the case and the wholedevice could be exposed to high levels of humidity especiallyduring the winter season.Powering is one important issue for IoT devices. Theprototype described in this manuscript runs on an externalbattery, but it can be coupled with other energy sources like asolar cell or a dynamo, so that it can be powered by movementof the wheel. B. Software improvements
A control could be added to check the reception of messagesby the IoT server and, in case of a timeout or an error, themessage could be sent again.n this project various libraries have been used for theArduino sensors, an improvement would be to better adaptthese libraries for ArduECO, especially the MQ-7 library.Furthermore, since ArduECO is an IoT device and batteryis an essential need, adding a deep sleep mode could improvethe energy performance.
C. Cloud services improvements
AWS’ IoT core could be configured to have more MQTTservers based on the groups of devices divided by each cityor zone in which they’re used.Another significant change would be using an AWS EC2instance to host the website instead of Altervista. Consider-ing an architecture that could easily scale horizontally, andsupporting more devices connected at once, the databasecould be switched from MySQL to Redis, a NoSQL databasethat provides real-time and high-efficiency services for datastorage, increasing the I/O speed by storing all key-value datain the memory.These, thought, would introduce a cost for the AWSservices, but offering high efficiency and modularity.V. C
ONCLUSIONS