Smart Traffic Management at Intersections
Journal of Sustainable Construction Materials and Technologies 2025, Vol. 10, Issue 2, pp. 5; doi.org/10.29187/2458-973X.1187
Abstract
Keywords: Smart traffic; Artificial intelligence; Sensor; Vehicle delay; Microcontroller
1. Introduction
With the rapid development of technologies and their implementation in vehicles, communication and interconnection with essential processes in traffic management have been enabled. The practical implementation of traffic signals has enabled traffic control by applying control algorithms [1–4]. Urban mobility in general and motorized traffic in particular constitute a challenge for developing countries that require adequate treatment [2–6]. In this regard, Kosovo remains at the basic level of treatment, and the fixed-time traffic control system is applied as a form of traffic light control at intersections. This means that these systems are often
inefficient, especially when traffic nonlinearity is high [2]. Other traffic-related impacts, traffic delays, and other safety aspects are some of the issues of particular importance that require proper treatment to improve the quality of traffic operations and the quality of life [2]. Promoting innovative ideas to solve these problems is the right way for developed cities to respond to changing mobility demands with adequate solutions [4]. In most developing nations, including Kosovo, traffic control systems rely on outdated fixed-time controllers.
Received 23 January 2025; revised 15 May 2025; accepted 16 May 2025. Available online 30 June 2025 * Corrosponding author. E-mail addresses: gezim.hoxha@uni-pr.edu (G. Hoxha), piotr.gorzelanczyk@ans.pila.pl (P. Gorzelanczyk), rame.likaj@uni-pr.edu (R. Likaj), shaban.thaqi@uni-pr.edu (S. Thaqi), flori.cikaqi@student.uni-pr.edu (F. Cikaqi). https://doi.org/10.29187/2458-973X.1187 2458-973X/© 2025 Published by Yıldız Technical University Press, İstanbul, Türkiye. This is an open access article under the CC BY-NC 4.0 Licence (https://creativecommons.org/licenses/by-nc/4.0/).
JOURNAL OF SUSTAINABLE CONSTRUCTION MATERIALS AND TECHNOLOGIES 2025;10:203–212
The systems do not adapt to current traffic in real-time, so they have long queues of cars, heavy pollution, and inefficiency. This research addresses this by introducing a lowcost, scalable, and urban area-specific Raspberry Pibased real-time adaptive traffic light controller with budgetary and infrastructural constraints. We differentiate ourselves from previous works by embracing the following: ➢ IR and ultrasonic sensor fusion ➢ Green light extension based on queue length; ➢ Pseudo-coded Python logic for transparency; ➢ Coupling with day/night cycle and error handling. Traffic problems in urban areas, especially in Kosovo, are highlighted regarding sustainable mobility. As a result, time delays and conflicts between specific directions of movement become the source of many other problems that negatively affect the quality of life in urban areas [1–4]. In many cases, the solutions implemented by the responsible entities do not meet the real demands for movement in urban areas and do not provide an offer harmonized with the real demand. In the conventional traffic control approach, traffic at an intersection is regulated by signs or signaling other traffic signals. Vehicles are often forced to stand still and make frequent stops, thus limiting the total capacity of the intersection. The forms of traffic control at intersections are usually inadequate and exceed the capacity to meet the movement demands. In these conditions, road users face long delays in motorized traffic and other safetyrelated issues [1, 2, 5–7, 22, 27]. The main goal of the research is to apply the appropriate methodology, namely the appropriate programming language for programming the Raspberry Pi microcontroller, through which the improvement of traffic operation indicators at intersections will be achieved. Other objectives within the framework of this research include: • Intelligent traffic control based on real demand for movement (as an innovative solution). • Functionalize the prototype for traffic control using appropriate sensors and the “Raspberry Pi” controller. • Effective traffic management through “Smart” techniques. The research questions that the research project should answer are as follows: • Research Question 1: How can traffic be controlled through sensors and the Raspberry Pi controller?
• Research Question 2: What is the methodological approach for programming with the controller for traffic control purposes? • Research Question 3: What impact can the implementation of sensors and the Raspberry Pi controller have on improving urban mobility?
Various researchers, through their studies, have addressed the traffic problems that the whole world is facing due to the high concentration in urban centers and the high mobility of people in these areas, recommending that the need for the use of intelligent, automatic traffic control systems in real-time be increased [7, 8]. Improving the quality of traffic operations and improving safety are among the essential objectives and targets of many countries that face traffic problems similar to Kosovo [9–12]. Statistics from previous research conducted by the Fatal Accident Reporting System suggest that about 40% of all accidents occur near intersections, and about 22% of accident deaths are intersection-related [13, 22]. The research results by many authors prove the importance of using the traffic light management system at intersections through remote intelligent systems or smart cameras. According to these authors, directly in those moments when we have a change in the density of vehicle traffic at the intersection, using intelligent systems or a Raspberry PI microcontroller, different functional algorithms can be used with two working modes: day and night mode [14–19]. Amid the persistent tension between socioeconomic progress and environmental conservation, concepts like sustainable development, the circular economy, and smart growth have become central themes in today’s environmental discussions [26]. Other research proves the environmental benefits of smart traffic management, in which case, referring to the total values obtained from the study (Smart traffic light to reduce CO2) over a year, through smart traffic signal systems, vehicles emit 136t less carbon dioxide, and waiting times are shortened [6, 20]. Operational performance at signalized intersections can be significantly improved by optimizing phasing and signaling plans using intelligent traffic control methods [21, 22]. All advancements in transportation occur naturally. These advancements are not confined solely to technological innovations, nor are they limited to technological progress in general [25]. Sensor technology and data analytics improvements have also opened up new possibilities for real-time monitoring and predictive capabilities [28].
JOURNAL OF SUSTAINABLE CONSTRUCTION MATERIALS AND TECHNOLOGIES 2025;10:203–212
2. Methodological approach for automatic
control and traffic management through smart techniques The research was developed to solve the congestion problems at intersections and to utilize the space better, thereby reducing overall traffic delays as a primary effect, pollution, increasing safety, and improving quality of life as secondary effects. To achieve this goal, we have created a prototype of managing an intersection with light signaling through automatic control. Initially, several different forms of control were considered, and then the form we considered the most appropriate was chosen. The most frequent problems that affect the irrational use of intersection spaces were analyzed, and a plan for their management was created, which will be explained below. The intersection was considered to be the one
with four entrances and exits since it has more problems that need to be addressed than other, simpler intersections. Also, this represents the most frequent shape of intersections we encounter in everyday life (Fig. 1). We have used a prototype to show the functional principle of traffic control and management concretely. A “+” shaped intersection and traffic lights have been built, providing the priority of passage and the duration of traffic light times based on the prepared and implemented algorithm. Traffic management, respectively, the control of traffic light times, has been carried out based on real data obtained from sensors, which were then processed in the program applied to the Raspberry Pi microcontroller. Various devices have been used to build the prototype, such as:
JOURNAL OF SUSTAINABLE CONSTRUCTION MATERIALS AND TECHNOLOGIES 2025;10:203–212
Programming and selecting the most appropriate algorithm to provide the most effective traffic control solutions at intersections is enabled through the Python programming language. A four-way intersection was simulated with a Raspberry Pi controlling sensor input and light timing. Every entry point had a single IR sensor for detecting presence and an ultrasonic sensor for detecting queue length.
3. Functional prototype construction for
traffic control The functional prototype was constructed to test the proposed functional solution and the implemented algorithmic model. Through the application of this model, traffic quality indicators are significantly improved, including the level of recovery and the
reduction of unnecessary time delays through the adaptation of the program applied to control traffic lights according to real traffic requirements. The working principle of the microcontroller and its connection to sensors and traffic lights are presented in the diagram below. Initially, the connection scheme of the necessary techniques in the functional prototype was prepared, and then the prototype was built and functionalized for intelligent traffic control using advanced “SMART” techniques. The functional prototype offers real solutions, and during the application, it can adjust traffic light intervals depending on the number of vehicles circulating on the entrance branches of the intersection. In the construction of the prototype, four IR sensors were used, one sensor at each entrance of the branches of the intersection. These sensors are connected to the microcontroller, where they send
Fig. 2. Connection scheme of the technical elements of the prototype.
JOURNAL OF SUSTAINABLE CONSTRUCTION MATERIALS AND TECHNOLOGIES 2025;10:203–212
the information they collect. Their presence in each branch is related to their role in understanding the presence of vehicles in front of them, an essential procedure for starting the cycle we apply in case we have a load on one branch and not the others. Through it, we also understand the arrival times of the vehicles, data that serves us to determine which branch the green line opens first. Since the information received from this sensor is about the presence of vehicles waiting to connect to the intersection, and the place where these vehicles wait to pass is in the entrance part near the intersection, the position of the sensor should also be in this area. Compared to Santos et al. (2023) and Ramazani et al. (2023), our system introduces [23, 24]: ➢ Two-sensor input for time control dependent on queues; ➢ Cost-effective hardware implementation verified under laboratory conditions; ➢ Simulated day/night logic to minimize red-time off-peak hours. In addition to IR sensors, which play a significant role in receiving information about vehicles moving at the intersection, their combination with “Ultrasonic” sensors allows us to have information about the length of the queues of vehicles waiting to enter the intersection. This data is needed to adjust the time, namely the green intervals at the traffic lights according to the branches at the intersection [20]. Their role is related to the controller’s algorithm’s programming function. After the microcontroller receives information about vehicles waiting in front of the intersection, it needs to receive information about the number of vehicles waiting to determine the increase in the duration of the green time.
4. Functionalization of the prototype and
traffic control Based on the abovementioned concept, the intersection prototype’s functionalization shows the control system’s implementation and operation. In this system, vehicles arriving first at the intersection are detected by infrared (IR) red-beam sensors, and priority is given to these vehicles by activating the green light for their lane. During the green phase, ultrasonic sensors measure the distance of vehicles within their coverage area to assess the possibility of extending the duration of the green light. Suppose the sensors detect longer distances (indicating queues). In that case, the green phase can be extended by 40 to 50 seconds (up to a predefined maximum limit) to allow more vehicles to pass through the intersection. Conversely, the microcontroller does not extend the green light duration if the ultrasonic sensors measure very short distances (indicating no significant queue). Instead, it transitions to the next phase, operating the traffic signal cycles with the minimum red interval time. Fig. 4 illustrates the prototype platform that was built and functionalized. The traffic signal operations are managed through a Raspberry Pi microcontroller with IR and ultrasonic sensors. The program executed on the microcontroller integrates detecting IR red light sensors and measuring distances via ultrasonic sensors (displayed in centimeters). This functionality is demonstrated in Fig. 5. The system executed a Python program that dynamically changed signal timing. For instance, if an ultrasonic sensor detected >100 cm of queued cars, the green phase was prolonged by 40–50 seconds. The flow chart for the algorithm is presented in the new
JOURNAL OF SUSTAINABLE CONSTRUCTION MATERIALS AND TECHNOLOGIES 2025;10:203–212
Fig. 4. Traffic light control by microcontroller, in principle, works for real traffic demand.
Fig. 5. Implementing the algorithm using the Python programming language.
Fig. 6. Pseudocode (commented) defines GPIO pin configuration, pulse timing, and exception handling. The results of the functionalized prototype, designed as a model for controlling the traffic light
system, clearly showcase its effectiveness in minimizing unnecessary waiting times at the intersection when there are no movement requests on specific branches.
JOURNAL OF SUSTAINABLE CONSTRUCTION MATERIALS AND TECHNOLOGIES 2025;10:203–212
pins[i],OUTPUT] »∀i ∈ [0,num_parts – 1], setup(ultrasonic_echo_ pins[i],INPUT] Function Definitions: Set Traffic Lights: Set_traffic_lights (part, red, yellow, green)
output(red_pins[part],red) output(yellow_pins[part],yellow) =⇒ output(green_pins[part],green) Ultrasonic Distance: Ul_distance(part)=⇒
output(Ul_trigger_pins[part], True) delay(0.00001) output(Ul_trigger_pins[part], False) pulse_start = time() pulse_end = time() while(input(Ul_echo_pins[part]) = 0 pulse_start = time() while(input( Ul_echo_pins[part]) = 1 pulse_end = time() pulse_duration = pulse_end – pulse_start distance = pulse_duration × 100 return distance
The mathematical representation of the implemented pseudo-code is provided below. Initialization: » Num_parts = 4 » red_pins = [17, 5, 19, 12] » yellow_pins = [27, 6, 26, 16] » green_pins = [22, 13, 21, 20] » ir_sensor_pins = [18, 23, 24, 25] » ultrasonic_trigger_pins = [7, 8, 9, 10] » ultrasonic_echo_pins = [11, 14, 15, 4] » distance_threshold = 10 cm Set up GPIO: »∀i ∈ [0,num_parts – 1], setup(red_pins[i],OUTPUT] »∀i ∈ [0,num_parts – 1], setup(yellow_pins[i], OUTPUT] »∀i ∈ [0,num_parts – 1], setup(green_pins[i], OUTPUT] »∀i ∈ [0,num_parts – 1], setup(ir_pins[i],INPUT] »∀i ∈ [0,num_parts – 1], setup(ultrasonic_trigger_
Main Loop: While True=⇒ ∀part ∈ [0, num_parts – 1] if (input( ir_sensor_pins[part]) = HIGH) print(“VehicledetectedbyIRsensorinPart”, part) set_traffic_lights(part,0,0,1) delay(5) continue distance = Ul_distance(part) print(“Distance (Part ”,part,“):”, distance,“cm”) if (distance < distance_threshold) set_traffic_lights(part,0,0,1) delay(5) else set_traffic_lights(part,1,0,0) delay(2) set_traffic_lights(part,0,1,0) delay(2) set_traffic_lights(part,0,0,1) delay(5) Exception Handling: exceptKeyboardInterrupt =⇒ {cleanup() Fig. 8 shows error bars for variance across 10 cycles of testing. Statistical significance was tested (p < 0.05) using a two-sample t-test.
JOURNAL OF SUSTAINABLE CONSTRUCTION MATERIALS AND TECHNOLOGIES 2025;10:203–212
Fig. 7. Testing the functioning of the built system according to several scenarios.
JOURNAL OF SUSTAINABLE CONSTRUCTION MATERIALS AND TECHNOLOGIES 2025;10:203–212
➢ Average delay reduced from 32s (fixed-time) to 9.6s (adaptive); ➢ Peak queue length: 14 vehicles (fixed) vs. five vehicles (adaptive); ➢ The system was tested using simulated densities of 10, 20, and 40 vehicles per branch.
Data availability
The data that support the findings of this study are available from the corresponding author upon reasonable request.
Funding
Testing various scenarios based on the functionalized algorithm, applied to the prototype designed for traffic light control and efficient traffic management (aligned with real-time movement demands), reveals a highly rational utilization of traffic time across intersection branches and significantly reduced delays. The results demonstrate that the management plan, employing automated control and “smart” techniques, is approximately 50% more effective under average traffic loads. Furthermore, it reduces unnecessary waiting times by over 70% during low-load conditions, such as nighttime traffic, when movement demands from certain branches are minimal. This approach enables more efficient use of the green interval and minimizes the red interval for branches with low demand for movements at the intersection. It also shortens waiting queues by dynamically adapting signals to real-time demand, facilitated through communication between sensors and the Raspberry Pi microcontroller. Consequently, vehicles avoid unnecessary waiting when no movement requests from other intersection branches exist. Other benefits include improved safety, which results from precise phase planning and adaptation to real movement demands from each branch of the intersection. Better traffic performance metrics about intersection capacity and service level result from improved traffic operations quality at the intersection. The method helps safeguard the environment by preventing unnecessary crossing waits drastically lowering dangerous emissions. Reducing red time and junction lines, minimizing the time to 5–7 seconds per phase within the cycle (when there is no demand for movement) directly helps to lessen environmental damage since cars that linger at red lights release more pollutants such as carbon dioxide, nitrogen oxide, carbon monoxide, and hydrocarbons.
Conflicts of interest
The authors of this research paper declare no conflict of interest.
3. Arthi R, Gayathri P, Kavya Sree JS, HemaPriya K. Design and
Implementation of Real Time Traffic Light System. International Research Journal of Engineering and Technology (IRJET). 2020.
4. Hoxha G, Fandaj A, Bajrami X. Quality of Automatic Traffic
Volume Counting by Cameras and Impact on the Qualitative Indicators of Traffic. Infrastructures. 2023;8(3):44. doi:10. 3390/infrastructures8030044. 5. Chuang C-H, Lee C-C, Lo J-H, Fan K-C. Traffic Light Detection by Integrating Feature Fusion and Attention Mechanism. MDPI. doi:10.3390/electronics12173727.
6. Santos O, Riberio F, Metrôlho J, Dionisio R. Using Smart
Traffic Lights to Reduce CO2 Emissions and Improve Traffic Flow at Intersections: Simulation of an Intersection in a Small Portuguese City. MDPI. 2023. doi:10.3390/asi7010003.
JOURNAL OF SUSTAINABLE CONSTRUCTION MATERIALS AND TECHNOLOGIES 2025;10:203–212
7. Mortazavi Azad SM, Ramazani A. Smart control of traffic
lights based on traffic density in the multi-intersection network by using Q learning. Springer Link, 2023. doi:10.1007/ s44163-023-00087-z.
8. Tung NT, et al. Development and implementation of smart
street lighting system based on Lora technology. 2019 International Symposium on Electrical and Electronics Engineering (ISEE). IEEE. 2019. doi:10.1109/ISEE2.2019.8921028.
9. Kitelsson and associates, inc, Traffic Signal Timing Manual,
US. Departament of transportation. Federal Highway Administration. 2008:274.
11. Hoxha G, Shala A, Likaj R, Bajrami XH. Mathematical Model
for Velocity Calculation of Three Types of Vehicles in the Case of Pedestrian Crash. Strojnícky časopis-Journal of Mechanical Engineering. 2018;68(3):95–110. doi:10.2478/scjme-20180029.
12. Hoxha G, Shala A, Likaj R. Vehicle speed determination in
case of road accident was done using a software method and comparing the results with the mathematical model. Strojnícky časopis-Journal of Mechanical Engineering. 2017;67(2):51–60. doi:10.1515/scjme-2017-0017.
13. Hoxha G, Shala A, Likaj R. Pedestrian crash model for vehicle
speed calculation at road accident. International Journal of Civil Engineering and Technology. 2017;8(9):1093–9.
14. Basil E, Sawant SD. IoT based traffic light control system using
Raspberry Pi. 2017 International Conference on Energy, Communication, Data Analytics and Soft Computing (ICECDS). IEEE. 2017. doi:10.1109/ICECDS.2017.8389604. 15. Díaz N, Guerra J, Nicola J. Smart traffic light control system. 2018 IEEE Third Ecuador Technical Chapters Meeting (ETCM). IEEE. 2018. doi:10.1109/ETCM.2018.8580282. 16. Eom M, Kim B-I. The traffic signal control problem for intersections: a review. European Research Transport Review. 2020:20. doi:10.1186/s12544-020-00440-8.
17. Howlader SN, Khanom S, Hossain MM, Sarker S, Mohammad
N, Sarker MM. Real-Time Traffic Control Using IoT Nodes Based on Traffic Density Information. In 2024 3rd International Conference on Sentiment Analysis and Deep Learning (ICSADL). IEEE. 2024. p. 618–24.
18. Rath M. Smart traffic management system for traffic control
using automated mechanical and electronic devices. In IOP Conference Series: Materials Science and Engineering, 2018, June. 377(1): p. 012201. IOP Publishing doi:10.1088/1757899X/377/1/012201.
19. Aleko DR, Djahel S. An efficient adaptive traffic light control
system for urban road traffic congestion reduction in smart cities. Information. 2020;11(2):119.
20. Santos O, Ribeiro F, Metrôlho J, Dionísio R. Using Smart
Traffic Lights to Reduce CO2 Emissions and Improve Traffic Flow at Intersections: Simulation of an Intersection in a Small Portuguese City. Applied System Innovation. 2023;7(1):3. doi:10.3390/asi7010003.
22. Jamal A, Rahman MT, Al-Ahmadi HM, Ullah I, Zahid M.
Intelligent Intersection Control for Delay Optimization: Using Meta-Heuristic Search Algorithms. 2020:23. doi:10.3390/ su12051896.
23. Santos O, et al. Using Smart Traffic Lights to Reduce CO2
Emissions. ASI. 2023;7(1):3. doi:10.3390/asi7010003. 24. Ramazani A, et al. Smart control of traffic lights using Q-learning. Springer. 2023. doi:10.1007/s44163-02300087-z. 25. Vardar T, Altan MF, Naimi S. Economic and technological evaluation of transportation system, new trends. Journal of Sustainable Construction Materials and Technologies. 2017;2(1):83–8. doi:10.29187/jscmt.2018.11.
26. Siddiqui AR, Khan R, Akhtar MN. Sustainable concrete
solutions for green infrastructure development: A review. Journal of Sustainable Construction Materials and Technologies. 2025;10(1):108–41. doi:10.47481/jscmt. 1667793.
27. Doğru Z, Altan MF. Evaluation of Urban Transport with
International Examples. Journal of Sustainable Construction Materials and Technologies. 2017;2(2). doi:10.29187/jscmt. 2018.17.
28. Salama T, Voghel D. Sustainability evaluation of highway sign
support by field testing and finite element analysis. Journal of Sustainable Construction Materials and Technologies. 9(4). doi:10.47481/jscmt.1607459.
Share and Cite
Hoxha, G.; Gorzelanczyk, P.; Likaj, R.; Thaqi, S.; Cikaqi, A.F. Smart Traffic Management at Intersections. Journal of Sustainable Construction Materials and Technologies 2025, Vol. 10, pp. 5. https://doi.org/10.29187/2458-973X.1187

