Professional Documents
Culture Documents
On
Submitted by:
K.VINOD 21071A0498
J.MOSES 21071A04A1
CERTIFICATE
This is to certify that Summer Internship report titled “LED DISTANCE INDICATOR”that is
being submitted by K.VINOD(21071A0498), J.MOSES(21071A4A1), for the fullfilment of
summer internship at V Sem of Bachelor of Technology in Electronics & Communication of the
VNR VJIET, Hyderabad during the academic year 2023-24 is a record of bonafide work carried
out by him/her under our guidance and supervision.
Acknowledgement 1
Abstract 2
Chapter 1: Introduction 3
Chapter 3: MethodologY 7-
7
3.1 Circuit Design
3.2 Working 7
8
3.3 Code
9-11
Chapter 5: Conclusion 16
References 16
ACKNOWLEDGEMENTS
K.VINOD 21071A0498
J.MOSES 21071A04A1
1
ABSTRACT
The Arduino code orchestrates the synchronization between the sensor readings
and LED activation. Distance data is processed, and LEDs are selectively
illuminated based on predefined distance thresholds. This interactive feedback
mechanism enhances user engagement and facilitates a tangible understanding of
distance measurement concepts.
2
CHAPTER 1
INTRODUCTION
In the realm of DIY electronics and physical computing, Arduino microcontrollers stand out
as versatile platforms for creative projects. This project introduces a compelling and
interactive exploration into the world of distance measurement using an Arduino Uno board,
an HC-SR04 ultrasonic sensor, and Light Emitting Diodes (LEDs). The core objective is to
demonstrate how these components can be seamlessly integrated to provide real-time visual
feedback based on the measured distance from an object.
The project not only serves as an introduction to interfacing sensors with Arduino but also
incorporates an essential aspect of physical computing – the ability to communicate
information through tangible, observable means. The inclusion of LEDs as visual
indicators adds an interactive dimension to the project, making it accessible and engaging
for enthusiasts and learners of varying levels of expertise.
Through this exploration, users will gain practical experience in coding logic, conditional
statements, and sensor integration. The real-time monitoring of distance measurements on
the Serial Monitor provides a transparent view of the system's functionality, encouraging
further experimentation and customization. This introductory project lays the foundation for
more advanced applications, empowering individuals to delve deeper into the exciting
realms of electronics, programming, and interactive systems.
3
CHAPTER 2
Arduino IDE
Arduino IDE is a cross-platform application written in java, and is derived from the
IDE for the processing programming language and the wiring project. This platform is
designed to simply Arduino programming with the basics of C/C++ libraries. It includes
a code editor with features such as syntax highlighting, brace matching, and automatic
indentation. It also has the features to verify the code through compiling. Also the code
can be successfully dumped into an Arduino by using Upload feature. These make the
Arduino IDE as an casy and robust tool for interfacing with an Arduino. The Arduino
IDE comes with a C/C++ library called "wiring" (from the project of the same name),
which makes many common input/output operations much easier. Arduino programmes
can be written in C/C++,
• Microcontroller: ATmega328
• SRAM: 2 KB (ATmega328)
• EEPROM: 1 KB (ATmega328)
4
2.Connecting Wires (Quantity-requirdable)
3.BreadBoard
4.UltraSonic Sensor 5.LED’s
6.Resistors
6
CHAPTER 3
METHODOLOGY
3.2 WORKING:
The implementation of the Arduino Ultrasonic Sensor project involves a systematic approach,
covering hardware setup, circuit connection, and programming. The following step-by-step
methodology guides you through the process:
1. Gather Components:
- Collect the necessary components: Arduino board, HC-SR04 ultrasonic sensor, jumper wires,
resistors (220-ohm), LEDs, and a breadboard.
2. Understand Component Specifications:*
- Familiarize yourself with the pin configurations and specifications of the HC-SR04, LEDs, and
Arduino board.
3. Circuit Connection:
- Connect the components on the breadboard according to the circuit diagram. Ensure proper
wiring and connections:
- Connect the HC-SR04 to the Arduino.
- Connect LEDs to the Arduino with current-limiting resistors.
- Double-check connections and polarities.
4. Write Arduino Code:
- Open the Arduino IDE on your computer.
- Write or copy the provided Arduino code into the IDE.
- Review the code to understand how it triggers the ultrasonic sensor, calculates distances, and
controls the LEDs based on predefined conditions.
5. Upload Code to Arduino:
- Connect your Arduino board to the computer using a USB cable.
- Select the appropriate board and port in the Arduino IDE.
- Click the "Upload" button to transfer the code to the Arduino board.
6. Monitor Serial Output:
- Open the Serial Monitor in the Arduino IDE.
- Observe the real-time distance measurements printed on the Serial Monitor as the Arduino
interacts with the HC-SR04.
7. Test and Troubleshoot:
- Place objects at varying distances in front of the ultrasonic sensor.
- Verify that the LEDs respond according to the specified distance thresholds.
- Troubleshoot any issues by checking connections, component specifications, and code logic.
8. Experiment and Customize:
- Explore modifications to the code or circuit to adapt the project to your preferences.
- Consider adding more LEDs, adjusting distance thresholds, or incorporating an LCD display
for enhanced visualization.
9. Document and Learn:
- Document your circuit connections, code modifications, and observations.
- Reflect on the learning outcomes and challenges encountered during the project.
3.3 Code
int duration = 0;
int distance = 0;
void setup()
{
pinMode(trig , OUTPUT);
pinMode(echo , INPUT);
pinMode(LED1 , OUTPUT);
pinMode(LED2 , OUTPUT);
pinMode(LED3 , OUTPUT);
pinMode(LED4 , OUTPUT);
pinMode(LED5 , OUTPUT);
Serial.begin(9600);
void loop()
{
digitalWrite(trig , HIGH);
delayMicroseconds(1000);
digitalWrite(trig , LOW);
duration = pulseIn(echo , HIGH);
distance = (duration/2) / 28.5 ;
Serial.println(distance);
if ( distance <= 5 )
{
digitalWrite(LED1, HIGH);
}
else
{
digitalWrite(LED1, LOW);
}
if ( distance <= 7 )
{
digitalWrite(LED2, HIGH);
}
else
{
digitalWrite(LED2, LOW);
}
if ( distance <= 10 )
{
digitalWrite(LED3, HIGH);
}
else
{
digitalWrite(LED3, LOW);
}
if ( distance <= 15 )
{
digitalWrite(LED4, HIGH);
}
else
{
digitalWrite(LED4, LOW);
}
if ( distance <= 20 )
{
digitalWrite(LED5, HIGH);
}
else
{
digitalWrite(LED5, LOW);
}
}
1
CHAPTER 4
RESULTS
APPLICATIONS:
The Arduino Ultrasonic Sensor project with LEDs for distance measurement has various practical
applications, showcasing the versatility of Arduino-based systems in real-world scenarios. Here are
some potential applications:
2. Security System:
- Implement the system as a proximity-based security alert. LEDs can signal if an object or person
is approaching a designated area.
4. Home Automation:
- Create a smart home system where the Arduino measures the distance to occupants. LEDs can
signal the proximity of individuals, triggering specific home automation actions.
6. Gesture Control:
- Combine the distance measurement with gesture recognition. LEDs can indicate whether a hand
or object is within a specified range, enabling gesture-controlled applications.
7. Assistive Technology:
- Develop assistive devices for individuals with visual impairments. LEDs can provide haptic
feedback about the proximity of obstacles in their surroundings.
9. Human-Computer Interaction:
- Implement the system for touchless interaction with computers or devices. LEDs can indicate
when a hand is within range for gesture-based commands.
These applications highlight the adaptability of the Arduino Ultrasonic Sensor project,
demonstrating its potential across various domains, from robotics and automation to art and
assistive technology. As technology evolves, the versatility of Arduino-based projects allows for
innovative solutions to diverse challenges.
CHAPTER 6
CONCLUSION
REFERENCES
https://www.youtube.com/watch?v=UVrRmDBRKH8
https://en.wikipedia.org/wiki/Arduino_Uno