Comments on: ESP32 with HC-SR04 Ultrasonic Sensor with Arduino IDE https://randomnerdtutorials.com/esp32-hc-sr04-ultrasonic-arduino/ Learn ESP8266, ESP32, Arduino, and Raspberry Pi Tue, 25 Mar 2025 10:42:07 +0000 hourly 1 https://wordpress.org/?v=6.8.2 By: Sara Santos https://randomnerdtutorials.com/esp32-hc-sr04-ultrasonic-arduino/#comment-1019685 Tue, 25 Mar 2025 10:42:07 +0000 https://randomnerdtutorials.com/?p=104435#comment-1019685 In reply to John.

Hi.
Which board are you selecting in Tools > Board?

Regards,
Sara

]]>
By: John https://randomnerdtutorials.com/esp32-hc-sr04-ultrasonic-arduino/#comment-1019469 Mon, 24 Mar 2025 17:54:14 +0000 https://randomnerdtutorials.com/?p=104435#comment-1019469 Hi Sara, I just started experimenting with the ESP32C3 supermini. The board is loaded into the IDE, and after copy and pasting the sketch from the webpage, a test compile reports “loading library from c:\Users****\Documents\Arduino\libraries\tempbeta: invalid library: no header files found”. Can you tell me what I missed?

]]>
By: Prof. K. R. Rao https://randomnerdtutorials.com/esp32-hc-sr04-ultrasonic-arduino/#comment-914001 Fri, 10 May 2024 02:45:28 +0000 https://randomnerdtutorials.com/?p=104435#comment-914001 Hello Sara ! Greetings !
Very Nice tutorial
I used HC-SR04 that you shown in the tutorial.
I powered the board (HC-SR04) with 3V3 (Vcc=3.3V) that comes from ESP32 WROOM32 and wired as Echo=GPIO16, Trigger=GPIO17.
It works fine.

]]>
By: Akshay https://randomnerdtutorials.com/esp32-hc-sr04-ultrasonic-arduino/#comment-882108 Fri, 05 Jan 2024 10:00:04 +0000 https://randomnerdtutorials.com/?p=104435#comment-882108 My operating range is around 4-5 meters, SO HC-SR04 Ultrasonic Sensor can do that.

Or if you know any please mentioned

]]>
By: Sara Santos https://randomnerdtutorials.com/esp32-hc-sr04-ultrasonic-arduino/#comment-877737 Thu, 14 Dec 2023 13:00:39 +0000 https://randomnerdtutorials.com/?p=104435#comment-877737 In reply to Graham.

Thanks for the feedback.
Regards,
Sara

]]>
By: Graham https://randomnerdtutorials.com/esp32-hc-sr04-ultrasonic-arduino/#comment-877058 Sun, 10 Dec 2023 16:34:26 +0000 https://randomnerdtutorials.com/?p=104435#comment-877058 THANKS!
My first attempt worked fine as above.

A second and third circuit failed but as soon as I added level shifters all was fine.

So it seems some ESP cards do indeed need level shifters.

Beware!

]]>
By: Daniel Jaramillo https://randomnerdtutorials.com/esp32-hc-sr04-ultrasonic-arduino/#comment-859766 Sun, 10 Sep 2023 23:08:41 +0000 https://randomnerdtutorials.com/?p=104435#comment-859766 In reply to Sara Santos.

Hello Sara and Juergen.
I’m also confused and would like to know why it outputs 3.3V
I’ve serched the HC-SR04 datasheet and it says indeed the output is 5V, but the oscilloscope reads 3.3V.

Why?
Thank you!

]]>
By: omer https://randomnerdtutorials.com/esp32-hc-sr04-ultrasonic-arduino/#comment-834241 Wed, 10 May 2023 21:26:28 +0000 https://randomnerdtutorials.com/?p=104435#comment-834241 Thank you for this amazing tutorial,
I have one question, how can i change the output of distance units on the display ( cm in this case ) to Percentage % ? as i want measure water level in a tank .
thank you

]]>
By: Sara Santos https://randomnerdtutorials.com/esp32-hc-sr04-ultrasonic-arduino/#comment-830404 Sun, 16 Apr 2023 20:26:09 +0000 https://randomnerdtutorials.com/?p=104435#comment-830404 In reply to Riley.

Hi.
Take a look at this guide: https://randomnerdtutorials.com/esp32-troubleshooting-guide/
Regards,
Sara

]]>
By: Riley https://randomnerdtutorials.com/esp32-hc-sr04-ultrasonic-arduino/#comment-830032 Fri, 14 Apr 2023 12:49:57 +0000 https://randomnerdtutorials.com/?p=104435#comment-830032 In reply to Sara Santos.

Hello! I have an error in my code that says:

Le croquis utilise 273309 octets (20%) de l’espace de stockage de programmes. Le maximum est de 1310720 octets.
Les variables globales utilisent 22808 octets (6%) de mémoire dynamique, ce qui laisse 304872 octets pour les variables locales. Le maximum est de 327680 octets.
esptool.py v4.5.1
Serial port COM19
Connecting….
Chip is ESP32-D0WDQ6 (revision v1.0)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 08:3a:f2:7d:5f:d4
Uploading stub…
Running stub…
Stub running…
WARNING: Failed to communicate with the flash chip, read/write operations will fail. Try checking the chip connections or removing any other hardware connected to IOs.
Configuring flash size…
Flash will be erased from 0x00001000 to 0x00005fff…
Flash will be erased from 0x00008000 to 0x00008fff…
Flash will be erased from 0x0000e000 to 0x0000ffff…
Flash will be erased from 0x00010000 to 0x00052fff…
Compressed 17520 bytes to 12170…

A fatal error occurred: Packet content transfer stopped (received 8 bytes)
A fatal error occurred: Packet content transfer stopped (received 8 bytes)

I can’t seem to find a way to fix this error. The code has been checked and it has no error. I have tried in different computers and it keeps having the same problem. I’ve even tried different codes but it seems to have the same thing.

Thank you very much!

Have a great day,

Riley Smith

]]>