Connecting a Ultrasonic Sensor to the

Поделиться
HTML-код
  • Опубликовано: 14 июл 2024
  • Sorry for the re-upload. There was an error in my first tutorial. Rather than risk someone damaging their Pico, I thought it was best to take it down and try again.
    Okay... Program wasn't the best way to end the title of the video but... I didn't want to break the P pattern!
    This has so many applications! Self-Driving robots, backup alarms, something that prevents coworkers from sneaking up on you.
    The code used in this demo:
    github.com/printnplay/Pico-Mi...
    Wiring Diagram:
    github.com/printnplay/Diagram...
    Download the Thonny IDE:
    thonny.org/
    Download the MicroPython firmware for your Raspberry Pi Pico:
    www.raspberrypi.org/documenta...
    ----
    Pick up your board here!
    www.raspberrypi.org/products/...
    -- Like what I'm doing here? Want early access to content, models, and more? Check me out on Patreon !
    www.patreon.com/jcprintnplay
    -- Follow me on the Intrawebs! --
    Twitter - @jcprintnplay
    Instagram - @jcprintnplay
    Facebook - / jcprintnplay
    Thingiverse - www.thingiverse.com/jcprintnp...
    Reddit - / printnplayyt
    Print n Play In Detail -
    / @printnplayindetail2415
    Print n Play Shortz -
    / @printnplayshortz9489
    #RaspberryPi #Pico #MicroPython
  • НаукаНаука

Комментарии • 47

  • @IQWorkshop
    @IQWorkshop 3 года назад +1

    Nice video. Informative, to the point and kept things moving. Nice work!

    • @PrintNPlay
      @PrintNPlay  3 года назад +1

      Thank you! Hoping to do a whole series of quick no filler videos. Glad people like them!

  • @UDoIt2
    @UDoIt2 3 года назад +1

    Great video James. Love how you highlighted Augustin's finding. There are also level translators that can be used for this, such as the TXS0104E or the ADuM7440, ADuM7441 or the ADuM7442 - I have the 1Mbps version that can get a little iffy with fast signals so this should work for the ultrasonic application. They also have a 25Mbps.

    • @PrintNPlay
      @PrintNPlay  3 года назад +2

      Good to know! Always glad to learn different ways to do things. Thanks for the info

  • @robmorrill3189
    @robmorrill3189 2 года назад

    Thanks for a good video here. I'd love to see one in which you walk through creating a robot that uses a distance sensor to control motors with the Pico.

  • @J-D_
    @J-D_ 3 года назад +2

    Great video James!!!

  • @datagod
    @datagod 3 года назад +4

    Short and sweet!

  • @techwithjoe8636
    @techwithjoe8636 3 года назад +1

    The DHT11 and DHT22 sensors would be very nice!!! :)
    I know there are some libraries but I didn't got them working correctly

  • @anokhautomation4453
    @anokhautomation4453 3 года назад

    Nice project 👍

  • @christiaang
    @christiaang 3 года назад +3

    Thanks for this nice video. Very helpful. Are you interested in making a video about I2C wired sensors like a BMP280 for example?

  • @welshdave5263
    @welshdave5263 3 года назад +2

    Ooh, am I first?
    I've been given a Pico so now I want to dig out the ultrasonic I have floating around somewhere.

    • @PrintNPlay
      @PrintNPlay  3 года назад +1

      You are certified first!

  • @mmshilleh
    @mmshilleh Год назад +1

    Solid video man, can the sensor be used standalone with the raspberry pi pico? Or do I need the resistor and the other component?

    • @PrintNPlay
      @PrintNPlay  Год назад +1

      The Pico runs internally on 3.3v, whereas the sensor is 5v. So, without the resistors, it puts 5v into a pin designed to handle 3.3v. It may work for a while, but it can damage the Pico over time. So, in short, the resistors are to protect the Pico!

    • @davidtomic1010
      @davidtomic1010 10 месяцев назад

      @@PrintNPlay Actually sensor accepts 3.3v - 5v (model: HC-SR04, I think it's the same), at least by documentation.

  • @ayvarnuriev4804
    @ayvarnuriev4804 Год назад +2

    Thank you for the video! Could you please clarify one thing? In the wiring diagram Echo is connected to GP18 (Pin.OUT) and Trig is connected to GP26 (Pin.IN). Should not the Echo and Trig be swapped? According to the HC-SR04 description Echo is the receiver and Trig sends the pulses. In my case, if I follow the wiring diagram, the reported distance is always 0. The sensor starts working only when I connect Echo to Pin 26 and Trig to Pin 18.

    • @qus.9617
      @qus.9617 Год назад

      Other online tutorials are telling me the same thing. My understanding is it doesn't matter if sensor trigger pin gets 3.3v from the pico, according to another tutorial it is still sufficiently high enough voltage to work for logic high. Ummm I haven't tested this yet so I am getting conflicting information here. It is echo that is problematic because HC-SR04 will output 5V from the echo pin which is more than the pico is designed to handle. Hence the need for a lower voltage conversion...

  • @baldusvomwaldus9658
    @baldusvomwaldus9658 Год назад

    Good vid

  • @TheUnofficialMaker
    @TheUnofficialMaker 3 года назад +2

    error in code: if loopcount>3000: exitLoop = True, not ==True as shown.

  • @phmiii
    @phmiii 3 года назад +2

    Thank you, How about demonstrating a Sharp IR sensor.

  • @bocard80
    @bocard80 2 года назад +2

    Would there be a way to have this only turn on at certain times. I want to mount one on my front bumper so I don't hit the lip on the curb. How would I activate it only when parking so it isn't beeping 24-7 lol?

    • @PrintNPlay
      @PrintNPlay  2 года назад +2

      The easiest way would probably be to add a toggle switch to the circuit. Changing the code to have an on/off status which changes when the button is pressed, and perhaps an LED that indicates if it is on or off.
      Glad to help if you need any!

  • @MrBobn8r
    @MrBobn8r 2 года назад

    Enjoyed the video and I think I will find it and the code example useful. I have an idea for a light in my garage that will come on and tell me when to stop. What is the range of the sensor? Would this be a good project to try? I am open to suggestions and new ideas. thanks,

    • @PrintNPlay
      @PrintNPlay  2 года назад

      Sorry for the delay in reply! I certainly think it would work for your purposes. I haven't found a definitive answer to its range, and haven't had a chance to wire it back up and test it. Buy I think I had tested it for 8 - 10 feet. I think this is likely the best option for something that doesn't need a piece mounted on the floor to reflect something. You could also use an image sensor that triggers when the color it senses suddenly changes. Or a motion sensor that triggers a laser diode that shines through the windshield onto a designated spot on the dashboard... there's a few ways to make this happen. I'm curious to see what you come up with.

  • @neutron-au
    @neutron-au 2 года назад +1

    I'm quite late to this video, but what is the maximum range that the sensor can work reasonably accurately? Cheers!

    • @PrintNPlay
      @PrintNPlay  2 года назад +1

      I'll be honest I've never tested it! I will see if it's documented

  • @gartmorn
    @gartmorn 3 года назад +1

    Does the circuit need any kind of calibration or is its accuracy purely based on the speed of sound?

    • @PrintNPlay
      @PrintNPlay  3 года назад +2

      Accuracy is based on the speed of sound.

  • @dudesemidecent894
    @dudesemidecent894 2 года назад

    pleas do more in depth on bread board wiring

  • @sagarbhalsing5046
    @sagarbhalsing5046 3 года назад +1

    I haven't solder the header pins with pico. I just placed the pico board on header pins is it okay or i need to solder it.

    • @PrintNPlay
      @PrintNPlay  3 года назад

      Without soldering them, or having something that holds everything together, it will be very easy for those pins to get bumped and disconnected. Might cause you some headaches

    • @sagarbhalsing5046
      @sagarbhalsing5046 3 года назад

      @@PrintNPlay okay

  • @simonperezrodriguez5723
    @simonperezrodriguez5723 3 года назад +2

    Good video, but I have a question, What if i use an external powe supply for the ultrasonic sensor?, Need I the resistors though?

    • @PrintNPlay
      @PrintNPlay  3 года назад

      Unless your ultrasonic sensor can run reliably off 3.3v, you need the resistors to prevent it from putting more that 3.3v into the Pico went it sends it's signal.

    • @simonperezrodriguez5723
      @simonperezrodriguez5723 3 года назад

      @@PrintNPlay Thanks!!

  • @mdmarcaassport
    @mdmarcaassport Год назад

    You don't explain the purpose of those two resistors and the way you selected the pins. I supose you have explained it in the previous video. I'm going to check it out

  • @kaushikparthasarathi3802
    @kaushikparthasarathi3802 Год назад

    Can u interface rf module using pico

  • @markosullivan7538
    @markosullivan7538 3 года назад +1

    Is it measuring in mm? Can it be changed to measure in cm and also displayed on a small oled?

    • @PrintNPlay
      @PrintNPlay  3 года назад

      I'm actually going to have to go back and see what I set the math up for (am away from the computer ATM) but, yeah you can totally calculate it in any unit you want, and display it on something like an ssd1306 based display

    • @markosullivan7538
      @markosullivan7538 3 года назад

      @@PrintNPlay thanks for getting back. Would be great to see how that could be done.

  • @iC3mdbN
    @iC3mdbN 3 года назад

    I have a HC-SR04, the datasheet says: Signal Level (Trigger, Echo): TTL Pegel (L < 1,0V)
    -> I´d interprate that as "max 1V through the echo and trigger pin" -> If correct, I´d not need the resistors, do I? But not sure :S

    • @PrintNPlay
      @PrintNPlay  3 года назад

      I'm not great with datasheets, but I think it's saying it considers low bellow 1v? I am not sure either.

  • @christianwilson6480
    @christianwilson6480 3 года назад +1

    What is the pizo speaker for?

    • @PrintNPlay
      @PrintNPlay  3 года назад +1

      The speaker is what is generating the audio tone in the video. It's not needed for the sensor to work, was just used to demonstrate how you could use it for something like a backup sensor

  • @sagarbhalsing5046
    @sagarbhalsing5046 3 года назад

    Please help me sir I'm getting this statement after running the code
    WARNING:root:Unexpected echo. Expected b'
    ', got b''

  • @oliviersteve
    @oliviersteve 2 года назад

    Can you try a anenometer

  • @Sttreg
    @Sttreg Год назад

    I am really confused with your code. Here is my understanding of it: line 11: you make sure nothing is sent, and you wait 20 microseconds. then line 13, you send a signal, wait 10 micro second, and then turn it off, and then you start counting the delay? But your signal is already sent out?