The creation of road infrastructure represents a significant investment. Unfortunately, once finished, we often fail to provide it with the necessary care. This is the reason behind the Smart Road Infrastructure (SRI) Monitoring and Maintenance System.
With very low cost, we can obtain real-time data on traffic flow, average speeds, and much more. In Europe, we have the European Data Project, which encompasses datasets from all European countries. Specifically, in Spain, cities like Madrid provide us with real-time traffic information. However, I believe that data acquisition could be improved, and that is my intention with this project: to make this technology accessible to more cities.
- European data project: https://data.europa.eu/en
- Madrid real-time traffic: https://informo.madrid.es/#/realtime?panel=live
There are three key aspects I want to highlight:
- Realizes the urban mobility: Nowadays, numerous new urban mobility systems have emerged, resulting in changes in the way people move around cities. Consequently, roads planned for an old scenario may not be as useful as they once were. Through a quick analysis of my city, I concluded that by changing the direction of a few key roads, we could significantly reduce traffic jams. Imagine replacing the quick analysis with an AI system utilizing multiple real-time data sources. This could potentially eliminate the problem of traffic jams forever, thereby reducing environmental impact due to decreased CO2 emissions from urban mobility.
- Monitoring roadspeeds: While this system will not replace speed cameras, it can provide an estimated speed for the road segment. With this data, if the average speed exceeds the limit, we should consider installing a speed camera. However, we can obtain a preliminary estimate of the speed without a significant investment.
- Road maintenance: By estimating road speeds, we can identify areas where maintenance may be needed if the average speed is very low. Additionally, by incorporating predictive algorithms, we can estimate when road maintenance will be required based on road traffic and meteorological conditions.
For the prototype, I utilized a small inductive sensor due to budget constraints, although its operation is similar to that of a larger sensor. The inductive sensor needs to be connected to a power supply, with a working voltage ranging between 6 V and 36 V. In my case, I used an adjustable power source to provide it with 10 V.
To simulate a car, I modified a toy car by adding aluminum to its bottom. This modification allows the software to calculate the time the car spends within the sensor's detection area. With this data, we can determine the number of cars passing through, the number of cars per hour, and estimate their speed. It's important to note that the speed calculation is based on an average car size, meaning shorter cars will yield higher speed values, while longer cars will result in lower values. Despite this, the value remains useful, as explained earlier.
However, the data is not stored on the board itself. Instead, thanks to the cellular module, we can send it to a server on Adafruit, where we can visualize graphs showing the number of cars per hour. Additionally, the board sends temperature values, which could be an important parameter for monitoring its proper functioning.
Delve into the codeFor this project, we need to use the libraries <Arduino.h> and <mcp9808.h> for the board, but also <lte.h> to use the cellular module and <mqtt_client.h> to send the data via mqtt to the server on Adafruit.
We also use definitions to work with Adafruit server:
This board will send in real time the cars detected, however, to organize the data, the board also will send ever hour the number of cars and the temperature. For this we have to set the period T (in minutes).
The is defined a function to send the data to the Adafruit server, this function will send via mqtt a string. The variable "i" is created to select between the different topics of the Adafruit server.
The function also includes the confirmation of publish to make us sure that the data has been shared correctly.
In the void setup we initialize the serial monitor, that is for supervise that the board is working as expected and the LTE connections has been establish.
In the void loop() in first place, an if() decrease the period "T" every 60 seconds, and when it is equal to zero, the cars per hour and the temperature are send to our server.
Lastly there is the logic to send the traffic in real time. Every time the sensor detects a magnetic field the board interpret that a car had enter, however, the speed of the vehicle is calculated, and if this is to high the board assume that could be a measurement error.
The Adafruit server is really simple. In first place there is a log box where we can see the messages that the board send. Next to it, he find the graft where we can see the cars and the time. Finally there is a temperature module.
Example of log console:
Example of graft:
Given that this is just a prototype, the construction process is quite simple. To simulate real cars, I attached some foil to the bottom of a toy car. Additionally, I soldered some cables to make it easier to connect to the protoboard.
The LTE connectivity played a crucial role in this project. Initially, I contemplated utilizing batteries for added autonomy. However, after considering the energy demands of the inductive sensors, I concluded that it would be better to connect the module to a distribution line with the necessary voltage regulator.
Another module that caught my interest is the "ATECC608B CryptoAuthentication™ Device." Even though we aren't working with critical data, it's prudent to establish a barrier against cybercriminals.
In conclusion, I'd like to acknowledge the clarity of the documentation, which made working with the board truly enjoyable.
Expectations of the projectFinally, I'd like to share my expectations for this project. Due to initial challenges with software delivery and my first-time experience with Adafruit and MQTT, I haven't been able to finish as expected. However, I am currently working on obtaining data from the server and analyzing it using Python-based artificial intelligence to achieve a better analysis and create a dashboard for the data. My goal is to fulfill the objectives of the project through these efforts.
Comments