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 - Наука
Nice video. Informative, to the point and kept things moving. Nice work!
Thank you! Hoping to do a whole series of quick no filler videos. Glad people like them!
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.
Good to know! Always glad to learn different ways to do things. Thanks for the info
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.
Great video James!!!
Short and sweet!
The DHT11 and DHT22 sensors would be very nice!!! :)
I know there are some libraries but I didn't got them working correctly
Nice project 👍
Thanks for this nice video. Very helpful. Are you interested in making a video about I2C wired sensors like a BMP280 for example?
Ooh, am I first?
I've been given a Pico so now I want to dig out the ultrasonic I have floating around somewhere.
You are certified first!
Solid video man, can the sensor be used standalone with the raspberry pi pico? Or do I need the resistor and the other component?
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!
@@PrintNPlay Actually sensor accepts 3.3v - 5v (model: HC-SR04, I think it's the same), at least by documentation.
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.
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...
Good vid
error in code: if loopcount>3000: exitLoop = True, not ==True as shown.
Thank you, How about demonstrating a Sharp IR sensor.
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?
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!
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,
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.
I'm quite late to this video, but what is the maximum range that the sensor can work reasonably accurately? Cheers!
I'll be honest I've never tested it! I will see if it's documented
Does the circuit need any kind of calibration or is its accuracy purely based on the speed of sound?
Accuracy is based on the speed of sound.
pleas do more in depth on bread board wiring
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.
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
@@PrintNPlay okay
Good video, but I have a question, What if i use an external powe supply for the ultrasonic sensor?, Need I the resistors though?
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.
@@PrintNPlay Thanks!!
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
Can u interface rf module using pico
Is it measuring in mm? Can it be changed to measure in cm and also displayed on a small oled?
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
@@PrintNPlay thanks for getting back. Would be great to see how that could be done.
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
I'm not great with datasheets, but I think it's saying it considers low bellow 1v? I am not sure either.
What is the pizo speaker for?
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
Please help me sir I'm getting this statement after running the code
WARNING:root:Unexpected echo. Expected b'
', got b''
Can you try a anenometer
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?