Build a motion-detecting LED with an ultrasonic sensor (HC-SR04)

By Aleksandar | 29 September 2017 | 6 Comments
In this tutorial, I will show you how you can build a motion-detecting LED using an ultrasonic sensor (HC-SR04). The parts for this build are provided by KumanTech, you can find them in their Arduino UNO Kit.

Step 1: Parts Needed

1 x Arduino board (I'm using an Arduino Uno)
1 x LED (The color doesn't matter)
1 x 220 ohm resistor
1 x Breadboard
1 x Arduino USB Cable
1 x 9V battery with a clip (optional)
6 x Jumper wires

Step 2: Positioning the Parts

First, plug in the ultrasonic sensor and the LED on the breadboard. Connect the LED's shorter lead (the cathode) to the GND pin of the sensor. Then, place the resistor in the same row as the LED's longer lead (the anode) so they are connected.

Step 3: Connecting the Parts

Now, you need to plug some wires on the back of the sensor. There are four pins - VCC, TRIG, ECHO and GND. After inserting the wires, you need to make the following connections:
The resistor's end to a digital pin of your choice, just make sure to change it later in the code!
Sensor | Arduino
VCC -> 5V
TRIG -> 5*
ECHO -> 4*
* - Can be connected to any two digital pins of the Arduino, just make sure you change them in the code later!

Step 4: Uploading the Code

Now, you can plug your Arduino to your computer using an USB cable. Open up the Arduino software and upload the code that you can find here. The constants are commented, so you know exactly what they are doing and possibly change

Step 5: The Final Result

January 10,2021 20:27
Medicament information for patients. Long-Term Effects. <a href="">can i get prednisone without insurance</a> in US. Everything about drug. Get here. <a href=>Ev
June 25,2020 17:30
<a href="">cialis online cheap</a>
June 23,2020 22:21
<a href="">cialis order online</a>
June 21,2020 12:01
<a href="">cialis uk</a>
June 19,2020 13:07
<a href="">online cialis</a>
June 02,2020 18:37
Nice work sir !
Leave a Reply
Your email address will not be published.Required fields are marked. *
Name *
Email *
Popular blog