ESP32 POE and hc-sr04 (cant get it work)

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
gender
New user
Posts: 3
Joined: 03 Jan 2022, 18:35

ESP32 POE and hc-sr04 (cant get it work)

#1 Post by gender » 03 Jan 2022, 18:43

Hi,

I actually used a "d1 wemos mini" together with a hc-sr04 and ESPEasy and it worked (Im using a levelshifer like its described here: https://www.letscontrolit.com/wiki/index.php/HC-SR04)

Now I would like to replace the "d1 wemos mini" with a "ESP32 POE", because its based on an ehternet cable. So I flashed the ESP with "ESP_Easy_mega_20211224_normal_ESP32_4M316k_ETH" and the ESP32 works in general.

But I cant get the hc-sr04 working. The measurement is always 0.00

I used the 5V-Pin, the 3,3V Pin and "ground" of the ESP32 (like I did it with the d1 wemos) and gpio4 and gpio5 for the ECHO and Trigger... because its "free" in the gpiomap of the ESP32 POE. I also tried other GPIOs but I cant get it working.

Any ideas what Im doing wrong?
Attachments
ESP32POE_GPIOMap.JPG
ESP32POE_GPIOMap.JPG (278.05 KiB) Viewed 6748 times

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: ESP32 POE and hc-sr04 (cant get it work)

#2 Post by TD-er » 03 Jan 2022, 19:33

What pins have you set for I2C?
The default is 4&5 for I2C, which I may have to change as there is hardly any ESP32 board out there which does have those pins mapped to I2C.

Please check if the 5V pin of the board actually has 5V.
Maybe you also want to add some capacitors close to the sensor (e.g. 100 nF to filter out high frequency noise and 10 uF to keep voltage stable)

Also see: https://espeasy.readthedocs.io/en/lates ... e-on-esp32
GPIO 4 is pulled down, so maybe you want to use a different pin.

gender
New user
Posts: 3
Joined: 03 Jan 2022, 18:35

Re: ESP32 POE and hc-sr04 (cant get it work)

#3 Post by gender » 04 Jan 2022, 19:56

Hi,
IC2 is obviously set for 13 and 16 (see attachment).

Should I change it to 4 and 5 ?

Thanks
Attachments
Unbenannt.JPG
Unbenannt.JPG (30.14 KiB) Viewed 6711 times

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: ESP32 POE and hc-sr04 (cant get it work)

#4 Post by TD-er » 04 Jan 2022, 22:30

Nope, 4 & 5 is a bad default for ESP32 for I2C. (GPIO-5 can work for SDA by the way)
Pin 4 is pulled down, so not practical for I2C and maybe this pull-down is also affecting your ultrasonic sensor.

gender
New user
Posts: 3
Joined: 03 Jan 2022, 18:35

Re: ESP32 POE and hc-sr04 (cant get it work)

#5 Post by gender » 09 Jan 2022, 18:50

Thanks again for the reply.
I used pin 32 and 33 for trigger and echo and now its working !

Best regards

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: ESP32 POE and hc-sr04 (cant get it work)

#6 Post by TD-er » 09 Jan 2022, 19:18

Great!

Post Reply

Who is online

Users browsing this forum: No registered users and 30 guests