HC-SR04 Ultrasonic Distance Sensor and Arduino (Lesson #9)

  Рет қаралды 157,785

Science Buddies

Science Buddies

Күн бұрын

Пікірлер: 55
@EditB3ast
@EditB3ast 3 күн бұрын
This video helped a lot while trying to figure out how to hook up the microcontroller to the ultrasonic sensor👍
@hazelfunnehfangirl5hamburg805
@hazelfunnehfangirl5hamburg805 Жыл бұрын
thank u helped me before getting killed in the program class dude for forgetting to save the process
@johnman84
@johnman84 3 ай бұрын
Okay.... after it taking longer than it should have, I figured out how to make the series of LEDs work! Even at ten inch increments!!! I figured out that I needed to write, threshold * 2 for the second LED. Then I did times 3 for the next, and then times 4! I honestly can't believe I figured it out. I'm so dang proud of myself. Lol 😎 Thanks for the challenge! So pumped!!!
@cheeseball-k9b
@cheeseball-k9b 2 ай бұрын
wow
@LucasMichelitch
@LucasMichelitch 28 күн бұрын
@@cheeseball-k9bwhere do you write the threshold code
@veryvaughsome5867
@veryvaughsome5867 Ай бұрын
Great tutorial! does everything it says and does it well. now i gotta figure out how to make it turn on leds depending on distance
@khomo12
@khomo12 Ай бұрын
Thanks!👍 Yeah, I used my hand, too. It gives faulty readings from time to time. Someone on the Internet suggested taking several(a few) readings and using the median to compensate.
@Dragonforge-Studios
@Dragonforge-Studios 2 ай бұрын
My little brother burst into laughter when he heard "Male to Female pins" lol
@maximarkhipov2186
@maximarkhipov2186 9 ай бұрын
Thanks for the detailed and easy to understand video helped me a lot !!
@Studs_Studio
@Studs_Studio 10 ай бұрын
this is amazing! i made it so if youre too close a buzzer starts beeping. i want to use this on an rc car to automaticly stop
@Science.Buddies
@Science.Buddies 10 ай бұрын
Check out the rest of our tutorials and videos on our channel, we have instructions for autonomous/RC robots as well!
@graemebrumfitt6668
@graemebrumfitt6668 3 ай бұрын
Rite Buddies Dude, Worked first time awesome! TFS, GB :)
@yehonatankalandarev6343
@yehonatankalandarev6343 Жыл бұрын
I want to make a disc shooter that can be attached to the arm, and I want to add a control system to it, basically when the palm "blocks" the shot, the disc shooter will not fire. So I thought to connect this sensor to perform this operation, do you think it is correct? Does it suit my needs?
@Science.Buddies
@Science.Buddies Жыл бұрын
This sensor would work to detect when an object is within a certain distance. Please see our other Arduino tutorials linked in the description of this video.
@motomichinakamura6413
@motomichinakamura6413 10 ай бұрын
Is there any enclosure or casing available for this setting?
@thesuitedsaltshaker8388
@thesuitedsaltshaker8388 2 жыл бұрын
thank you man, helped me a lot
@izukq
@izukq Жыл бұрын
Great vid! thanks
@CoolOjas02
@CoolOjas02 Жыл бұрын
Code? Can you give doc
@Pet-vk3ig
@Pet-vk3ig 9 ай бұрын
Nice, good job
@limuelmagbanua3137
@limuelmagbanua3137 4 ай бұрын
I'm having trouble tryna use a grove model of ultrasonic sensors, and it keeps calculating to 0
@tanawatpittinan6337
@tanawatpittinan6337 2 ай бұрын
Samw
@Yancho00
@Yancho00 Ай бұрын
Same
@MotomichiStudio
@MotomichiStudio 10 ай бұрын
How far can the sensor work in terms of distance?
@itsnd64
@itsnd64 10 ай бұрын
~400cm
@paulcarsco6029
@paulcarsco6029 6 ай бұрын
Can you provide the code link please.
@imahumanbe1ng
@imahumanbe1ng 8 ай бұрын
does this work with arduino maker uno x???
@Science.Buddies
@Science.Buddies 8 ай бұрын
We haven't used the Maker Uno X but it is listed as fully compatible with the Arduino Uno R3, so it should.
@Zemabri
@Zemabri 6 ай бұрын
im using this against my dog, not for a distance sensor
@lemau8458
@lemau8458 Ай бұрын
good for you
@EditB3ast
@EditB3ast 3 күн бұрын
Except I can’t actually access the IDE
@jomfawad9255
@jomfawad9255 7 ай бұрын
does it work outdoor if theres sunlight?
@Science.Buddies
@Science.Buddies 7 ай бұрын
Yes, this sensor uses ultrasonic sound and should not be affected by lighting conditions (with the caveat that the speed of sound depends on air temperature, so that can indirectly affect the readings, but the sensor will still work).
@joshwatp3783
@joshwatp3783 8 ай бұрын
When writing the exact same code it comes up with trigpin was not declared in this scope pinmode
@Science.Buddies
@Science.Buddies 8 ай бұрын
The Arduino code is case sensitive, make sure your code matches the example exactly (pinMode and trigPin)
@joshwatp3783
@joshwatp3783 8 ай бұрын
@@Science.Buddies yeah forgot the capital for M
@kastriotgega2486
@kastriotgega2486 5 ай бұрын
Does it work for underground dedection?
@Science.Buddies
@Science.Buddies 5 ай бұрын
No, this sensor is not designed to detect underground objects. The ultrasonic waves will be reflected back and it will just measure the distance to the ground.
@adityamandal2456
@adityamandal2456 2 жыл бұрын
In your Automatic Braking project using Ultrasonic sensor, I have changed the PING))) sensor to HCSR04. But there's a line in the code saying distance = readUltrasonic(pingPin) Now how to change that👆
@Science.Buddies
@Science.Buddies 2 жыл бұрын
The program in that project uses a function to read the ultrasonic sensor instead of putting all of the code directly in the loop() function. So, you would need to change the function to use two pins instead of one. For example, the call to the function could be distance = readUltrasonic(trigPin, echoPin) and then the first line of the function would be long readUltrasonic(int pin1, int pin2). You would then change the code in the function to use pin1 (corresponding to trigPin) and pin2 (corresponding to echoPin). We're glad that you asked about this because I realized there is actually an error in the existing example program - the way it's written now, the readUltrasonic function should use the "pin" variable inside the function, not "pingPin." so for example the line pinMode(pingPin, OUTPUT); should be pinMode(pin, OUTPUT). Hope that helps! We will update the example code.
@adityamandal2456
@adityamandal2456 2 жыл бұрын
@@Science.Buddies Thanks for the information 👍
@joshwatp3783
@joshwatp3783 8 ай бұрын
Also saying pinmode was not declared in this scope
@jackleone1206
@jackleone1206 4 ай бұрын
do "pinMode" not "pinmode" thats what got me. hope this helps someone
@Sabbir-ln3bx
@Sabbir-ln3bx 9 ай бұрын
how do you use it with LEDs?
@Science.Buddies
@Science.Buddies 8 ай бұрын
Please see our Arduino tutorial playlist which covers LEDs: kzbin.info/aero/PLlBVuTSjOrclb0iCMSRpS_H1lSrlSVeEm&si=cyCw5jX3CNvyX5me
@Sirrah1130
@Sirrah1130 2 сағат бұрын
@@Science.Buddies my brother in Christ you linked the same playlist that we are on and none of the videos explain how to use an LED in conjuction with the supersonic sensor lol
@gauthierwouters2593
@gauthierwouters2593 Жыл бұрын
how to do the lights?
@Science.Buddies
@Science.Buddies Жыл бұрын
If you check out our Arduino tutorial playlist (linked in the description) you will find other videos about controlling LEDs.
@bfuh_055
@bfuh_055 7 ай бұрын
Does this sensor also detect the intensity of the reflected wave?
@Science.Buddies
@Science.Buddies 7 ай бұрын
No, it only detects how long it took the wave to bounce back.
@Howdy-Harry
@Howdy-Harry 7 ай бұрын
Amazing
@cal7772
@cal7772 Ай бұрын
I am definitely failing this class omg
@SunbeamVaruna-ef3pp
@SunbeamVaruna-ef3pp 5 ай бұрын
@GrahamEisele
@GrahamEisele 5 ай бұрын
Its just reading 0 for me.
@Idontknow4
@Idontknow4 4 ай бұрын
you might not have the wires connected correctly make sure 5v in vcc ground in ground and that you have trigpin and echopin connected to the correct pin on the arduino to make it match with the code
Control a Positional Servo Motor with an Arduino (Lesson #10)
8:28
Science Buddies
Рет қаралды 66 М.
The evil clown plays a prank on the angel
00:39
超人夫妇
Рет қаралды 53 МЛН
1% vs 100% #beatbox #tiktok
01:10
BeatboxJCOP
Рет қаралды 67 МЛН
We Attempted The Impossible 😱
00:54
Topper Guild
Рет қаралды 56 МЛН
Arduino Tutorial 53: Understanding and Connecting the HC-SR04 Sensor
40:32
PING Ultrasonic Distance Sensor and Arduino (Lesson #8)
5:14
Science Buddies
Рет қаралды 30 М.
How to Blink an LED with Arduino (Lesson #2)
15:57
Science Buddies
Рет қаралды 144 М.
Raspberry Pi 4: The Ultimate Ultrasonic Sensor Guide
7:12
RaspBerry Pi Made Easy
Рет қаралды 46 М.
Sensors - which one to use
17:06
Electronoobs
Рет қаралды 1,4 МЛН
How to Control a Servo with an Ultrasonic Sensor and Arduino + Code
21:38
Rachel De Barros
Рет қаралды 3,8 М.
Make a TINY Arduino Drone with FPV Camera - Will It Fly?
20:26
Max Imagination
Рет қаралды 1,5 МЛН
Waterproof Ultrasonic Distance Sensors - JSN-SR04T & A02YYUW 💧☔
32:11
DroneBot Workshop
Рет қаралды 205 М.
The evil clown plays a prank on the angel
00:39
超人夫妇
Рет қаралды 53 МЛН