Design, Modelling, and Implementation of a Fuzzy Controller for an Intelligent Road Signaling System

Crossing points are not always 100% visible for drivers due to different factors (e.g., poor road maintenance, occlusion of vertical signs, and adverse weather conditions). USA estimated in 2015 the number of traffic accidents involving pedestrians and vehicles in 70,000 of whom 5,376 resulted in deceased people. To contribute in this field, this paper presents the design, implementation, and testing of a smart prototype system applied to pedestrian crossings—not regulated by semaphores—which try to reduce the accident rate on roads.The hardware and software system consists of a set of autonomous, intelligent, and wireless low-cost devices that generate a visual warning barrier perceived by drivers from a suitable distance when pedestrians traverse a crosswalk. In this way, drivers can reduce the speed of their vehicles and stop safely. The system’s intelligence is carried out by a fuzzy controller that performs sensory fusion at both low level and high level with various types of sensors from local and neighboring devices. The tests conducted have determined an average success of 94.64% and a precision of 100%, thus corresponding with a very good test according to a ROC analysis. As a result, the system proposed has been patented and extended to international PCT.


Introduction
According to a recent report published by Goodyear and RACE (acronym for Real Automobile Club of Spain), around 10,000 accidents of pedestrians occur every year in Spain of whom 9,289 happened in urban areas, 222 resulted in death, and 2/3 were attributed to drivers [1]. Other studies also estimate 40% of the accidents when pedestrians are crossing through the right place [2]. According to a barometer from CIS-a Spanish sociological investigation center-the main causes of the accidents are mistakes and distractions of drivers (8.25%), lack of civic education (7.87%), poor road conditions (6.80%), and deficient signaling in some tracks (6.58%), among others [3]. A similar study published in USA estimated in 70,000 the number of traffic accidents in 2015 with pedestrians and vehicles involved. Of them, 5,376 resulted in deceased people, which has significantly increased in the last decade up to 15% according to the National Highway Traffic Safety Administration [4]. Its study determined that 78% of the accidents occur in low visibility conditions, resulting in 74% at nighttime and 4% during the sunrise or sunset. Thus, pedestrian crossings are not always 100% visible due to different factors: (i) poor road maintenance (e.g., blurring lines due to the vehicle passing), (ii) occlusion of vertical signs (vegetation, large vehicles, etc.), and (iii) adverse weather conditions (e.g., rain, fog, or obscurity), among others. The distance at which drivers begin to brake the vehicle is decisive in the severity of the accident and the prevention of it. Hence, to improve the perception of drivers upon pedestrians is a key goal whether accidents or the severity of injures in zebra crossings needs to be reduced [5,6].
There are different solutions in the state of the art with the common aim of decreasing the number of accidents in crosswalks. They are classified into devices on board vehicles to detect pedestrians and approaches located on the road to detect both pedestrians and vehicles.
Regarding the first group, techniques and devices being included in vehicles aim to actively detect pedestrians to alert drivers. Such is the case of a prototype based on RADAR, 2 Complexity camera, and sensory fusion devised to warn of possible collisions [7]. This system is similar to that of cameras, sensors on windshields, and bumpers that other proposals such as Ford Mondeo, Mercedes S Class, or Nissan from the UC3M (Universidad Carlos III de Madrid) implement on cars [8,9]. However, these systems require the collaboration of the automotive industry to standardize and implement electronics on board. Moreover, these approaches represent personal devices not available to all users. That is, the system belongs to the car's owner and it is not permanently available on public roads to all users. In relation to the second group, very different concepts exit as for the type of installation, size, and price. For instance, a road sign formed by a luminous marquee over a pedestrian crossing that incorporates spotlights oriented towards the pavement to improve the driver's visualization on pedestrians [10]; a trapezoidal speed bump placed on the road composed of passive lighting such as small light bulbs, LEDs (lightemitting diode), or optical fiber [11]; a section elevated above the track level like a trapezoidal highlight, where the road sign is made of electroluminous diodes activated by the pedestrian presence in zones of pressure placed at the access [12]; the control of traffic lights by means of the activation by weight of a tile placed on the sidewalk [13]; a horizontal road signaling system for crosswalks consisting of long-range and short-range optical sensors on a vertical support to detect pedestrians and vehicles [14]; a system with photoelectric emitters/receivers placed on the sidewalk to detect pedestrians that activates luminous devices located both in the periphery of the crosswalk and vertically on the sidewalk [15]; a proposal of super-safe smart crosswalk that detects persons at the entrance and exit of the pedestrian crossing and projects a virtual light barrier to warn drivers [16]; an embedded system on the sidewalk that carries a camera in charge of taking images of the pedestrian crossing to visually warn drivers when people is traversing [17]; a Japanese system implemented by Philips that warns pedestrians about the proximity of electrical silent vehicles near crosswalks [18]; a device that protects zebra crossings through warning lights placed on the sidewalk, which contains presence sensors for pedestrians and vehicles [19]; and a crosswalk alert system based on a mast over the sidewalk which includes intermittent lights, solar cells, and wireless communication as a means of synchronizing the signaling with the opposite mast and where the trigger is a mechanical switch operated by the pedestrians [20].
The solution proposed in this paper is classified into the second group presented in the state of the art, that is, experimental systems placed on the road that detect both pedestrians and vehicles. Despite the variety of proposals found in the literature about this, they have not been widely deployed in our cities yet. The main reason is the high cost of some approaches requiring a fixed installation on the road pavement or the need for large supporting structures over the sidewalk. Our proposed system comprises a set of smart sensor devices with capability to alert drivers. The action performed consists in differentiating if there are people traversing the zebra crossing, then communicating that situation to the rest of the system nodes, and turning on synchronously the signaling as a visual barrier to alert drivers in order to safely stop their vehicles.
In summary, Table 1 compares the main features of some representative proposals in the state of the art in relation to our solution. The proposed system has several innovative features: (1) low-cost installation since it does not require public works; (2) minimum impact on traffic and users due to its small size; (3) autonomy since it does not require an electrical wiring infrastructure; and (4) intelligent control since it interacts with the environment.
Since the system is based on modular devices acting autonomously, this allows us to adapt the number of nodes depending on the crosswalk topology (one-way route, twoway route, multilane route, etc.). This in turn constitutes another advantage because if a node stays out of service, the rest of the system can keep on operating. Another interesting aspect is its low cost compared with other existing proposals, being an advantage for the final real deployment in urban environments. The system neither needs expensive installation in roads nor mobilizes large machines to do electrical wiring ditches. The size of the system modules is small, being placed on the road directly. Neither big luminous panels nor infrastructures placed in the road or sidewalks are necessary,  Figure 1: General depiction of the smart road signaling system. thus presenting a minimal impact on users. Moreover, it is not necessary to connect the system to the power grid, thus obtaining energetic and economical savings. Nevertheless, the proposed system presents some disadvantages regarding the other solutions mentioned as it can be the autonomy beyond ∼30 hours at full capacity. Finally, devices can get dirty by the vehicle transits and then loose energy-gathering capacity by being formed by solar cells. This paper aims at the following significant contributions: (1) design, implement, and prove the feasibility of an autonomous smart system able to actively interact with the environment to detect pedestrians on zebra crossings; (2) generate an innovative way of light signaling to prevent drivers from pedestrians traversing roads; (3) quantitatively measure and analyze the system impact on the improvement of the road safety. Thus, this manuscript is structured as follows: Section 2 describes the general system, hardware elements, and modelling software designed for doing sensory fusion. Section 3 shows the experiments carried out and the results. Finally, Section 4 presents the findings as well as the future works of the proposed system.

Smart Road Signaling System
Based on the goals, the intelligent road signaling system consists of a variable number of devices which has been patented and extended through an international cooperation treaty to ARIPO (African Regional Intellectual Property Organization), OAPI (Organisation Africaine de la Propriété Intellectuelle), Eurasia, and Europe [21]. The devices aforesaid are arranged on longitudinal form around the crosswalk limits-depending on the lane topology-until covering the total road width and separated several centimeters between them so that each one covers a sector ( Figure 1). Hence, when a pedestrian is detected by a device, the system is wirelessly synchronized to generate a visual intermittent signal which creates the sensation of a visual barrier over the road. This is caught by drivers and perceived as a warning light signal.

Hardware Description.
The system is based on small autonomous devices that comprises a control unit, detection unit, signaling unit, power unit, real-time unit, and data storage unit ( Figure 2). A transducer for the pedestrian detection is oriented towards the interior of the crosswalk while another transducer for the vehicle detection and the signaling unit is oriented towards the traffic flow. The cost of the prototype including the electronics and housing is about 1225€ per device, which maintains the advantage over other higher cost solutions.

Control Unit.
The prototype is based on a 32-bit RISC (reduced instruction set computing) microcontroller (80 MHz, 1-MB RAM) with integrated wireless module including the IEEE 802.11 b/g/n/d/e/i/k/r standards [22]. Its function is to manage the electronics within the same node, process both the internal and external data, and provide intelligence to the overall system. To this end, the developed prototype utilizes proximity sensors that provide measurements proportional to distance unlike the presence sensors used in other road signaling approaches that only deliver binary signs of type "all/nothing." This feature allowed us to perform analyses on object proximity over time, which offers a major operation capability in contrast to conventional presence sensors that only determine if an obstacle exists or not. As main benefit, this lets us to immerse the detection sensors within the road along the pedestrian crossing (i.e., the sensors are not located in the sidewalks as for the most approaches in the state of the art).
The intelligence is supported by operating rules based on fuzzy logic-which helps to decrease the number of false positives [23]-and other coordinated techniques [24] that process the information of the internal sensors of the same device and from other neighboring devices. This strategy allows improving the system accuracy and discerning between vehicles and people to generate visible signs only when objects are pedestrians and not vehicles. Furthermore, the nodes are connected through a WLAN (wireless local  area network) with RF (radio frequency) technology whose function is to synchronize the devices' visual signposting through the system.

Detection Unit.
Three sensors based on ultrasound, magnetic field variation, and RADAR were used in order to sense different objects around the crosswalks. Each of the sensors is oriented towards the type of object to be detected (i.e., ultrasound to pedestrians, magnetic and RADAR to vehicles). It is thereby possible to detect a pedestrian when entering to the zebra crossing from the entry points at the sidewalks or across any intermediate position from the road (e.g., when walking diagonally). In addition, it is possible to determine if there are vehicles circulating upon the pedestrian crossing.
As an example, when a detection unit perceives a pedestrian approximation, the control unit activates the signaling. On the contrary, when a detection unit identifies a vehicle, the system disables the luminous barrier to avoid false positives. The ultrasound sensor works at 42 KHz and can detect pedestrians at a distance between 0.6 and 5 meters. The magnetic field sensor provides detection in the -, -, and -axes with a sensibility up to ±16 Gauss, being capable of detecting vehicles circulating at 50 Km/h with a resolution in the order of centimeters. Additionally, the RADAR improves the sense of other vehicles that come frontally to the crosswalk from a distance between 10 and 20 meters (e.g., bicycles compounded of materials as aluminum or carbon not detected by the magnetic sensor). To this end, we utilized a Doppler-based RADAR working in the X-band in CW (continuous wave) acquisition mode with EIRP (effective isotropic radiated power) of 15 dBm.

Signaling
Unit. The prototype system includes a set of high brightness LEDs which are visible under both low contrast and high contrast conditions (i.e., during day and night). An array of four LEDs is oriented to drivers to alert the pedestrians' detection while another one is directed oppositely towards the pedestrians to indicate the system activity and facilitate the decision-making before crossing. The selected LEDs produce white cold light (7000 ∘ K) up to 140,000 mCd (4.82 lm) and can be seen from an angle of vision of 12 ∘ ± 6 ∘ . The road signaling presents an intermittent pattern (i.e., activation of 75 ms during 5 s) which is managed by the control unit through a low consumption strategy performed by means of a PWM (pulse-width modulation) control. The frequency has been selected experimentally so that the refreshment of the LEDs is not perceived by the human eye at the same time that it reduces the system consumption.

Power Unit.
The supply of the system consists of a matrix of 12 solar panels of monocrystalline Silicon of 92 × 54 × 3 mm 3 with maximum power of 15 W, a rechargeable Li-Po (Lithium polymer battery) of 9000 mAh (3.7 V, 1 C) with autonomy up to 29.89 hours, and a smart charger circuit with PPM (power path management). This allows supporting 25.52 Wh/day or energy consumed in a day by the system without getting any additional energy. To size the power supply unit, we used the latitude of Huelva (37.2583N, −6.9508W) during December as the period of minor daily solar insolation (2.12 kWh/m 2 /d)-or energy produced by the Sun in one m 2 per day-and a solar cell performance of 75% as reference. See Table 2 for further details.
In order to increase the autonomy of the system, a strategy to reduce the power consumption depending on the hour of the day was implemented. For it, a study carried out by means of Google6 Maps allowed us to know the time of the major pedestrians' attendance taking several ROIs (region of interest) of the city as reference (e.g., shopping centers and the historic city center). It was determined that the hours with major agglomeration of people were mainly distributed in the time slots between 12-14 hours and 18-20 hours. In addition, it gave us an idea of the hourly intervals of highest danger for pedestrians. Accordingly, in Figure 3, "Activated"  (blue label) indicates the estimated percentage of the hourly section in which pedestrian crossings are utilized by people, while "No Activated" (red label) means the percentage in which the pedestrian crossings are not utilized by people. The whole strategy consisted in fitting the LED lighting and the reading frequency of the system's transducers based on the pedestrian attendance and battery charge level. This allows increasing the battery life up to 5.8% in average. Although not significant, the electrical consumption has been one of the major challenges in this project.

Additional Units.
To take a count of the operations carried out by the system such as the pedestrian detection, errors in units, and operating parameters, each device incorporates a data storage unit and a real-time clock unit. The storage electronics comprises an external solid state memory (i.e., 8-GB microSD card) that allows extending the storage capacity to implement a local database in each device. This database stores all the events that happen both in the surrounding environment and in the inner device for further analysis. To this end, the real-time unit provides a date and hourly stamp for all the actions carried out by a device.

Wireless Communication.
The wireless communication unit is entrusted to transfer data between the system's nodes within the WLAN. One of the devices has the role of AP (access point), whose function is to manage and control the network operation. The rest of the devices work as clients such that when one of them detects an object, a broadcast message is sent towards the rest of the nodes in the WLAN.
The PHY (physical) layer has been implemented within the microwave band at 2.4 GHz, the MAC (media access control) layer utilizes the IEEE 802.11n standard at 300 Mbps with optional WPA/WPA2 (Wi-Fi protected access) encryption [25], the network layer uses unicast and broadcast IPv4 (Internet Protocol version 4) addresses, the transport layer has been implemented with UDP (user datagram protocol) since it accelerates the message delivery with regard to TCP (transmission control protocol) by dispensing with ACK (acknowledgment) messages as discussed in [26], and the application layer is based on the M3 (Machine-to-Machine Measurement) framework to exchange structured information between nodes [27,28]. This standard declares semantic rules that help to identify clearly the source of a message, what fields it contains, the values of the fields, and its units.

2.1.7.
Placement of the Device. The prototype's housing has been constructed with a CNC (computer numerical control) machine that protects the inner electronics ( Figure 4). The case is arranged in a matrix of 4 × 3 high quality tempered glasses (10H hardness, transmittance of 88-92%) with enough thickness to support the weight of the vehicles up to 8.16 ⋅ 10 6 N/m 2 in compression and preventing the solar panels' surface from being damaged. The complete structure fulfills the IP67 standard of protection against dust and liquids. It has been fixed on the road by means of bituminous adherent (e.g., warm tar), epoxy glue (i.e., thermostable polymer hardened by a catalyst agent), or mechanical anchorage by means of screws (e.g., wall plug and lag screw). The housing does not need public works for its installation on the road. Moreover, it is reusable when a reasphalting of the road surface is required. The shape of the case presents a nonslipping knurling texture to avoid falls of pedestrians or bicycles, as well as a trapezoidal profile with

Fuzzy
Model. The device's intelligence consists of a sensory fusion process of association, correlation, and combination of information based on fuzzy logic. Specifically, we have used the three-level abstraction model of Dasarathy [30] to combine sensor measurements and high-level decisions (e.g., if a pedestrian exists or not upon the crosswalk). The measurements are fused in a cooperative way when coming from different sensors within the same device (i.e., ultrasound, RADAR, and magnetic field) and redundantly when belonging to the same sensor in several neighboring devices.
The model implemented is based on a Mamdani fuzzy controller with linguistic rules such as "If X1 is A1 and . . . and Xn is An, Then Y is B" in which both antecedents and consequents are labels and rules obtained with an expert system [31]. Systems described in [32,33] present an inference system similar to that described in this paper. Considering the number of tags ( ) and input variables ( ) to use, the complexity is raised to ( ). Since the system has a high number of inputs and tags, a hierarchical structure with several controllers was designed to keep the rules in a number easily manageable by the expert. The membership of a fuzzy set is defined by trapezoidal functions-as they adequately model the system behavior and are not computationally complex-where the conjunction and implication operators use the minimum T-norm [34]. Moreover, the defuzzification process uses the FITA method (i.e., First Inter, Then Aggregate) since it is more consistent than FATI [35] and the MVP (Maximum Value Point) weighting method, also called weighted average method [36].
The system's sensory fusion has been modelled through the Fuzzy Logic Toolbox6 from Matlab5 ( Figure 5). This implementation is similar to that described in [37]. The "Ultrasound Controller" block manages the fusion of the ultrasound sensors from the local device and the remote ones at the neighboring nodes; its output indicates whether an obstacle exists on the pedestrian crossing. The "Magnetic Controller" is in charge of fusing the sensors of magnetic field variation and determining vehicles arriving at the zebra crossing; its output updates a temporary variable "T0" useful to control slow traffic or stationary traffic that could generate false positives due to vehicles staying a long period of time over the crosswalk. The "Radar Controller" is entrusted of fusing the RADAR sensors and determining if an object approaching the zebra crossing is vehicle or pedestrian. Finally, the "Sensorial Fusion" block determines whether a pedestrian on the crosswalk exists by fusing the outputs from the previous fuzzy controllers.
To sum up, the signaling unit within a device is activated in case of positive detection (i.e., a pedestrian) and the whole system is synchronized by a broadcast message sent over the network to activate the nodes' signaling units. When the sensory fusion detects a vehicle, through either the magnetic sensor or the RADAR, an inhibition message is sent to avoid false positives. As an example, a number of cases with pedestrians and vehicles-either circulating, stopped, or parked-interacting around a crosswalk is shown ( Figure 6). The system activity, formed by several nodes, is depicted at the bottom of the zebra crossings. The devices are colored in green when an object is detected on the pedestrian crossing by the ultrasound sensor, in blue when detected by the magnetic sensor, in red when detected by both the magnetic sensor and the RADAR, and in black when there is no presence of pedestrian or vehicle.
The various scenarios consist of a crosswalk without any agent (Case 0), a pedestrian entering and walking through the crosswalk (Cases 1 and 2), a vehicle navigating along the road (Case 3), a vehicle approaching the zebra crossing while a pedestrian begins to cross (Case 4), a vehicle approaching the crosswalk when a pedestrian is crossing (Case 5), a vehicle stopping or parking (Case 6), a vehicle stopping when a pedestrian begins to cross (Case 7), a pedestrian crossing and a vehicle stopping near the crosswalk (Case 8), and a vehicle detected by the magnetic and ultrasound sensors but not detected by the RADAR (Case 9), as well as a vehicle stopping while a pedestrian was crossing (conflictive case). The last example represents the most problematic scenario, which is addressed for the following fuzzy logic.

Ultrasound Fuzzy
Controller. This block utilizes three inputs comprising normalized measurements from the ultrasound sensors at the local, right, and/or left nodes. The normalization allows using more than one transducer with different radiation patterns to adapt the azimuthal and horizontal range based on the device's position regarding

SID A A A A A WA WA A EWA A A A WA A A A WA A WA WA A A A A WA A A A A A WA A WA A A A A A A A
WA WA A WA WA WA WA WA WA WA W W W W W W W W W W LK K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K   the way (e.g., in the middle of the crosswalk or close to the sidewalk). The behavior of the ultrasound sensor versus temporary samples can be observed in Figure 7. Each input has three tags meaning the distance of the obstacle in front of the sensor, being Far, Medium, and Near ( Figure 8). The Far tag indicates that the object is not detected or is detected in a ROI external to the crosswalk. The Medium tag means that the object is detected in an uncertainty area or it is not detected with enough precision by the sensor. The Near tag points out an obstacle existing on the zebra crossing that is clearly perceived.
The output of the controller provides values within [0, 1], whose range stands for the grade in which an object exists over the crosswalk expressed by means of two labels (No and Yes). Thus, a value near zero (0) means that an obstacle does not exist while a value close to one (1) indicates that it exists. In that case, it must be inferred by the rest of the fuzzy system whether the object is vehicle or pedestrian to activate the signaling unit.
The rules base and tags of the fuzzy controller were tuned experimentally by an expert system (Table 3). Since an ultrasound sensor typically has a nonlinear response whose error increases due to distance, it was established that three inputs declaring a Far tag after the defuzzification process means no obstacle on the crosswalk. On the contrary, two inputs with the Medium tag or one input with the Near tag signifies the presence of an obstacle.

Magnetic Fuzzy Controller.
This block uses an input per axis ( , , and ) with three labels for each one called Far , NearN , and Near , being ( ) the corresponding axis ( Figure 9). The Far tag stands for the value during the idle state of the magnetic field sensor, while NearN and Near indicate a magnetic field variation below and above the idle state, respectively. This variation is represented versus temporary samples (Figure 10).
The output of the magnetic fuzzy controller has been modelled with two tags ranging from 0 to 1 (No and Yes), where values near zero mean no vehicle close to the zebra crossing and values near one indicate the presence of a vehicle. Similarly, both the rules base and tags of the fuzzy controller were experimentally fitted by the expert system (Table 4). It was determined that a variation of the idle state at least in two of three axes of the magnetic sensor indicates  presence of a vehicle driving around the zebra crossing; otherwise a vehicle does not exist.

Temporary Variable.
The output of the magnetic fuzzy controller has the additional function of updating a counter called "T0" to measure the time elapsed since the sensor did not detect a vehicle, that is, to count the time elapsed since the output of this controller was near zero. This variable is useful to resolve conflictive cases-as that depicted in Figure 6-where it is necessary to know whether a vehicle is sited over the zebra crossing (i.e., constant values close to one). According to this logic, the temporary fuzzy controller was modelled with three tags called Little, Medium, and Much ( Figure 11). The Little tag stands for a small period of time since the magnetic sensor detected the presence of a vehicle, Medium indicates that a certain time has elapsed-but not sufficiently large-since there was a vehicle on the zebra crossing (e.g., stopped), and Much indicates an interval of time large enough since the magnetic sensor detected the presence of a vehicle (i.e., parked).

RADAR Fuzzy
Controller. The inputs defined in this controller block are the State and Speed variables ( Figure 12). The first one stands for a digital output from the RADAR that points out the presence of an object in the FOV (field of view) of the sensor. So, the State tag indicates if there is an object present, where values close to zero (0) specify no object existing (low) and values close to one (1) indicate an object being detected (high). The Speed variable consists of two tags (Minor and Major) to designate values higher and lower than 5 Km/h. This value-experimentally determined ( Figure 13)-stands for a speed threshold above which any detection belongs with certainty to a vehicle (i.e., everything that is not a pedestrian moving on foot).  (1) a Vehicle. The rules base of the fuzzy controller has been made experimentally by the expert system, which determined that an object speed declared as Major with a state designed as High stands for a vehicle (Table 5). In any other case, the object will be potentially a Pedestrian or a Vehicle at low speed, whose nature must be inferred by the rest of the fuzzy system.

Sensory Fusion Controller.
This block is entrusted to fuse all the fuzzy controllers previously described (i.e., ultrasound, magnetic, RADAR, and "T0") whose function is generating an output to control the LED signaling unit. The output values have a range within [0, 1], where values near zero (0) indicate that the signaling unit must not be activated and values near one (1) indicate that the signaling unit must be activated to alert drivers about pedestrians detected on the crosswalk.
The expert system settled that a pedestrian is detected when the output of the ultrasound fuzzy controller indicates Yes, the magnetic fuzzy controller points out No, the "T0" variable indicates the Little or Medium tags, and the output of the RADAR fuzzy controller designates Pedestrian. In Otherwise, the pedestrian warning lighting will be disabled ( Table 6).

Results and Discussion
The experimentation carried out with the prototype system consisted in a total of 240 hours of hardware and software integration, 160 hours of tests in laboratory under controlled conditions, and 65 hours of tests in a real environment. ROC (receiver operating characteristic) analysis, as described in [38], was conducted on the data test achieved from the real scenario to obtain the sensibility against specificity of the system ( Table 7). The performance was obtained from a confusion matrix of 2 × 2 elements that relates positive ( ) and negative ( ) results. In this way, the sensibility or true positive rate (TPR) can be defined as the success rate as follows: where TP stands for the true positives and FN stands for the false negatives. Anyway, the false positive rate (FPR) or where FP means false positives and TN means true negatives. Finally, the accuracy (ACC) can be defined as follows: where and stand for the total positives and negatives, respectively. The tests involved two types of trials: (i) activation of the LED signaling by pedestrians on the zebra crossing and (ii) inhibition of the LED signaling by vehicle traffic on the road. The first trial included the following categories: one pedestrian, two or more pedestrians walking in the same direction, two or more pedestrians walking in opposite directions, a buggy baby, and a bicycle. The second trial included a car, a bicycle, and a motorcycle passing the crosswalk.
To this end, the scenario utilized consisted of a crosswalk sited in "Sector Pp1 Cruz de Montañina" of Bollullos Par del Condado, Huelva, Spain (37.34N, −6.55W). This zebra crossing was selected because it is located on a 180-meter straight track being the speed limited to 30 Km/h ( Figure 14). Three prototypes of smart device were installed to cover a crosswalk of 9 meters wide by 5 meters depth. According to (1)-(3), a positive discrimination threshold was established when the object detection was triggered on the first 2/3 of the crosswalk. In other words, a detection on the last 1/3 of the zebra crossing was considered negative in the tests for not achieving the minimum safety requirements for pedestrians. The detection of persons in the direction of the crosswalk consisted in traversing the zebra crossing in different directions: (i) longitudinal movement from right to left and from left to right, meaning as the movement crossing the road from side to side; (ii) transversal movement from back to front and from front to back, meaning as the movement by which a user can enter the crosswalk through any interior point of it; and (iii) diagonal movement from front to back, from right to left and vice versa, meaning as the oblique movement that a user can make to shorten path.
The tests for detecting the vehicle flow over the crosswalk in the direction of the road consisted in inhibiting the lightning barrier and detecting true negatives with a speed higher than 5 Km/h. Recall that this type of vehicles should not activate the LED lighting by themselves when crossing over the system.
The series of tests attained an average speed of 1.18 ± 0.43 m/s for pedestrians and a speed between 2.22 and 5.55 m/s for vehicles. After the experimentation, an average success of 94.64% and a precision of 100% were obtained. According to the ROC analysis, this corresponds to a very good test with TPR = [0.9, 0.97) and lack of false positives. Specifically analyzing the different case studies (Table 8), we found that the best result was obtained for the detection of vehicles in the road direction, as well as bicycles, buggy babies, and group of pedestrians in the crosswalk direction. On the contrary, we found worse results in both the detection of a person and several people crossing simultaneously in opposite directions. On the one hand, this suggests that the greater the volume of the objects to be detected, the more efficient the intelligent road signaling system (e.g., bicycles or buggy babies versus a person). This is explained due to the collocation of the sensors at the asphalt level, which reduces the effectiveness when detecting low limbs from persons compared to the chest or other parts of the body with major size. On the other hand, the study suggests that bicycles and motorcycles passing the crosswalk are not a trouble for the type of sensors used, both the RADAR and the ultrasound. To sum up, Figure 15 shows a comparative graphic with the case studies addressed and their TPR values.

Conclusions
According to studies, 40% of the accidents in which pedestrians are involved are produced when crossing for the right place. This happens-in part-because crosswalks are not 100% visible for drivers due to different reasons: (i) poor road maintenance, (ii) occlusion of vertical signs, and/or (iii) adverse weather conditions, among others.
To help reduce accidents, this paper proposed a prototype signaling system set on the road that alerts drivers when they are approaching zebra crossings when a pedestrian is traversing. This system, formed by a set of autonomous, intelligent, and low-cost devices, implements an object detection and alerts fuzzy controller that activates luminous signals so that drivers can stop safely.
A study on the state of the art about several patents and commercial solutions-including luminous road markers, speed bumps, and vertical signs-revealed that the main innovative features of the prototype system are the artificial intelligence and low-cost installation. On the one hand, the intelligence allows contradistinguishing whether an obstacle traversing a crosswalk is pedestrian or vehicle, thus interacting actively with the environment. On the other hand, the installation is based on a low-cost fitting that removes the need for public works on the road since the autonomous device includes solar-based rechargeable technology instead of a power grid infrastructure.
The tests conducted to validate the system over a total of 65 hours consisted in (i) detecting different types of users walking over a crosswalk (i.e., individual pedestrians or grouped, buggy babies, and bicycles) and (ii) trying the intelligent discrimination of vehicles to avoid false positives (i.e., cars, bicycles, and motorcycles). An exhaustive ROC analysis with a total of 244 tests provided an average success of 94.64% and a precision of 100%. This suggests a very good test in global terms, while the greater the volume of the object to be detected, the better the detection (e.g., bicycles or buggy babies versus a single person). By way of conclusion, a video with the construction and validation of the prototype is available in the web page of the project at http://www.uhu.es/tomas.mateo/smartcitysen. Future works are focused to improve several technical and functional aspects of the prototype, including size, power consumption, electronics, and code. Regarding the hardware, the energetic deficit supported by the system can be still considered somewhat high. Incorporating elements of lower consumption and/or inducing the control unit to sleep periods without affecting the detection capacity (e.g., modem-sleep, light-slip, or deep-sleep) can reduce the number of PV (photovoltaic) panels at the same time that reduces the case size. Regarding the software, the upgrade to more advanced control techniques would improve the system accuracy and reliability. On the one hand, the object detection would be enhanced by means of pattern analysis and recognition based on FFT (fast Fourier transform) techniques. On the other hand, the implementation of machine learning techniques (e.g., based on genetic algorithms) would automate the calibration of the system variables-and their translation into diffuse linguistic labels to form the knowledge base-regardless of the system installation (i.e., road conditions). Finally, the developed prototype could also be improved by extending its functionalities to enhance the safety of dependent people (e.g., acoustic signaling for blind people).