Page 1 of 1

Interfacing the ESP32S3 with some 5V sensors

Posted: Sun Aug 04, 2024 8:23 pm
by johnatanjmn
Hello,

I migrating an old Arduino project to ESP32S, this concurrently uses 5V sensors for everything. I wonder if these sensors can be all hooked up or need TTL conversion, here is the list:

1, HC-SR04 Ultrasonic Sensor, According to this tutorial this sensor can be hooked up no problem to the ESP32s:

https://randomnerdtutorials.com/esp32-h ... c-arduino/

The sensor itself needs to be operated from 5V otherwise it malfunctions. The thing about these sensors is when you operate them from 5V there will be 5V on their digital pin as well if I connect it to the ESP32 then the voltage goes down to 3.3V level, I'm not sure that regardless what that guide claims connecting this is healthy for the micro...

2, Regular 4 channel relay boards, again these have to be operated from 5V otherwise the relays can be flaky (don't always pull in or don't pull in at all) however this does not put high voltage on the pins as it's opto isolated

3, Rain droplet sensors: https://esp32io.com/tutorials/esp32-rain-sensor

Again the article claims it can be connected directly to the micro but I noticed the same thing if you operate these from 5V there will be 5V on the digital pins

The bottom line is: is connecting 5V to the regular analog/digital pins of the ESP32s3 damages the device any way or it can handle it?

Thanks for the guidance :mrgreen:

Re: Interfacing the ESP32S3 with some 5V sensors

Posted: Mon Aug 05, 2024 2:36 am
by ESP_Sprite
In theory: no. The datasheet clearly specifies the limits of what is acceptable on its IO pins; anything outside of that range might have unspecified effects.

In practice: Generally the IOs of an ESP32 are pretty sturdy. If you limit the current going into them (by putting an 10K series resistor between the sensor and IO pin) they will likely happily survive for a long time. It's not something I'd recommend for a production device, but if you're building an one-off and are around to service it if needed, it probably won't hurt.

Re: Interfacing the ESP32S3 with some 5V sensors

Posted: Mon Aug 05, 2024 11:33 am
by MicroController
If you're hooking up a 10k resistor between a 5V-output and the ESP's input anyway you can also add another 20k between the input and GND and be within specs :)

Re: Interfacing the ESP32S3 with some 5V sensors

Posted: Tue Aug 06, 2024 9:12 am
by ESP_Sprite
That is true.