A Study on the Used of Bluetooth Detectors at a Fix Location for Vehicle Speed Estimation

. Usage of Bluetooth for traffic monitoring has been widely researched and well understood. By placing a Bluetooth detector at each end of a segment of a road; the time difference when a Bluetooth device, traveling in a vehicle through that segment, is observed by these detectors is taken to be the time taken by the vehicle to travel along that known segment. The known distance between the detectors and the time it takes to traverse this distance makes it possible to estimate the average speed of the vehicle along that segment. The possibility of estimating the average speed of vehicles within the radio range of a Bluetooth detector, however, has not be carried out until now. The premise of this research is to determine the time a Bluetooth device takes to traverse through the radio range of a detector and from this estimation of the speed of the vehicle traveling through the radio range of the detector. The usage of multiple detectors at the same point to improve the accuracy of the estimates is also investigated. The results of our experiments and what is need to realise such a system are discussed.


Introduction
The ability to determine and disseminating accurate traffic conditions to road users in a timely manner has many advantages.Technology for traffic monitoring is a widelyresearched topic and are based on technologies ranging from image processing, radio technology such as RFID & Bluetooth to GPS.
A method in image processing is to estimate traffic density through images captured [1].The disadvantages of this method are that image processing involves complex algorithm and extensive computing infrastructure.RFID, on the other hand, involve the use of RFID sensors placed along a road which is used to detect the RFID attached to the vehicle number plate.The vehicle average speed between any 2 detectors is then estimated based on the time it takes to traverse that section of the road [2].The main disadvantage of this method is the need to introduce RFID tagging of vehicles.Ahmad et al. [3] indicated that RFID tags can be linked to personal information and may be a barrier to implementation.Bluetooth, on the other hand, is a technology that has lots of potential in traffic monitoring.Nowadays, devices such as car radio, smart phone, laptop and various other gadgets are Bluetooth enabled.Bluetooth is in many ways no different from RFID with the exemption that they are already available in vehicles traveling along our roads.It is relatively low costs and has low energy consumption.
Current Bluetooth traffic monitoring systems utilise Bluetooth detector placed at each end of a segment of a road.These detectors will intercept the Media Access Control Identity (MAC ID) of the Bluetooth devices in the vehicle and the average speed of the vehicle travelling through this segment of the road is then estimated based on the time difference a MAC ID was detected at these detectors shown in Fig. 1.Current research on traffic monitoring using Bluetooth technology are based on this configuration of having two detectors at each end of a segment of a road.There is, thus far, no study on the potential use of one or more Bluetooth detectors at a fix location for the estimation of vehicle speed within the radio range of the detector(s).An advantage of such a system is the reduction in the time difference between the indicated and the actual traffic.It has the potential to be able to determine the traffic condition at a round-about.

Bluetooth inquiry process
Bluetooth utilises an inquiry process to acquire the MAC ID of other Bluetooth devices within its radio range.During the process, the Bluetooth detector will send an inquiry packet (ID packet) via one of the 32 predefined inquiry channel.Once the vehicle Bluetooth device receive the ID packet, it will send a Frequency Hop Synchronization (FHS) packet back to the detector.Fig. 2. shows the format of a MAC ID [4], [5] consisting of 2, 1 and 3 bytes of non-significant address part (NAP), upper address part (UAP) and lower address part (LAP) respectively.Bluetooth utilises a frequency hopping spread spectrum technology consisting of 79 frequency channels.Of these, 32 are used as inquiry channels, 16 of these in the A train and the remaining 16 in the B train.At two consecutive 312.5s, the Bluetooth detector will send an ID packet to two inquiry channels and listen for incoming reply at the next two consecutive 321.5s.This is repeated 256 times for each train.In addition, one frequency will be changed between the two trains every 1.28s.Fig. 3 shows the Inquiry process [4], [5].

Power supply
A breadboard power supply is used to provide a steady voltage source (5V) to the components.It also acts as an overcurrent protection for the components.It must be noted that during this research, the Arduino UNO is power through the USB cable connecting it to the laptop and not the breadboard power supply unit.It is observed that the RTC module on data logger shield will malfunction when it is powered using the breadboard power supply.From the schematic diagrams above, the serial communication between the HC-05 and the UNO is through the transmit and receive pins.The connection between the communication pins are shown in Tab. 4. The UNO will have to assign its transmit and receive pin as activate.The transmit pin of the HC-05 is directly connected to the microcontroller which the microcontroller can treat a 3.3V digital signal it as HIGH.In contrast, microcontroller transmitter need to be step down from 5V to 3.3V as the HC-05 cannot receive signal voltage higher than 3.3V.The 5V signal is step down with using voltage division rule with resistor (1kΩ and 2kΩ).Fig. 5 shows the design of a single Bluetooth detector and Fig. 6 shows the design for a dual Bluetooth detectors.In the dual detector design, one of the UNO plays the role of an initiator and will interrupt the other MATEC Web of Conferences 152, 03008 (2018) https://doi.org/10.1051/matecconf/201815203008Eureca 2017 UNO to initiate the start of another inquiry process in the second UNO after a pre-set delay interval.It is via configuration that two independent inquiry sequence can be initiated with a pre-set delay apart.The prototype as shown in Fig. 7 is built according to design in Fig. 6.One of the Bluetooth detector is switched off for a single detector configuration during testing.Fig. 7. Prototype.

Flow chart
The functionality of the software embedded in the UNO is as detailed in the flowchart in Fig. 8.For ease of readability, the AT command detailed in this flowchart is summarised in Tab. 5.The reference to 'a' in the flowchart refers to a variable which record the return value from the Bluetooth module.

Static test
The objective is to identify the maximum detecting range of the Bluetooth detector.Furthermore, to justify that class 2 Bluetooth module have a detection range of 15 meters radius.This static test is conducted by having a smart phone with Bluetooth enable being placed at a known distance away from the Bluetooth detector.In the initial test, the smart phone was placed 10 meters away from the Bluetooth detector.Subsequent data points were taken with the distance between the smart phone and the detector increased in increment of 10 meters.This test is repeated until the Bluetooth detector is unable to detect the smart phone.The setting of the experiment is as shown in Fig. 9.Each test will last for 1 minute as the Bluetooth detector is activated.A total of 5 test is conducted for each distance.The setting of the Bluetooth detector inquiry parameters is AT+INQM = 1,1,1 throughout the test.Other than a smart phone, this static test was also conducted with a car Bluetooth enabled radio.In order to provide some insight into the test cases detailed in Tab. 7, the objectives of these test cases are described in the following sub-sections.

Effect of inquiry time
The effect of inquiry time on the performance of the Bluetooth detector is conducted by varying the maximum inquiry time limit, <Param3> of the AT+INQM command, between 1.28s and 2.56s.Accordingly, the 2 experimental runs were conducted using the following query settings  AT+INQM=1,1,1  AT+INQM=1,1,2

Effect of multiple Bluetooth detectors with different query settings and delay between their inquiry cycles
The effect of the various query settings (the same settings will be used on both detectors) and the time difference between the inquiry cycle of the 2 detectors as well as the impact on the performance of the detector was conducted.The query settings for the 2 detectors and the delay used were as follows.The delay between the 2 inquiry cycles is necessary to avoid collision.The purpose of the experiment with the AT+INQM=1, 40, 4 settings and a 2.56s delay between the 2 inquiry cycles is for confirmation that it this would all the scanning of the 2 trains of 16 frequency channels concurrently.In the dynamic test experiments, the average speed of a Bluetooth device traversing though the radio range of the detector is measure by taking the time it takes ( ) to move across a known distance ( ) using a stopwatch.The actual average speed is then computed using Equation ( 1). (1) The duration a Bluetooth device is within the radio range of a detector can be determine from final time it was detected by the detector, , and the time it was initially detected by the detector, .The predict average speed that is then calculated with Equation (2).In this research, the known distance, in Equation ( 2), is taken to be 2 times the radio range of the detector. (2) The performance of the system is then analysed by plotting the predicted average speed versus its actual average speed.As one would expect, a perfectly accurate system will produce a straight-line plot where the predicted speed equals the actual speed.As it is not plausible that that a Bluetooth device is detected the very moment it enters the radio range of the detector nor would its last detection be right at the edge as it was about to leave the radio range of the detector, the actual distance traversed by the device is a value smaller than .As such, even if the detector is working perfectly, the predicted average speed is expected to be higher than the actual average speed.In other words, a plot of the predicted average speed versus the actual speed of a functioning system will produce a line above and parallel to the results for a perfectly accurate system.The more accurate the functional system is, the closer its plot will be to that for the perfect system.From the initial static test results, it noted that car radio Bluetooth can only be detected over a very short distance and the samples taken are low even though the HC-05 is able to detect a smartphone Bluetooth signal over a much longer range.

Second test
The second static test was conducted with a smartphone over a range from 10m up to 40m in increment of 10m.At each distance, a total of five tests were conducted with each test running for one minute.However, from the results of these tests, it was noticed that the first detection occurs approximate 14 seconds after powering up.The 14s delay is most likely due to coding and hardware design that can be compensated for in a proper implementation.Tab. 8 below shows the results of these experiments.Noticed that the number of detection within the one minute decreases as the distance between the device and the detector increases.

The impact of having two Bluetooth detectors
The results for the experiment using two detectors is summarised in Fig. 13.Of the 5 settings, AT+INQM=1, 10, 1 with a 5-millisecond delay between the inquiry cycles of the 2 detectors has the worst performance.Raw data for this experiment seems to shows an anomaly where the Bluetooth module with a delay inquiry sequence received more FHS packets than the ID packets it sends out.Note that a 5-millisecond delay between the 2 inquiry sequences would have the 2 Bluetooth modules only shift the inquiry sequence by half a train as shown in Fig. 12.The results in Fig. 13 shows that the AT+INQM=1,1,1 query setting with no delay † seems to have the best performance.The results as shown in Tab. 10 shows the Bluetooth module with the leading inquiry sequence is able to capture more data.The additional data provided by the other Bluetooth module was found to not be able to improve the accuracy of the speed estimation.
In these experiments, AT+INQM=1,40,4 with a delay of 2.56s was found to have three extreme data as detailed in Tab. 9.The removal of these extreme data points would produce a result as shown in Fig. 14.This lead us to belief that there exists a possibility of a † It is important to note that though no delay is set, the execution of the command by the microcontroller will inherently introduce a delay between the 2 inquiry sequences.
way to improve the predicted average speed if we could find a way to exclude such extreme data points.

The impact of having multiple traveling Bluetooth device
Comparing Fig. 16 and Fig. 17

Conclusion
Bluetooth traffic monitoring systems has advantages but there are challenges to overcome.The first challenge would be the detection range.Bluetooth detectors will have different detection range depending on the Bluetooth devices it is trying to detect.Furthermore, the power class of traveling Bluetooth device will have effect on the detection range of Bluetooth detectors.From the first dynamic test, it shows that having longer scanning time, the Bluetooth detector has higher chance of detecting device at further distance.The second dynamic test result shows that inquiry parameter AT+INQM=1,40,4 have better speed estimation compare to other setting when extreme data is removed.At the last dynamic test,

Fig. 1 .
Fig. 1.Two Bluetooth detectors demarking a segment of a road being monitored.

Fig. 3 .
Fig. 3. Bluetooth inquiry process [5].Franssens et al.[6] conduct research on having multiple Bluetooth inquirers in Bluetooth Discovery Process.The first study is about having multiple Bluetooth detectors present which is able to enhance the discovery of nearby Bluetooth devices.From Fig.4shows having 5 inquirers (Bluetooth detectors) perform better than 1 inquirer and 3 inquirers.

Fig. 13 .
Fig. 13.The impact of having multiple Bluetooth module initiate inquiry process at different setting

Fig. 16 . 1 Fig. 17 .
Fig. 16.Impact of two Bluetooth devices on a detector using a single Bluetooth module and a query setting of AT+INQM=1,1,1

Tab. 1. The function of pin is shown in Tab. 2. Tab. 1. HC-05 specification.
Bluetooth module with a communication range of approximate 15 meters, is used in this research.The specification of the HC-05 is shown in [10]3Microcontrollerdevelopment platform[9],[10]The Arduino UNO, powered by an ATmega328 microcontroller, is used in this research.The specification of the Arduino UNO is shown in Tab.3.Tab.3. Arduino ATmega328 MCU specification Inquire device class.When setting the device class, <Param> is set to the value 0 for default class.
5. AT commands.AT A test command.A response "OK\r\n" is received if the Bluetooth module is operating properly.AT+ROLE=<Param> Set the Blutooth module mode.<Param> has the value 0, 1 or 2 for Slave, Master and Slave-Loop mode respectively.AT+INIT Initialise the SPP profile library.It returns an "OK\r\n" if the command is executed successfully.MATEC Web of Conferences 152, 03008 (2018) https://doi.org/10.1051/matecconf/201815203008 . 6. Dynamic test cases.
Effect of multiple moving Bluetooth devicesThe purpose of these tests is to study the performance of the system where multiple Bluetooth devices are traversing across the radio range of the detector.Two smart phones are used in these experiments and the following settings were used.