Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SR04 ultrasonic sonar issue #579

Open
2 of 7 tasks
weiwi opened this issue Sep 29, 2023 · 3 comments
Open
2 of 7 tasks

SR04 ultrasonic sonar issue #579

weiwi opened this issue Sep 29, 2023 · 3 comments

Comments

@weiwi
Copy link

weiwi commented Sep 29, 2023

@UncleRus

The issue

I am using ESP32S3, and kept getting when trying to get sonar readings. I have tried both SR04 and AJ-SR04M sonar boards and have similar results:

  1. Sonar heads are sending signals (LED blinks on SR04M, and I can hear both heads sending signals from noise cancelling headphone)
  2. Both will get error: Error 513: Ping timeout (no device found)

Can anyone shed some light on this?

Thanks

W

Which SDK are you using?

esp-idf

Which version of SDK are you using?

master

Which build target have you used?

  • esp32
  • esp32s2
  • esp32s3
  • esp32c2
  • esp8266
  • other

Component causing the issue

ultrasonic

Anything in the logs that might be useful for us?

No response

Additional information or context

No response

Confirmation

  • This report is not a question nor a request for drivers.
@UncleRus
Copy link
Owner

UncleRus commented Feb 6, 2024

Hi!
I'm sorry for the delay. Do you have the ability to connect an oscilloscope or logic analyzer to the trigger and echo GPIO? This would clarify whether the echo is actually coming.

@hayschan
Copy link
Contributor

I recommend trying your code on a simulator, such as the Wokwi Simulator. This approach allows you to eliminate potential wiring and hardware issues by simulating your setup.

Wokwi offers an HC-SR04 ultrasonic sensor simulator which might be relevant for your needs.

Testing your code in a controlled environment like this can help you identify whether the issue is with the code, wiring, or the hardware components themselves.

@Tarungtm
Copy link

Hi @UncleRus,
I am using ESP32 wrover ie and esp32 ce-3 mini. I have tried to fetch the distance using SR04M-2 but facing errors like.

  1. ping timeout(no device found).
  2. echo timeout (i.e. distance too big).

I tried to debug the program came to know that it is not fetching timer value in "ultrasonic_meaure_raw" function.

Can you help me with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants