STM32F4 Nucleo - Keil 5 IDE with CubeMX: Tutorial 37 - HC-SR05 Ultrasonic Sensor

แชร์
ฝัง
  • เผยแพร่เมื่อ 23 มิ.ย. 2024
  • This tutorial shows how to run the HC-SR05 Ultrasonic Sensor on STM32 MCUs, using two methods; 1) Normal GPIO and polling, 2) Input Capture timer to measure echo pulse width accurately.
    Source files:
    github.com/MYaqoobEmbedded/ST...
    Ultrasonic Arduino tutorial:
    • Ultrasonic Sensor HC-S...
  • วิทยาศาสตร์และเทคโนโลยี

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

  • @juansebastiana.8573
    @juansebastiana.8573 4 ปีที่แล้ว +2

    Thank you very much!
    Was looking for this example for a while and it worked perfectly on my STM32L476

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

    This is an awesome tutorial! The detail and pace are perfect!

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

    A very good tutorial with a very very good explanation. Thanks! It helps me a lot.

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

    Another great tutorial by mutex embedded that works perfectly, I used HC-SR04 rather than HC-SR05 , also I am using STM32F4 discovery board, all your methods worked perfectly

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

    Outstanding presentation!

  • @ashishsoni4210
    @ashishsoni4210 5 ปีที่แล้ว

    Love You, Sir, Please keep uploading videos like this.
    Sir Can you RFID RC522
    Sensor and Servo Motor next

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

    All your videos are very useful
    You can do video tutorial about Modbus rtu
    I think it's a very good topic.
    Use Modbus RTU to connect to HMI

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

    Thank you for this great video, and I wonder if you have a tutorial to show how to view the measurements in an lcd display ?

  • @fabio-cv8xw
    @fabio-cv8xw 11 หลายเดือนก่อน

    great video

  • @ivansimeonov8814
    @ivansimeonov8814 3 หลายเดือนก่อน

    Hi, great video! Can I ask you if it would be possible to use the same trigger pin for 2 transducers?

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

    Thanks !!!!!

  • @chanonkuansri586
    @chanonkuansri586 3 ปีที่แล้ว

    Thank you :)

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

    Hi nice tutorial! I have a question: can i use and interrupt for the echo pin in rising and falling edge, where in rising edge i start a timer and in falling edge i get the timer value? I have 4 HC-SR05 sensors which i need to check in separate tasks in non blocking mode. Are there alternatives to the Input Caputre timer method suitable for my case?

    • @mutexembedded2206
      @mutexembedded2206  4 ปีที่แล้ว

      Yes, you can use the 4 timer channels for this and use a single base timer in Input Capture Mode.
      You get captured value on both rising and falling, calculate the difference between them. Non-blocking.

    • @TheOldProgramming
      @TheOldProgramming 4 ปีที่แล้ว

      ​@@mutexembedded2206 Do you mean that if i use 4 channels of the same timer in Input Capture Mode they will work simultaneously? Or i have to use 4 timer each one with 1 channel dedicated to Direct Input Capture? I am asking this for my rc car project in which i am using freertos + edf scheduler implemented using EsFree library. What i want is to fire every 60 ms the task for sensor measurement(the other task for the other sensors will fire at 61 ms and so on...). The problem of using blocking measurements is that some tasks miss their deadlines.

  • @MrLegitFlip
    @MrLegitFlip 5 ปีที่แล้ว

    Can you do a tachometer project video calculating rpm with the stm32?

  • @pusatberk4193
    @pusatberk4193 5 ปีที่แล้ว +4

    Please UDP and TCP example

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

    Thanks so much for making this. I have done everything you did, it compiles fine there is no error, but when I go to view the output in realterm there is no output. The only difference I can think of is that I am using HCSR04 instead of 5 so I dont have that extra out pin but it seems like you didnt use it. Is there anything you can think of, I have been stuck on this for days. Thanks so much!

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

      Hi! I'll also use HCSR04 instead of 5, I'm wondering if you solve the problem or if you have the link for the code, I'd be very thankful if you help me.

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

    Where do you set the function HAL_TIM_IC_CaptureCallback as the callback of timer?
    I see you simply create this function but i do not understand how you linked to the timer.

  • @romiolover6852
    @romiolover6852 5 ปีที่แล้ว

    hello Sir nice video, i would like to ask you if you could make a tutorial of USB device audio class, as an examples generate sine wave and send it over the USB to a PC so we can hear it or record it using a software and many thanks again for your effort.

  • @MikhailGoncharov-tl4cr
    @MikhailGoncharov-tl4cr 2 หลายเดือนก่อน

    you are the best at all. pleASE SHOW US HOW TO DID MY OWN MP3 PLAYER. type by step

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

    Question: Aren't we supposed to oscillate the piezoelectric device when transmitting the sound wave? or is the 10uS being a single wave?

  • @vynguyenhoangquoc2702
    @vynguyenhoangquoc2702 3 ปีที่แล้ว

    hey man, in realterm my computer can't recognize which port being used, how can i solve it ??

  • @igort5418
    @igort5418 4 ปีที่แล้ว +4

    35min video, nearly 400 lines of code, just to use an ultrasonic sensor, thats why arduino is so popular.

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

      unfortunetaly, my senior design class wants me to use stm instead, so i'm super thankful for this video

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

    i cant able to understand how to set ARR ,reset the flag reinitialise the timer (inside the function of usdelay)

  • @kaihash4011
    @kaihash4011 7 หลายเดือนก่อน

    Can this be applied to stm32G0B1CE microcontroller?

  • @rwbazillion
    @rwbazillion 5 ปีที่แล้ว

    Awesome, I was going to do this as well. I am inspired by your videos, I want to do my own that will compliment your videos. I have already done a driver for an epaper LCD display and also a state machine using a function pointer, and a 5x5 keypad and 3x4 keypad using your keypad as a guide. I am wondering what are you using to develop your tutorials because I want to use a similar tool. I also got a camera that I want to use as well. If you check out my TH-cam page I have already done a tutorial on timers and the usage of timers in software where you can create your own timers for applications.
    I'm going to add this ultrasonic to my state machine project and my next tutorial will be about different state machines from standard, and hierarchical state machines.

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

    Классный видос. У мен получилось тоже самое на stm32f0discavery (stm32f051r8t6) сделать

  • @Engineer_Valat
    @Engineer_Valat 5 ปีที่แล้ว

    Modbus RTU or Modbus TCP/IP Please...

  • @JAGANNATHSAHOOtheraw
    @JAGANNATHSAHOOtheraw 5 ปีที่แล้ว

    Pls do some videos on interfacing of esp8266 with rtos

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

    I still cannot measure even though htim3.Init.Period is set to 1000000 - 1

    • @fernandoborda6422
      @fernandoborda6422 3 ปีที่แล้ว

      hello man i have the same issue for some reason is not workin did you solved it?

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

    I have a problem. The distance float is not showing up in my serial capture. There is no value. It is just blank (CRLF and then next line).

    • @mutexembedded2206
      @mutexembedded2206  3 ปีที่แล้ว

      Hi, Need to enable float printf in project settings, using STM32CubeIDE?

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

      @@mutexembedded2206 That was it, thank you very much :)

  • @JAGANNATHSAHOOtheraw
    @JAGANNATHSAHOOtheraw 5 ปีที่แล้ว

    Grt work