Electronic – Powering a water pump with nodemcu

#nodemcufluid-pumppower

I want to use a nodemcu to water my plants. I connected a pump with a 2N2222 transistor (I know i should add a diode and a pull down on the gate). The pump is DSL370 and when it is off i measure 4.4V on the Vin pin while using a 2A charger connected to the USB port. When the pump is active, the vin voltage drops to 4.1V and the LCD becomes hard to read. I measured the current the pump uses and it is 300mA. What is the reason for the voltage drop? I thought the charger should be able to handle it.
Also, as i saw at
http://henrysbench.capnfatz.com/henrys-bench/arduino-projects-tips-and-more/powering-the-esp-12e-nodemcu-development-board/
The power from the USB is connected to the Vin via a diode so the Vin and the esp8266 power should not affect each other.

Schematic

Best Answer

Technically, you can connect USB power to VU input or USB jack and draw power from Vin trough schottky inside, as in your picture. However there are several problems with this:

  1. schottky will drop USB voltage by at least 0.6V.
  2. If your USB power comes from PC then you cannot draw more than 100mA without negotiation with the host. And PC is allowed to drop to 4.4V in these conditions.
  3. If your USB power comes from external charger through the jack then you cannot communicate with PC at the same time.

Another option is to connect LCD+Motor to VU pin, bypassing the schottky. In this case you can power the board via USB jack from external power supply and everything will work fine. But the problems #2 and #3 will still remain.

So, the solution is to power LCD and Motor directly from charger, if their voltages compatible, or through 5V voltage regulator if not. The same supply wire will also power nodeMCU through Vin pin. Main points here are:

  1. Motor power never comes through either schottky or internal nodeMCU regulator;
  2. Motor power never comes from PC USB port.

However you can separate LCD from motor and power it from either 3.3V or VU pins, depending on what voltage it needs. Then you will have working LCD whether you power nodeMCU from PC or from external charger.