How to Use ESP32 with HCSR04 Ultrasonic Sonar sensor and Arduino IDE

  Рет қаралды 55,897

INOVATRIX

INOVATRIX

Күн бұрын

Пікірлер: 39
@ravinduyahampath2220
@ravinduyahampath2220 4 ай бұрын
i m get error in distance is always 0
@vinnysworkshop
@vinnysworkshop 6 ай бұрын
My HC-SR04 works on 5 volts, not 3.3. I do appreciate that you don't use an HC-SR04 library though.
@knowledge_seeker80
@knowledge_seeker80 Жыл бұрын
By the way, after a research can get data from ultrasonic module just by using 2 wires by carry data over dc lines :)
@gonzaflex
@gonzaflex 11 ай бұрын
can you share the link to read about?
@lawlliet1253
@lawlliet1253 6 ай бұрын
With a esp8266 its the same process?
@alexandredamiao1365
@alexandredamiao1365 4 ай бұрын
Thank you very much for this great content!
@nehaharpal1341
@nehaharpal1341 2 ай бұрын
Thank you so much!! THIS WORKSSS!!
@dempseyprecisionltd5381
@dempseyprecisionltd5381 7 ай бұрын
Thank you, working fine
@infinityviews433
@infinityviews433 12 күн бұрын
thank you you fried my esp32 (:
@UpskillwithAI
@UpskillwithAI 11 ай бұрын
how do i open the link to see the code and circuit
@INOVATRIX
@INOVATRIX 11 ай бұрын
All given in description.
@gonzaflex
@gonzaflex 11 ай бұрын
distances under 40 cm can be measure without problem, more that that i just get random values. Any idea how solve it?
@INOVATRIX
@INOVATRIX 11 ай бұрын
That is the approximate limit of the sensor. For more range you'll need to use more expensive and accurate sensor
@gonzaflex
@gonzaflex 11 ай бұрын
i am using one HCSR04 with one Arduino Mega 2560 and can measure easily 2 mts in a water tank, but with ESP32 works bad, any idea?@@INOVATRIX
@hithushmohanaraja1133
@hithushmohanaraja1133 10 ай бұрын
Will the same code work for esp8266?
@INOVATRIX
@INOVATRIX 10 ай бұрын
Yes it should work, just make sure that you select the right pins.
@hithushmohanaraja1133
@hithushmohanaraja1133 10 ай бұрын
@@INOVATRIX tysm!
@hithushmohanaraja1133
@hithushmohanaraja1133 10 ай бұрын
The distance is always 0 cm. I am using a 3 3v esp8266. What is the issue?
@utmocanimations4136
@utmocanimations4136 9 ай бұрын
I ran mine with a similar code, but it keeps sending me the Distance:0
@bandulaudeni2626
@bandulaudeni2626 7 ай бұрын
Me to😢😢😢
@snemo334
@snemo334 6 ай бұрын
Because the vcc input for ultrasonic sensor is 5v and the output of esp 32 is 3.3v thus the low power and malfunction try to use other mcu as 5v output
@bandulaudeni2626
@bandulaudeni2626 8 ай бұрын
Thanks you so mutch
@daren021
@daren021 8 ай бұрын
IF YOU HAVE 0CM USE 5V instead of 3,3V!!!!!!!!!!!!!
@nrlauliasaid8007
@nrlauliasaid8007 7 ай бұрын
i get a measurement of 0 how do i change it to 5V
@daren021
@daren021 7 ай бұрын
@@nrlauliasaid8007 there is a 3,3v and a 5v output on the esp32 change it to 5v
@bandulaudeni2626
@bandulaudeni2626 7 ай бұрын
How i can do it
@nurhijran8287
@nurhijran8287 Жыл бұрын
thanks man it works
@bostonmacosx
@bostonmacosx Жыл бұрын
This board iS 5V..... not great.
@fleen5177
@fleen5177 7 ай бұрын
AliExpers has a new version for 3-5 volts
@francisfajardo4002
@francisfajardo4002 8 ай бұрын
Thanks!
@by_jhona
@by_jhona Жыл бұрын
O meu sensor ultrasonico hc sr04 nao está funcionando no 3.3v, sabe o que poderia resolver?
@INOVATRIX
@INOVATRIX Жыл бұрын
Connect power to VIN pin on the ESP32 Board.
@by_jhona
@by_jhona Жыл бұрын
@@INOVATRIX to receive the echo return, would there be damage to the esp32 input pin?
@viniciusdemenezescosta9958
@viniciusdemenezescosta9958 9 ай бұрын
thanks
@NotHumant8727
@NotHumant8727 Жыл бұрын
bad. It is not async and uses blocking functions. slow
@bandulaudeni2626
@bandulaudeni2626 8 ай бұрын
No its good😊😊
@edwinawariyah6239
@edwinawariyah6239 Жыл бұрын
Use this code instead and connect the VCC to VIN (Notice I changed the pins and the serial monitor baud) #include #define echoPin 18 // CHANGE PIN NUMBER HERE IF YOU WANT TO USE A DIFFERENT PIN #define trigPin 5 // CHANGE PIN NUMBER HERE IF YOU WANT TO USE A DIFFERENT PIN long duration, distance; void setup(){ Serial.begin (115200); pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT); } void loop(){ digitalWrite(trigPin, LOW); delayMicroseconds(2); digitalWrite(trigPin, HIGH); delayMicroseconds(10); digitalWrite(trigPin, LOW); duration = pulseIn(echoPin, HIGH); distance = duration / 58.2; String disp = String(distance); Serial.print("Distance: "); Serial.print(disp); Serial.println(" cm"); delay(1000); }
@explorinOW
@explorinOW Жыл бұрын
Thank you so much. It works! But can you tell me the reason why you have thought to make this change & why was that one not working?
@nagendrasinghthakur9585
@nagendrasinghthakur9585 5 ай бұрын
#include // Define pins for ultrasonic sensor const int trigPin = 14; const int echoPin = 12; // Define LCD pins const int rs = 35, en = 34, d4 = 32, d5 = 25, d6 = 26, d7 = 27; LiquidCrystal lcd(rs, en, d4, d5, d6, d7); void setup() { // Initialize serial communication Serial.begin(9600); // Set up the ultrasonic sensor pins pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT); // Set up the LCD number of columns and rows lcd.begin(16, 2); // Print initial message to LCD lcd.print("Distance:"); } void loop() { // Variables for the duration of the ultrasonic pulse and the distance long duration; int distance; // Send a pulse to the trigger pin digitalWrite(trigPin, L); delayMicroseconds(2); digitalWrite(trigPin, H); delayMicroseconds(10); digitalWrite(trigPin, L); // Measure the duration of the echo pulse duration = pulseIn(echoPin, HIGH); // Calculate the distance (in cm) distance = duration * 0.034 / 2; // Print distance to serial monitor Serial.print("Distance: "); Serial.print(distance); Serial.println(" cm"); // Display distance on LCD lcd.setCursor(0, 1); // Set cursor to second line lcd.print(" "); // Clear previous distance lcd.setCursor(0, 1); // Set cursor to second line lcd.print(distance); // Print current distance // Example if-else conditions based on distance if (distance
Measure Distance with ESP32 Ultrasonic Sensor & OLED Display!
7:31
Upload Ideas With Itamar
Рет қаралды 2,1 М.
HC-SR04 Ultrasonic Distance Sensor and Arduino (Lesson #9)
5:28
Science Buddies
Рет қаралды 157 М.
黑天使被操控了#short #angel #clown
00:40
Super Beauty team
Рет қаралды 61 МЛН
REAL or FAKE? #beatbox #tiktok
01:03
BeatboxJCOP
Рет қаралды 18 МЛН
Raspberry Pi 4: The Ultimate Ultrasonic Sensor Guide
7:12
RaspBerry Pi Made Easy
Рет қаралды 46 М.
ESP32 Review: Arduino and Ultrasonic sensor (HC-SR04)
4:31
A. J. U.
Рет қаралды 11 М.
Waterproof Ultrasonic Distance Sensors - JSN-SR04T & A02YYUW 💧☔
32:11
DroneBot Workshop
Рет қаралды 205 М.
Arduino To ESP32: How to Get Started!
9:26
Robonyx
Рет қаралды 519 М.
12 Mind-Blowing ESP32 Projects to try in 2024!
8:50
ToP Projects Compilation
Рет қаралды 237 М.
How to use a RELAY with ESP32 | Easy Guide
5:59
INOVATRIX
Рет қаралды 48 М.
12 Ultrasonic Sensor with  NodeMCU and Blynk App
9:48
void loop Robotech & Automation
Рет қаралды 25 М.