Raspberry Pi LESSON 21: Using a HC-SR04 Ultrasonic Sensor For Echolocation

แชร์
ฝัง
  • เผยแพร่เมื่อ 24 ต.ค. 2024

ความคิดเห็น • 62

  • @vaughntaylor2855
    @vaughntaylor2855 2 ปีที่แล้ว +3

    Thank you Paul for another great lesson and thank you for so welcoming to my young grandson Chase! God Bless!

  • @arguedas02
    @arguedas02 2 ปีที่แล้ว +8

    Another great Raspberry Pi Lesson ! can't wait to start, thanks for you generosity making this free tutorial.
    Blessings to you and your family...

  • @cbrombaugh
    @cbrombaugh 2 ปีที่แล้ว

    I AM LEGEND! I took the easy way to finding the speed of sound because I did that exercise in Paul's Arduino course. I also found the "except" error in Paul's program. As usual, I wish to thank the best instructor on the Internet for another most-excellent lesson.

  • @larryplatzek9017
    @larryplatzek9017 2 ปีที่แล้ว +1

    Thank You Paul for another great lesson, sorry can watch when live!

  • @dphair3805
    @dphair3805 11 หลายเดือนก่อน

    Nice explanation on the workings of the HC-SR04. I connected the trigger and echo pins to my oscilloscope and it matched your drawing perfectly once I figured out the trigger function. By moving the distance of the object the echo on signal matched the movement and was close to the numbers on the screen.

  • @louisvillalta5092
    @louisvillalta5092 ปีที่แล้ว

    another great video from mr ballen w3schools and this guy saved my life

  • @ayman-tron
    @ayman-tron 2 ปีที่แล้ว

    Thanks for this great lesson Paul, it made me understand the concept behind an Ultrasonic sensor. I followed your tutorials for the Ultrasonic sensors step by step however my distance was off by a lot. I thought it could have been because my sensor was defective so bought a new one yet the distance reading was still off by a lot. After doing some research, I decided to connect the VCC of the Ultra sonic sensor to a 5V power supply and using a voltage divider get an input voltage of close to 3.3V for physical pin 18. And finally I was able to get the right reading.

  • @opalprestonshirley1700
    @opalprestonshirley1700 2 ปีที่แล้ว

    Sorry to have missed you this AM but I had a doctor's appointment. This has always been an enjoyable lesson. The best I've been able to accurately measure is 4'. God bless you and the family.

  • @AbdelrahmanAl-Manassra
    @AbdelrahmanAl-Manassra 6 หลายเดือนก่อน

    Another great lesson!! God bless you, Paul.

    • @paulmcwhorter
      @paulmcwhorter  6 หลายเดือนก่อน

      And may God richly bless you as well.

  • @chases9870
    @chases9870 2 ปีที่แล้ว +1

    Thank you so much for your videos Paul.

  • @Compuscience-Python-Prog-Exps
    @Compuscience-Python-Prog-Exps 10 หลายเดือนก่อน

    Yay. Mine works now. I did everything, yet the first while loop wouldn't let loose.
    But all is working for me now.

  • @danrichardson3203
    @danrichardson3203 2 ปีที่แล้ว

    Thank you. There is no such thing as a silly cat video. I really enjoy you lessons and appreciate your time/effort.

  • @stephenlightkep1621
    @stephenlightkep1621 ปีที่แล้ว

    As Jethro would say “Time to do some cyphering”! I got all messed up with this doing the arduino series I am hoping to do better now! Thanks Paul!

  • @tntragan
    @tntragan ปีที่แล้ว +1

    Let's get to calculating. Math is our friend. LET'S GO!!!

    • @paulmcwhorter
      @paulmcwhorter  ปีที่แล้ว +1

      Is it not sad this fundamental truth is not imparted to students in public schools. Schools teach students how to HATE math.

    • @tntragan
      @tntragan ปีที่แล้ว +1

      Agreed. Mostly they teach it as something that is required to graduate without any real world application. If the students could be shown, through something like this type of class, how helpful math is to get you to where you want to be and how much work it saves you, I think math would be something that students would enjoy taking instead of the drudgery it is made to be. I know I am enjoying math now far more than I did as a student in high school.

  • @cadmanof50s
    @cadmanof50s 8 หลายเดือนก่อน

    Excellent lesson as always Paul

  • @mpk491
    @mpk491 9 หลายเดือนก่อน

    Thanks for the great tutorial.

  • @davidbundy5365
    @davidbundy5365 2 ปีที่แล้ว

    Awesome, I now understand this sensor unlike when I've used it previously.
    My program seemed to lockup all the time, which I traced to watching your video's on my RPi in 720p60 resulting in CPU at >80% and the trigger pulse not correctly timed with no echo response being achieved and the code stuck looking for the echo pulse.
    🤣

  • @keithlohmeyer
    @keithlohmeyer 2 ปีที่แล้ว

    Nice explanation Paul. I have to say on Arduino I used the Newping library that hides the low level signal stuff. I thought I knew how the HC-SR04 worked but you showed I was a little off on my knowledge. Thanks again for the great teaching.

  • @scottwait3585
    @scottwait3585 2 ปีที่แล้ว

    Thanks for the video Paul! Really cool

  • @ianneill9188
    @ianneill9188 2 ปีที่แล้ว

    Great lesson, and an interesting subject generally. I know that the speed of sound is influenced by the air temperature. I am wondering how big a difference it makes, or is it not significant relative to the accuracy of the hardware?

  • @etiennegiovanni4909
    @etiennegiovanni4909 4 หลายเดือนก่อน

    Hi Paul, well I have the Raphael kit for Raspberry pi, and I already try some fun exercises thanks to you and your explanation but now I wanna try using the sensors such as ultrasonic sensors and the infrared sensors, I don’t know how you could help me with that knowing I’m using scratch 3 !
    I don’t do Python

  • @wanderingsaint2659
    @wanderingsaint2659 2 ปีที่แล้ว

    great tutorial ..... thanks for this lecture.
    I am working on Grove Ultrasonic sensor ....Can you please do a video on Grove Ultrasonic ranger .... It would be very helpful ....

    • @keithlohmeyer
      @keithlohmeyer 2 ปีที่แล้ว

      I don't have one but it looks like they use a single pin for both trig and echo. Looking at the grove test code these changes to Paul's code should work.
      import RPi.GPIO as GPIO
      import time
      GPIO.setmode(GPIO.BCM)
      trigEcho = 23 # combined pin for trig (output) and echo (input)
      try:
      while True:
      GPIO.setup(trigEcho,GPIO.OUT) # set signal pin for output
      GPIO.output(trigEcho,0)
      time.sleep(2E-6)
      GPIO.output(trigEcho,1)
      time.sleep(10E-6)
      GPIO.output(trigEcho,0)
      GPIO.setup(trigEcho,GPIO.IN) # set signal pin for input
      while GPIO.input(trigEcho)==0:
      pass
      st=time.time()
      while GPIO.input(trigEcho)==1:
      pass
      et=time.time()
      tt=et-st
      dist = round(tt * 13500 / 2, 2)
      print(dist)
      time.sleep(1)
      except KeyboardInterrupt():
      GPIO.cleanup()

  • @neilausten9404
    @neilausten9404 2 ปีที่แล้ว

    Another excellent lesson. With 95% of the world now using metric, inches and feet etc just seems a little old fashioned. I am surprised that the scientific community in the US hasn't lobbied harder to make the change.

    • @paulmcwhorter
      @paulmcwhorter  2 ปีที่แล้ว +1

      Neil, I honestly do not understand why everyone gets so hung up on units. In science and engineering, all unit systems are completely arbitrary, and any one works as good as any other. I am just as comfortable working in furlongs as meters. They are both completely arbitrary dimensions, and to solve any real engineering problem, you must be prepared to do dimensional analyses.

  • @noweare1
    @noweare1 ปีที่แล้ว +2

    I could not get anything working until I powered the module with 5 volts. Ugh.

    • @bigeck24
      @bigeck24 ปีที่แล้ว

      same with me, i checked the data sheet for the hc-sr04, it said it should have a 5v input. With 3.3v i would get 1 or 2 results, the script would then hang in the loop and CPU usage of the pi would hang at 100%..... using the 5v pin sorted it out!

    • @sem1ot1c
      @sem1ot1c ปีที่แล้ว

      For me it sort of worked but only gave me repeated 5 or 6 with the occasional 10 or 12 in the readout. Changed to 5v and all OK.

  • @rhijaz8351
    @rhijaz8351 2 ปีที่แล้ว

    Sir! It shall be of great help if yoy start a series on ROS

  • @Алексей-л7о4ю
    @Алексей-л7о4ю ปีที่แล้ว

    Why do you compare the time of start of sonic signal and the end of sonic signal? We have to compare the time when sending signal was started end the time when we start to receive echo signal, do we?

  • @owiiview9730
    @owiiview9730 ปีที่แล้ว

    If your HC SR04 not working properly, don’t worry, it is because it supports to operate with 5v not 3.3v. But keep in mind, if you connect the vcc to the 5v pin, echo pin will output voltage at 5v, which may damage your GPIO pin if you take that as input (supports to be between 1.8 to 3.3v). The solution is simple, you need two resistors in series to creat a voltage divider. Please google if you don’t know how.

  • @josephdscordio2862
    @josephdscordio2862 2 ปีที่แล้ว

    Hey what's up 😁 , could you do the SOLIDWORKS tutorials if you have a free time ?

  • @alldaypancakes7058
    @alldaypancakes7058 2 ปีที่แล้ว

    i just want to say that you help me alot thank you so much i owe you so much the only way i can pay you is with a like and a veiw

  • @rohanaggarwal8718
    @rohanaggarwal8718 2 ปีที่แล้ว

    U should post more of these faster you will get more views and the algorithm will think ur post fast and so it will recommend to everyone

  • @zacharycarter7377
    @zacharycarter7377 2 ปีที่แล้ว

    Paul can you please show how to use NF240l radio signals on arduino?

  • @mezodgaming5637
    @mezodgaming5637 2 ปีที่แล้ว

    Waiting

  • @farshidowrang2762
    @farshidowrang2762 ปีที่แล้ว

    Takk!

    • @paulmcwhorter
      @paulmcwhorter  ปีที่แล้ว

      Thanks! Really appreciate the support.

  • @Compuscience-Python-Prog-Exps
    @Compuscience-Python-Prog-Exps 10 หลายเดือนก่อน

    It's not working for me at all. Sht. I'm not using the one that comes this his kit. I'm using the HC without the 4+
    5V is what I'm using here. But the program shows nothing to me.

  • @neilausten9404
    @neilausten9404 2 ปีที่แล้ว

    I wonder if anyone else gets the same error message when I run the program. ie an error at line 24, except KeyboardInterrupt(): which says "catching classes that do not inherit from BaseException is not allowed". I'm sure I copied the PMcW program exactly, line by line. I don't understand the meaning of this error message.

    • @paulmcwhorter
      @paulmcwhorter  2 ปีที่แล้ว

      my mistake . . . Keybordinterrupt should not have a ().

    • @neilausten9404
      @neilausten9404 2 ปีที่แล้ว

      @@paulmcwhorter Thank you, should have worked that one out by myself.

  • @itsmeintorrespain2714
    @itsmeintorrespain2714 2 ปีที่แล้ว +1

    Homework submission :- th-cam.com/video/AOfQZS7dJQQ/w-d-xo.html .

  • @arlo4051
    @arlo4051 2 ปีที่แล้ว +1

    Lesson completed at th-cam.com/video/dKSU-63RLcs/w-d-xo.html . It's amazing how much variance the distance readout is with just a little deviation of target alignment.

    • @paulmcwhorter
      @paulmcwhorter  2 ปีที่แล้ว

      Yes, pretty easy to get a bad reading if you are not careful.

  • @e4ent23
    @e4ent23 2 ปีที่แล้ว

    18min

  • @davidschnider1297
    @davidschnider1297 ปีที่แล้ว

    Well that was another fun class... . THANK YOU, Paul.... here is my solution to the homework assignment. ... to calculate the distance to an object in INCHES : th-cam.com/video/8PSPxgkkCAc/w-d-xo.html

  • @emmacotex2288
    @emmacotex2288 2 ปีที่แล้ว

    Cool are you on Instagram sir