Introduction
enviroCar is a citizen science community that collects, shares, and analyzes floating car data for traffic management and the environment. It examines the open data and estimates the track count, average speed, relative speed, CO2 emission, fuel consumption, and hotspot analysis.
enviroCar app is a mobile application that provides features such as:
- Recording tracks, exploring recorded tracks, and uploading tracks as open data for analysis.
- Sharing data: Uploading data as open data for analysis that estimates CO2 emission, track count, average speed, relative speed, hotspot analysis.
- Providing real-time data about the track, the distance covered, and the duration.
In this blog post, I’ll be citing the work I did during this year’s Google Summer of Code (GSoC) alongside D Ajay under the guidance of my mentor Mr. Benjamin Pross. For more detailed information, please visit my introductory blog post, midterm blog post, weekly reports, and GitHub repository.
About the project
The main goal of the project is to lay a foundation for a platform-independent enviroCar app. It will result in making the enviroCar mobile application accessible to iOS users as well.
The core tasks for this year’s GSoC project are summarized as follows:
- Connect to the server and authenticate the user
- Design the UI of the app
- Connect and communicate with the OBD-II devices via Bluetooth
- Record the track
- Store the recorded track data locally
- Upload the recorded track data as open data for analysis purposes.
Connect to OBD-II adapter via Bluetooth
We started with flutter_blue, flutter_reactive_ble, and bluetooth packages for adding the functionality to connect and communicate with Bluetooth and BLE (Bluetooth low energy) devices. Both the packages flutter_blue and flutter_reactive_ble are updated from time to time. The Bluetooth package is similar to flutter_blue, but was last updated in 2019. According to the pub statistics, pub-points and the popularity of Bluetooth packages seemed outdated. So we decided to proceed with the flutter_blue and flutter_reactive_ble packages.
This task involves
- Scanning the nearby Bluetooth devices
- Connecting to the selected Bluetooth device
- Discovering the services offered by the device
- Communicating with the connected Bluetooth device.
Record the track (GPS tracking)
We used google_maps_flutter for integrating the Google maps widget in iOS and Android applications. We also used the provider package for background GPS tracking. During the track recording, the latitude, longitude, and altitude of a position get saved. The user can give a customized name to the track once the tracking stops. There is also a functionality to pause the track recording.
Store the recorded track data locally
We used the Hive database to store the recorded track data locally. Hive is a NoSQL key-value pair database. We chose to use Hive over SQL because it has a suitable schema to save the track data. The user can delete the selected track data from the database. Furthermore, he can upload it as open data for analysis purposes.
Upload the recorded track data
The user can upload the recorded track data to the server. The track data of that particular track first gets fetched from the database. Then it gets encoded according to the track schema acceptable by the server.
Additional aspects
Some other aspects of the project I worked on are as follows:
- Background services to determine the status of the location services and Bluetooth and to update the UI to indicate the state.
- Widget to set a custom track name.
- Display a widget to indicate the status of location services and connection with the OBD-II adapter while the track is in progress.
- Improve the card widget to display the track details on the track list screen.
- Improve the card widget to display the detailed track data on the track details screen.
- Improve the widget for empty local track list and uploaded track list.
Link to pull requests
Pull Request | Tasks |
https://github.com/enviroCar/enviroCar-Cross-Platform-App/pull/20 |
|
https://github.com/enviroCar/enviroCar-Cross-Platform-App/pull/19 |
|
https://github.com/enviroCar/enviroCar-Cross-Platform-App/pull/33 |
(using flutter_blue package) |
Some of the features are only half-done:
- Fetch the speed, maf, rpm values from the OBD-II adapter, parse this data to get the required information like consumption, maf (mass airflow), etc.
- Speed indicator widget to display the speed of the vehicle and update the values.
Summing-up
I am thankful to all the mentors and the organization for selecting me as a student developer for this year’s GSoC. It was a great learning experience. I am very grateful to my mentors Benjamin Pross, Sebastian Drost, and Arvind Negi, and Ann Hitchcock for their guidance.
The weekly meets helped me improve my presentation skills and, expressing my ideas became easier. The project progress management tools helped to stay organized and always propose a plan to proceed further.
I am incredibly thankful to my mentor Mr. Benjamin Pross for his valuable guidance and support throughout this period. I am grateful to D Ajay and Sai Karthikeya for their help.
Working on this project helped me improve a lot. I got to learn something new every day. It was an amazing experience.
Leave a Reply