ESP32 PIN.OUT voltage

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
ajocius
Posts: 83
Joined: Mon Feb 19, 2018 6:31 am

ESP32 PIN.OUT voltage

Post by ajocius » Sun Feb 10, 2019 4:09 pm

I have assigned PIN 15 to be Pin.OUT and expected to get 3,3 V output once I set value 1 for that pin. This works as expected (gives 3,3 V ) prior I connected micro pump at which point voltage drops from 3,3 V to 0,47 V and pump does not work.

Tried pin 18 with the same result. Tried different pump, same issue.

I have tried this yesterday with "clean" esp32, just this pump connected and it all worked. Do not remember which pin I used yesterday, but I thought those that have pin.out capability all produce 3,3V. Today I connect pump to another ESP32 that also measures soil moisture. I have couple of soil moisture sensors connected to this module that gets powered once in 30 min and reads value. Could that be the reason? By the way, those soil moisture sensors do reading only once in 30 min, so their pin.out value is set to zero and therefore I did not expect any problems to run pump on the same module.

What can I do to resolve this?

danielm
Posts: 167
Joined: Mon Oct 05, 2015 12:24 pm

Re: ESP32 PIN.OUT voltage

Post by danielm » Sun Feb 10, 2019 4:46 pm

What do you mean by "pump" and what is its maximum input current?

ajocius
Posts: 83
Joined: Mon Feb 19, 2018 6:31 am

Re: ESP32 PIN.OUT voltage

Post by ajocius » Sun Feb 10, 2019 5:01 pm

It is a 3V water pump like this:

https://www.aliexpress.com/item/DC-Amph ... st=ae803_5

Found under description:
Voltage range DC2. 5-6(V)
Operating current 130—220(MA)

danielm
Posts: 167
Joined: Mon Oct 05, 2015 12:24 pm

Re: ESP32 PIN.OUT voltage

Post by danielm » Sun Feb 10, 2019 5:52 pm

The pin cannot provide such current directly. I suggest to use high-side P-channel MOSFET to control the load (pump).
https://www.quora.com/When-is-it-good-t ... e-P-MOSFET

I usually use DMP2066 for switching of external components.

ajocius
Posts: 83
Joined: Mon Feb 19, 2018 6:31 am

Re: ESP32 PIN.OUT voltage

Post by ajocius » Sun Feb 10, 2019 6:36 pm

I did measure prior connecting water pump, pin provided 3,3 V, it drops after I connect pump.

I do have LD1117V33 LDO Voltage Regulators 3.3V 0.8A , but I am not sure if that is up to the job?
https://www.aliexpress.com/item/10pcs-l ... 4c4dkKOzTM

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: ESP32 PIN.OUT voltage

Post by Roberthh » Sun Feb 10, 2019 7:36 pm

You did not understand @danielm's comment. The ESP8266 output can source like 6-10mA current. You pump needs like 220mA, may more when it starts. You need a switch which is able to drive this current, like a MOS transistor. You can use either a N or P type, but the connections are different. The ESP8266 drives the gate pin of the transistor, and the pump is connected to the drain pin of the transistor, and the source to either GND (N-type) or 3.3V (P-type). Please be aware that this changes the polarity required for the output signal.

ajocius
Posts: 83
Joined: Mon Feb 19, 2018 6:31 am

Re: ESP32 PIN.OUT voltage

Post by ajocius » Sun Feb 10, 2019 8:38 pm

I used ESP32, not ESP8266 , but I guess it has same limitation? I mentioned in first post, that I did work yesterday on another ESP32, that had no other code and no other components on breadboard. Just a simple pin.out value setting to 1 in order to start pump and then setting to zero to stop it. Pump worked as intended once I set pin.out value to 1. So it should be sufficient current available on the board.

ESP32 that I am trying to use my pump with now is having 2 moist sensors attached, but those sensors only get power during 10 sec cycle when I read moisture value every 30 minutes, so this should not be consuming current, unless the rest of the board is consuming as it has LED on and this board is connected to wifi, registered with mqtt.

I am going to read up/search for examples with MOS transistors. Does that mean I need separate power supply to supply current to pump?

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: ESP32 PIN.OUT voltage

Post by Roberthh » Sun Feb 10, 2019 8:46 pm

The maximum output drive capability of the ESP32 is higher, 40mA. But still lower than the max 220mA specified for your pump. The pump will consume less current if it is running empty. Maybe that was the case in your first test.
Whether the power supply is sufficient, depends on the current required by all component in total:
ESP32: max 240 mA
Pump: max 220 mA
Moisture sensors: ??
My guess is that 800mA should be fine.
For the transistor you do not need an additional power supply. It just supports the output stage of the ESP32.

OutoftheBOTS_
Posts: 847
Joined: Mon Nov 20, 2017 10:18 am

Re: ESP32 PIN.OUT voltage

Post by OutoftheBOTS_ » Sun Feb 10, 2019 9:06 pm

The bottom line is that you can use the MCUs pins to operate switches not for supply power to drive things.

The MCU needs to switch on the power supply to your pump not power your pump :)

ajocius
Posts: 83
Joined: Mon Feb 19, 2018 6:31 am

Re: ESP32 PIN.OUT voltage

Post by ajocius » Sun Feb 10, 2019 11:38 pm

Ok, last few questions on this subject. If I have separate power supply for my pump, I can just use simple switch to operate it. Switch would be controlled by ESP32, but current through out pins would be from external source. i am suggesting this as I used switches in past, transistors only based on example diagram, so I would need to figure out placement of transistor here.
Also, my power supply to ESP32 is mobile phone charger. I believe it provides 5V/1,2A. So if ESP32 uses max 240mA there should be plenty left for the pump? Would be great to use one power supply if possible. Currently it is plugged into ESP32 micro USB port.

Post Reply