LED Light Triggered by Ultrasonic Sensor

by derrick_0723 in Circuits > Arduino

274 Views, 0 Favorites, 0 Comments

LED Light Triggered by Ultrasonic Sensor

20210418_112256.jpg

Original Source: https://www.arduino.cc/en/Tutorial/BuiltInExamples...

In the source, the author uses an ultrasonic sensor to detect distances. The idea is great and easy to understand, but his product lack usage. Therefore, I decided to add LED lights to the original product. The author of the original source coded and drew the circuit diagram of the ultrasonic for me. To extend, I coded the LED light to turn it on when the ultrasonic detects a distance lower than 30 centimeters. Moreover, I modified the original circuit diagram to fit our ultrasonic sensor; I also created the circuit of the LED light. I must modify the original circuit diagram as the author's ultrasonic sensor varied from ours. I need to create a new circuit from LED light to fit my new codings. My extended codings and circuit create a purpose for this new product and make it better.

Modified Code: https://create.arduino.cc/editor/derrick_0723/2398...



Supplies

1. Dedicated wiring*1: used to connect Leonardo Board to the computer for uploading code.

2. Leonardo Board*1: used to run code.

3. Wires*8: used to connect LED light and ultrasonic sensor.

4. LED light*1: used to shine when the ultrasonic sensor detects distances.

5. Ultrasonic Sensor: used to detect distances.

6. Computer: used to code your Leonardo Board.

Download Code

1. Download the code from the original source: https://www.arduino.cc/en/Tutorial/BuiltInExamples...

The original source is using an ultrasonic sensor to detect distances.

Modify Code

Screenshot 2021-04-18 164056.png

Modify the original code by adding an output, which is the LED light for me. The output can give the product usage and purpose.

Modify Circuit

Screenshot 2021-04-18 164538.png
20210415_212120.jpg
20210415_212137.jpg

Modify the original circuit.

1. The author of the original source uses a different ultrasonic sensor, which only has 3 wires to connect. Mine has 4 wires to connect, shown in the second picture. The SIG wire in the original source is split into 2 in my product. Therefore I connect my wires to pin 6&7, where the original author only connect to 7.

2. Because I added an LED triggered by the ultrasonic sensor, I added a LED in my circuit.

Decorate/Upload Code to Computer

20210418_112256 (1).jpg

Decorate your final product and upload your code then you're finished!

My Final Product

20210418_112256.jpg

Youtube Link: https://youtu.be/qLPDCt4acZM