Lab Report
Course Name        : Embedded Systems and IoT Lab
Course Code        : CSE-234
Experiment No      : 07
Experiment Name : Arduino Interface with Ultrasonic and PIR
Motion Sensor with LCD Display
                             Submitted To:
Name            : Mr. Avizit Nandi
Designation     : Lecturer
Department      : Department of Computer Science & Engineering
                             Submitted By:
Name            : Md. Tanvir Ahmed
ID              : 221-15-5307
Department      : Department of Computer Science & Engineering
Section         : 61_C
                  Date of Submission: 11/08/2025
Objectives
      To interface common electronic sensors (ultrasonic and PIR) with an Arduino Uno
       microcontroller.
      To build a functional distance-measuring device using an HC-SR04 ultrasonic sensor
       and display the output on a parallel LCD.
      To construct a motion detection system using a PIR sensor and display its status on an
       I2C LCD.
      To compare the wiring complexity and programming requirements of parallel versus
       I2C communication for LCDs.
      To understand the practical application and working principles of echolocation and
       passive infrared detection.
Introduction: This report details two experiments conducted using the Arduino Uno
microcontroller platform to interface with common electronic sensors and display their output.
The first experiment focuses on measuring distance using an HC-SR04 ultrasonic sensor with
a parallel LCD, while the second involves detecting movement with a Passive Infrared (PIR)
sensor and a more streamlined I2C LCD. Together, these projects demonstrate fundamental
concepts in physical computing, including sensor reading, data processing, output display, and
the trade-offs between different hardware communication protocols.
Theory: The theoretical basis for these experiments lies in the distinct operating principles of
the sensors and display technologies. The HC-SR04 ultrasonic sensor functions on the principle
of echolocation, emitting a high-frequency sound pulse and measuring the time it takes for the
echo to return after reflecting off an object. By knowing the speed of sound, the distance can
be calculated from this time-of-flight measurement. In contrast, the Passive Infrared (PIR)
sensor operates by detecting changes in infrared radiation within its field of view. It is a passive
device that senses the heat emitted by objects, and when a warm body like a person moves, it
causes a differential change in the IR levels detected by its internal pyroelectric sensors,
triggering a HIGH signal to indicate motion. The output from these sensors is displayed using
two different types of Liquid Crystal Displays (LCDs). The first experiment uses a parallel
LCD, which communicates with the Arduino over multiple data lines simultaneously, a direct
but pin-intensive method. The second experiment utilizes an I2C LCD, which leverages the
Inter-Integrated Circuit serial communication protocol. This more efficient method uses just
two wires—SDA (data) and SCL (clock)—to control the display, significantly simplifying the
wiring and conserving the Arduino's valuable I/O pins.
Equipment:
      Arduino Uno R3 Microcontroller
      HC-SR04 Ultrasonic Sensor
      Passive Infrared (PIR) Motion Sensor (e.g., HC-SR501)
      16x2 Character LCD (with parallel interface)
      16x2 I2C LCD Module
      10kΩ Potentiometer (for parallel LCD contrast)
      Solderless Breadboard
      Jumper Wires
©Tanvir Ahmed                                                                            2|Page
Circuit Diagram:
           Figure 1: Circuit diagram of Ultrasonic sensor interface with Arduino
              Figure 2: Circuit diagram of PIR sensor interface with Arduino
Code:
Ultrasonic Sensor:
©Tanvir Ahmed                                                                      3|Page
Motion (PIR) sensor:
Discussion:
      Successful Implementation: Both the ultrasonic distance meter and the PIR motion
       detector circuits functioned correctly according to their designs.
      Sensor Output Comparison: The HC-SR04 sensor provided quantitative, real-time
       distance data, which is useful for measurement tasks. The PIR sensor provided
       qualitative, binary (motion/no motion) data, which is ideal for simple trigger-based
       systems.
      Wiring Complexity: A significant difference was observed in the wiring complexity
       between the two display methods. The parallel LCD required at least six digital pins,
       making the circuit more crowded, whereas the I2C LCD module required only two
       dedicated pins (A4/SDA and A5/SCL).
      I2C Efficiency: The I2C protocol proved to be far more efficient in terms of pin usage,
       highlighting its advantage in projects where multiple components need to be connected
       to the Arduino.
Conclusion:
      The experiments successfully met all objectives, demonstrating the ability to interface
       both ultrasonic and PIR sensors with an Arduino and display their data.
      The projects provided hands-on experience in reading sensor data, processing it, and
       controlling different types of LCDs.
      A clear, practical understanding of the trade-offs between parallel and I2C
       communication was gained, with I2C being the superior choice for conserving I/O pins.
       In summary, the lab successfully demonstrated the versatility of the Arduino platform
       in creating functional and responsive sensor-based electronic systems.
©Tanvir Ahmed                                                                      4|Page