You are on page 1of 3

Unit 3_ Practice 1

Jade Alondra Ávila Collí


Embedded Systems, Universidad Politécnica de Yucatán
Carr. Mérida - Tetiz Km. 4.5
Ucú, Yucatán, México
2309013@upy.edu.mx

Abstract— This report presents the development and support for a variety of peripherals and communication
implementation of a distance detection system using an protocols.
ultrasonic sensor, ESP32 microcontroller, and RGB LEDs, with
real-time visualization on an LCD display. The project aimed to
LED's:
create a user-friendly interface for monitoring distances.
Through meticulous hardware integration and software
LEDs (light-emitting diodes) are semiconductor devices
programming, the system effectively measured distances, that emit light when electrically polarized. They are widely
illuminated corresponding LEDs based on predefined thresholds, used in electronic projects as visual indicators due to their low
and displayed informative messages on the LCD screen. The power consumption, long life and availability in a variety of
report discusses the circuit construction, sensor interfacing, colors.
programming methodologies, and the achieved results. This
project underscores the significance of integrating sensor Breadboard:
technologies with microcontrollers for developing interactive and A protoboard, also known as a breadboard, is a prototyping
informative systems, with potential applications in differents
tool that allows you to connect electronic components without
fields.
the need for soldering. It consists of an array of electrically
connected holes, making it easy to create and modify
temporary circuits during the development process.

I. INTRODUCTION Programming:
The following practice focuses on the implementation of a Programming is the process of writing and debugging
motion detection circuit using an ESP32 development board software code to control the behavior of electronic devices,
and three LEDs of green, yellow and red. such as microcontrollers, computers, and embedded systems.
The main objective of this project is to explore and In the context of this theoretical framework, it specifically
understand the basic principles of the interaction between a refers to writing code to control the functionality of the ESP32
motion sensor and visual output devices, as well as to acquire board and other peripheral devices.
practical skills in microcontroller programming.
The use of LEDs of different colors allows creating a visual Thonny:
system that can effectively communicate information to the Thonny is an integrated development environment (IDE)
user. In this project, each color will be assigned a specific designed specifically for Python programming. It offers
function in relation to motion detection, allowing clear and features like a built-in debugger, syntax highlighting, and code
understandable visual feedback; The green LED will indicate autocompletion, making it a popular choice for beginners and
a safe distance status, the yellow will signal caution, while the advanced users alike.
red will indicate an alert or danger.
Circuit:
A circuit is a configuration of interconnected electronic
components that allows the flow of electrical current to
II. THEORICAL FRAMEWORK perform a specific function. It can include components such as
resistors, capacitors, transistors and microcontrollers, among
others.
ESP32 board:
The ESP32 is a low-cost, high-performance development LCD:
board based on the ESP32 system-on-chip (SoC) from An LCD (liquid crystal display) is a type of display that
Espressif Systems. This board offers a wide range of uses optical properties of liquid crystals to produce images. It
capabilities, including Wi-Fi and Bluetooth connectivity, as is commonly used in applications where a low power
well as powerful data processing capabilities. The ESP32 has consumption and compact size display is required, such as in
become a popular choice for IoT projects, home automation, portable devices and control panels.
embedded systems, and more, thanks to its versatility and I2C module:
The I2C (Inter-Integrated Circuit) protocol is a synchronous Procedure:
serial communication protocol used to connect electronic
devices on a two-wire data bus. I2C modules are peripheral 1. Connection of the LEDs:
devices that use this protocol to communicate with a Connecting each LED to the ESP32 board via appropriate
microcontroller or motherboard. limiting resistors, assigning the GPIO pins of the ESP32 to
each LED and ensuring that they are connected correctly.
Voltage:
Voltage is a measure of the difference in electrical potential 2. Ultrasonic Sensor Connection:
between two points in a circuit. It is expressed in volts (V) and - Connect the HC-SR04 ultrasonic sensor to the ESP32
determines the force with which electric current flows through board.
a circuit. - The ultrasonic sensor has four pins: VCC, GND, Trig
and Echo; Connects VCC and GND of the sensor to the power
Connection: supply of the ESP32.
A connection refers to the physical or logical - Connect the Trig pin of the sensor to a GPIO output pin
interconnection between electronic components, devices or of the ESP32.
systems. It may involve joining wires, connectors, pins, or - Connect the Echo pin of the sensor to a GPIO input pin
data signals to allow the transfer of power or information of the ESP32.
between them.
3. LCD Screen Connection:
Input port: - Connect the LCD screen to the I2C bus of the ESP32.
An input port is an interface that allows data, signals, or - Connect the SDA and SCL pins of the I2C module of
power to enter an electronic device. It can take the form of the LCD screen to the corresponding pins of the ESP32.
physical connectors, such as USB ports or audio ports, or
logical interfaces, such as input pins on a microcontroller. 4. Programming:
- Use a development environment like Thonny to write
Ultrasonic sensor: the code in Python for the ESP32 taking into account using
An ultrasonic sensor is a device that uses high-frequency the appropriate library for the ultrasonic sensor and LCD
sound waves to measure distances or objects. It emits screen.
ultrasonic pulses and measures the time it takes to receive the - Program the logic to measure the distance using the
reflected echoes to determine the distance to an object. ultrasonic sensor; each distance was previously assigned in the
project assignment.
IEEE format: - Define distance that will determine when to turn on each
The IEEE format refers to the guidelines and standards LED and what message to display on the LCD screen.
established by the Institute of Electrical and Electronics - Configure the communication between the ESP32 and
Engineers (IEEE) for the submission of technical and the LCD screen to display the appropriate message.
scientific documents. These guidelines include standards for
the structure of the document, the citation of references, the 5. Final Assembly:
presentation of graphs and tables, among other aspects, with - Connect the cables according to the circuit design and
the objective of guaranteeing clarity and consistency in the ensure that there are no short circuits or loose connections,
communication of technical and scientific information. trying to keep the design aesthetic.

III. DEVELOPMENT 6. Test:


To build the circuit that integrates an ultrasonic sensor, an - Power the ESP32 and verify that all components are
ESP32, three green, yellow and red LEDs, and an LCD screen working correctly.
with an I2C module, the following steps were followed: - Perform distance tests with the ultrasonic sensor to
ensure that the LEDs and LCD screen respond as expected.
Material:
1. ESP32 board
2. HC-SR04 ultrasonic sensor IV. RESULTS
3. Three LEDs (green, yellow and red) The results obtained after the completion and at the time of
4. Suitable resistors for LEDs (generally 330 ohms) delivery of the project were not the most favorable, since
5. Breadboard many of the components failed when the program was run.
6. Connection cables
7. LCD display with I2C module
8. Power source (for example, a battery or a power adapter, V. CONCLUSION
in this case the power adapter was used) In this practice, it was possible to develop a functional
distance detection system by integrating an ultrasonic sensor,
an ESP32 board and RGB LEDs, with visualization on an REFERENCES
LCD screen. Throughout the process, significant challenges [1] S. M. Metev and V. P. Veiko, Laser Assisted Microtechnology, 2nd
were faced, such as correctly connecting components, ed., R. M. Osgood, Jr., Ed. Berlin, Germany: Springer-Verlag, 1998.
efficiently programming the microcontroller, and [2] [1] N. author found, “No title found.” [Online]. Available:
http://www.controlesdigitales.com/Libro_Felipe_Santiago/03_Cap_1_
synchronizing visual feedback. 2_3.pdf
[3] [2] N. author found, “No title found.” [Online]. Available:
The system was found to be able to measure distances https://www.uacm.edu.mx/portals/0/repository/Introduccion_a_la_prog
accurately and provide clear visual feedback through the RGB ramacion%20(2).078198f7-f08e-40b0-b16a-906f24ff33c4.pdf
[4] [3] . provotector, “Como instalar ESP32 en el IDE de Arduino.
LEDs. In addition, the display on the LCD screen provides Tutorial. - Duino.Pro.” [Online]. Available: https://duino.pro/como-
detailed information on the current status of the measured instalar-esp32-en-el-ide-de-arduino-tutorial/
distance, improving the user experience and facilitating [5] [4] N. author found, “Thonny - Aprende Python.” [Online]. Available:
decision making. https://aprendepython.es/core/devenv/thonny/

Areas of improvement were identified for future projects


that are similar to this one.

You might also like