Yes, with certain limitations by hardware mentioned above.
drive_strength (advanced options of pin configuration)
Is it pointless to know the operation voltage of Esp32 while there is no “command” to change that?
Yes, with certain limitations by hardware mentioned above.
drive_strength (advanced options of pin configuration)
Is it pointless to know the operation voltage of Esp32 while there is no “command” to change that?
Aha…thanks, that’s good to know. Although this should be used with caution, especially if someone want’s to increase current. There’s maximum allowed total current to be aware of: total is 120mA in many cases, if i’m not mistaken. So in theory you could only use 3 pins as output if you push them to max.
Operation voltage of all esp’s is 3.3V, that’s unchangeable. I guess you mean max. current? But still, yes, it would be pointless if above command wouldn’t be available - since it that case allowed current would be 20mA in all cases and period.
I have been reading this thread and it seems a lot of the replies does not address what the original poster actually wanted to do.
The word switch has gotten a terrible dual use thanks to companies like Philips Hue that call their remote controls switches. They are not electrical switches. They are remote controls. But damage is done and the word switch is abused everywhere. Battle lost.
But to answer some of the other posters, for a 3.3V ESP32 or a 5V supplied ESP32 modules you can
Unless you need the same unit to do Bluetooth there is little point in using an ESP32. There are so many dirt cheep ESP8266 based options. All the Sonoff boxes are so easy to hack. I have put my own software on many of these. You program them with a serial interface. They are so cheap and you have all the mains related stuff done for you and you have a nice secure enclosure. And if you have money there is Shelly which is easy to put custom software on.
What the original poster wanted to do - as I understand it - was to use the a low voltage ESP32 as a remote switch. Ie use it to interface a physical button and let it send MQTT messages which again turns on/off some mains equipment. And yes, that makes a lot of sense. Especially if the same box has multiple purposes. Like being a Bluetooth relay or displaying some status lights etc. I do that in my home.
No I don’t.
What I mean it’s not pointless to know your hardware and limitations/capabilities of it. Independently if esphome has or has not commands to configure something.
Complex chip like Esp32 doesn’t offer simple answers and the datasheets are quite “heavy” to read because of that.
People often have insane ideas about what (abuse) Esp can stand. This chip is 5mm x 5mm with 48 pins on it, for sure it doesn’t have high amp constant current driver IC built in on those gpios.
You confused everything. As for “know your hardware and limitations/capabilities” goes: i was talking ONLY for max gpio current, nothing else.
It’s not pointless to know pin voltage, sure, but it’s quite logical to all users that it’s 3.3V, don’t you think? It’s not worth to even mention that. System voltage in all esp chips is 3.3V, If anyone doesn’t know that then surely doesn’t work with them.
I only talked about max.current, nothing else. It WOULD BE pointless to know that esp allows 10mA or 40mA if that would be impossible to change from esphome. That’s why i asked if there’s a config for this.
And for complex chip there’s not simple answer. Absolute max generally is 40mA sourcing and 28mA sinking. But default currents for different pin’s varies. For example Esp32-S3 has sourcing current capability like this (from datasheet):

True, but as i already said: it’s never a good idea to draw any pin even near it’s max. A perfect formula to destroy the chip (long term).
That’s why it’s better to go with defaults, Espressif has been testing it.
And Esp32 has unbelievable robust pads, shorting a pin briefly doesn’t fry it (that’s why we love it).
BS! I don’t believe anyone could not love reading those!
Oh ya…Look at that butt on that chart!!
Guys…
All i wanted is to control a MQTT topic from a typical light switch while the ESP32 is behind the physical switch in the wall socket. What is going on here…
This is why we cant have nice things.
No offense but, thats arguably a bad idea. By the time you get the transformer in there, the esp32, a relay, and a bunch of wiring, your going to have a genuine rats nest that acts as a secondary fire hazard inside your wall.
Just spend 15$ and skip all that mess by buying a Shelly. It has an esp32 inside, relay, wifi, etc. You can leave it as is and turn on mqtt in its configuration or you can essily flash esphome on it and go that way.
You should just trust me on this one…
You weren’t present… What can we do… ![]()
Yes
11 Jan.
No! I will not buy a Shelly! ![]()
Thing is this… I just need an ESP32 to send an MQTT message when the switch is pressed. All the switching is then being done via a PLC inside the electrical cabinet. So no 220v or relays or anything behind the switch in the wall socket. Just 5V and the ESP32 connected to the light switch.
And sorry I should have clarified everything better…
That was the original question, right?
Based on the other data you didn’t include, people assumed you were talking a normal light switch that has high voltage.
You now say it is all low voltage in your switch box. That is likely better, so if the relay that is controlling things is far away, just make sure the signal to it requires some current (but not too much) so the ESP can control it without random activations from induced currents.
The more information you provide about the conditions the more likely you are to get a decent answer. I have a DC power supply that goes to a switch (like a wall switch) and then to a couple of LED lamps. It is about 3 meters to the switch and 5 or 6 more meters to the lamps. They are outside. They work fine when it is warm outside. When it is cold the lamps sometimes take a long time to come on. This is likely because the lamps internal constant current supply is flakey. If the switch were controlling voltage to an esp at the light (GPIO pin) I would be worried about false triggers, but since the lamps draw about 20W they only come one when the switch tells them to.
Are the built in pull up/down resistors enough for such a use case?
general answer is no. There was a recent thread about the issues someone was having in a similar situation. Long wires and standard GPIO pins work-ish until they don’t work at all.
2nd answer here: