<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta>
      <issn pub-type="ppub">1613-0073</issn>
    </journal-meta>
    <article-meta>
      <title-group>
        <article-title>Accurate Proximity Sensor for Parking Assistance</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Matic Klopčič</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>doc. dr. Kristina Stojmenova Pečečnik</string-name>
          <email>kristina.stojmenova@fe.uni-lj.si</email>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>University of Ljubljana, Faculty of Computer and Information Science</institution>
          ,
          <addr-line>Večna pot 113, 1000 Ljubljana</addr-line>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>University of Ljubljana, Faculty of Electrical Engineering</institution>
          ,
          <addr-line>Tržaška cesta 25, 1000 Ljubljana</addr-line>
        </aff>
      </contrib-group>
      <abstract>
        <p>The distance to obstacles is crucial for safe driving and parking. Currently, cars are equipped with sensors that measure the distance to obstacles, but the distance is only displayed using diferent colors and sounds. Therefore, we have assembled a device that, with a distance measuring sensor, thermometer, and humidity sensor, measures and calculates the distance to the nearest object. It accurately displays the exact distance down to the centimeter on the screen, providing the driver with more precise information about the proximity to obstacles.</p>
      </abstract>
      <kwd-group>
        <kwd>proximity sensor</kwd>
        <kwd>HC - SP04</kwd>
        <kwd>DHT22</kwd>
        <kwd>Raspberry Pi</kwd>
        <kwd>temperature</kwd>
        <kwd>relative humidity</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>CEUR
ceur-ws.org</p>
    </sec>
    <sec id="sec-2">
      <title>1. Introduction</title>
      <p>CEUR
Workshop
Proceedings</p>
    </sec>
    <sec id="sec-3">
      <title>2. Theoretical background of proximity sensors</title>
      <p>
        Proximity sensors are devices that can detect the presence or absence of an object within
a certain range without physical contact. They play a crucial role in various applications,
from industrial automation to consumer electronics. They utilize diferent technologies such
as infrared (IR), ultrasonic, capacitive, inductive, laser, and photoelectric sensors. Infrared
sensors [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] use infrared light for detection and are common in touchless interfaces like
smartphones. Ultrasonic sensors [2] emit and measure ultrasonic waves, widely used in industrial
automation. Capacitive sensors [3] measure changes in capacitance, found in touchscreens.
Inductive sensors [4] detect changes in inductance caused by metal objects, prevalent in
industrial automation. Laser sensors [5] use laser beams for distance measurement, applied in
precision applications. Photoelectric sensors [6] emit and detect light changes, suitable for
industrial and automation tasks.
      </p>
      <p>Proximity sensors find applications in object detection, touchless interfaces in consumer
electronics, safety systems in automotive applications and gesture recognition. They
contribute to safety by detecting objects in automotive settings and industrial automation. Gesture
recognition systems benefit from proximity sensors for touchless control of electronic devices.
Proximity sensors play a significant role in modern technology, enhancing user experiences
and contributing to the eficiency of various industries.</p>
    </sec>
    <sec id="sec-4">
      <title>3. Solution - presentation of the sensor system</title>
      <p>We designed a system with two sensors. To measure the distance from objects, we used the
HC-SR04 sensor. However, for precise measurements, we also need a humidity sensor and a
temperature sensor. Both are inside the DHT22 module.
mounted on the front part of the car.</p>
      <sec id="sec-4-1">
        <title>3.1. Proximity sensor HC-SP04</title>
        <p>The HC-SP04 operates at 5 V and measures in the range from 2 cm to 4 m. The measurement
angle is 15°. The sensor consists of a speaker that emits at 40 kHz frequency and a microphone.
With a high pulse at the input trigger pin, which must last at least 10  s, the module emits
8 pulses at a frequency of 40 kHz. The microphone then receives the emitted pulses if they
bounce of objects. The transmission and reflection are shown in Figure
2. Based on the time
elapsed between pulse transmission and reception, the distance can be calculated. We know
that sound travels at a speed of approximately 340  . The traveled distance can be calculated
using the formula:
and an air pressure of 101.325 kPa, the speed of sound is 331.29 
which includes the influence of temperature and humidity, would be::

where  equals travelled distance,  represents the speed of sound and  is half the duration from
the moment the sound left the sensor to the moment we detect it again.</p>
        <p>However, the speed of sound depends on other physical quantities. At a temperature of 0 °C
[7]. The corrected formula,</p>
        <p>= 331, 4 + 0, 6 ∗  + 0, 0124 ∗ 
where</p>
        <p>is the corrected speed of sound, T is the current air temperature, and H is the relative
humidity of the air. The formula is taken from the website [8].</p>
        <p>The sensor output signal has a voltage of 5 V. However, the input pins on Raspberry Pi work
on 3.3 V. Therefore, we should lower the output signal voltage from sensor before the input pins.
For that purpose, we added voltage divider circuit, which consists of two resistors connected
 =  ∗ 

(1)
(2)
(3)
in series. The input is the output signal, and the signal reduced to 3.3 V, will be between the
resistors. Equation that represents the voltage divider circuit is:
where   states for 3.3 V signal that goes to Raspberry Pi,   represents signal from the sensor
and  1,  2 are values of two resistors. Resistance  1 and  2 can be arbitrary as long as the ratio
  remains 3.3 = 0.66. We chose  1 to be 1 Ω .  2 is then calculated as:
  5
 
 
=</p>
      </sec>
      <sec id="sec-4-2">
        <title>3.2. Humidity and Temperature Sensor DHT22</title>
        <p>For measuring temperature and relative humidity, we used the DHT22 sensor. It operates in
the voltage range from 3.3 V to 6 V [9]. A polymer capacitor is used for measurement. It
measures relative humidity in the range of 0 % to 100 % and temperature from -40 °C to 80 °C.
The measurement accuracy is ± 2 % for humidity and ± 0.5 °C for temperature. Sensitivity for
humidity is 0.1 %, and for temperature, it is also 0.1 °C. The sampling rate is relatively small, with
a maximum sampling rate of one measurement every 2 seconds. However, external temperature
and humidity usually do not change very rapidly, and a sampling rate of 2 seconds is entirely
suficient for our application.</p>
      </sec>
      <sec id="sec-4-3">
        <title>3.3. Controlling with Raspberry Pi</title>
        <p>We controlled both sensors using the Raspberry Pi microcontroller. For displaying the distance
from obstacles, we used the ”Raspberry Pi Touch Display” [10]. We wrote the code in the Python
programming language [11]. A power bank was used to power the sensors and microcontroller.
All components of the system can be seen in Figure 4a.</p>
      </sec>
    </sec>
    <sec id="sec-5">
      <title>4. Measurements and Testing</title>
      <p>We conducted separate tests for each sensor. First, we tested the distance sensor, followed by
the temperature and humidity sensors. Subsequently, we integrated all of them into a single
distance measurement. We tested the accuracy of the sensor system using a standard meter. We
positioned it perpendicular to the wall and conducted measurements at distances of 3 cm from
the wall, 10 cm, 20 cm, ... and at intervals of 10 cm onwards up to 150 cm. The measurement
error was at most ±1 cm.</p>
      <p>The sensor system was mounted on the front part of the car, and the screen with the
microcontroller was installed behind the steering wheel. Based on the distance from obstacles, we
colored the text. The text color is green for distances greater than 1 m, orange for distances
between 0.5 m and 1 m, and red for distances below 0.5 m. Changing the color helps the driver
recognize potential dangers, as it is more crucial to focus on the surroundings while driving.
The example of all three diferent states can be observed in Figures 4b, 5a, 5b.</p>
    </sec>
    <sec id="sec-6">
      <title>5. Results</title>
      <p>The proximity sensor proved to be very useful as it accurately displays the distance to obstacles
with an accuracy of ± 1 cm. We measured the error by placing the sensor at a measured distance
from the wall and comparing the distance with the displayed value on the screen. We compared
(a) Components of the sensor system.</p>
      <p>(b) Distance to obstacle is greater than 1 m.
(a) Distance to obstacle is between 0,5 m and 1 m.
(b) Distance to obstacle is less than 0,5 m.
at distances of 3 cm, 10 cm, 20 cm, and then every 10 cm up to 150 cm. The error was consistently
within ± 1 cm. The experiment was conducted at temperature 22.1 °C and humidity 52 %. We
also tested the system outdoor, where the temperature and humidity were 6.2 °C and 73 %
respectively. The error remained ± 1 cm.</p>
      <p>The only challenge is the relatively narrow measurement angle, which is 15°. At a distance of
1 m, the coverage width is only 0.26 m, calculated as 2 ∗  (7.5°). While this is acceptable when
approaching a wall, obstacles such as pillars, protruding parts, and obstacles at the sides of the
car pose a challenge. Additionally, the width of the sensing area decreases as we approach an
obstacle. The solution would be to use multiple sensors at diferent parts of the car.</p>
    </sec>
    <sec id="sec-7">
      <title>6. Conclusion and further improvements</title>
      <p>The developed sensor for measuring the distance to obstacles is practical for parking, as it
provides more information about the surroundings. Consequently, there is a lower probability
of hitting pillars or edges that are not visible from the driver’s seat, or not knowing how far we
are from them.</p>
      <p>Moreover, according to specifications [ 12], the system should work between -15 °C and 70 °C,
as these are limitations for proximity sensor. Humidity and temperature sensor DHT22 works
over a wider ranger, namely between -40 °C and 80 °C. Therefore, the system should work even
in hot summer days as well as during winter.</p>
      <p>However, there are several possible improvements. One sensor covers only a part of the car
due to the relatively small detection angle, so it would make sense to add multiple sensors at
diferent parts of the car. This way, all distances could be displayed at once.</p>
      <p>It would also be interesting to investigate how rain afects the sensor’s operation, assuming
the sensor is adequately protected against water ingress. The speed of sound through
water is significantly higher, measuring 1400  at 0 °C [13], and it increases with temperature.
Consequently, there may be a measurement error.</p>
      <p>composite sensor array combining ultrasonic and infrared proximity sensors, in:
Proceedings 1995 IEEE/RSJ International Conference on Intelligent Robots and Systems.
Human Robot Interaction and Cooperative Robots, volume 3, 1995, pp. 120–126 vol.3.
doi:10.1109/IROS.1995.525872.</p>
      <p>Springer Science &amp; Business Media, 1999.
[3] Y. Ye, C. Zhang, C. He, X. Wang, J. Huang, J. Deng, A review on applications of capacitive
displacement sensing for capacitive proximity sensor, IEEE Access 8 (2020) 45325–45342.
doi:10.1109/ACCESS.2020.2977716.
[4] P. Kejıḱ, C. Kluser, R. Bischofberger, R. S. Popovic, A low-cost inductive proximity
sensor for industrial applications, Sensors and Actuators A: Physical 110 (2004) 93–97.
URL: https://www.sciencedirect.com/science/article/pii/S0924424703004151. doi:https:
//doi.org/10.1016/j.sna.2003.07.007, selected Papers from Eurosensors XVI Prague,
Czech Republic.</p>
      <p>Master’s thesis, Middle East Technical University, 2017.
[5] E. Korkmaz, Optical system design of direct detection short-pulsed laser proximity sensor,
Press, 1988.</p>
      <p>America 79 (1986) 1359–1366.
[6] S. Juds, Photoelectric sensors and controls: selection and application, volume 63, CRC
[7] G. S. Wong, Speed of sound in standard air, The Journal of the Acoustical Society of
[8] D. Nedelkovski, Ultrasonic sensor hc-sr04 and arduino – complete guide, Published online,
2015. URL: https://howtomechatronics.com/tutorials/arduino/ultrasonic-sensor-hc-sr04/,
accessed: 12. 12. 2023.
[9] Digital relative humidity &amp; temperature sensor am2303/dht22, Published online,
2009. URL: https://cdn-shop.adafruit.com/datasheets/Digital+humidity+and+temperature+
sensor+AM2302.pdf, accessed: 17. 12. 2023.
[10] Raspberry pi touch display, Published online, 2015. URL: https://www.raspberrypi.com/
products/raspberry-pi-touch-display/, accessed: 20. 12. 2023.
[11] Python, Published online, 2023. URL: https://www.python.org/, accessed: 20. 12. 2023.
[12] Pysupply, the maker emporium, Published online, 2024. URL: https://uk.pi-supply.com/
products/ultrasonic-distance-sensor-hc-sr04, accessed: 23. 1. 2024.
[13] M. Greenspan, C. E. Tschiegg, Tables of the speed of sound in water, The Journal of the
Acoustical Society of America 31 (1959) 75–76.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>A.</given-names>
            <surname>Sabatini</surname>
          </string-name>
          ,
          <string-name>
            <given-names>V.</given-names>
            <surname>Genovese</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E.</given-names>
            <surname>Guglielmelli</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Mantuano</surname>
          </string-name>
          , G. Ratti,
          <string-name>
            <given-names>P.</given-names>
            <surname>Dario</surname>
          </string-name>
          ,
          <article-title>A low-cost,</article-title>
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>