Disconnect/reconnect usb sounds when powered by USB

I've attached a fritzing showing how everything is hooked up.

Ontop of what I have on the sketch there is also a DHT11 for temperature and humidity hooked up to all of this.

Everything is working alright but I'm afraid I might have made some kind of error when hooking it up because when I have the system hooked up to my PC via USB I constantly get the connect/disconnect sound of a USB device connecting/disconnecting.

The DC motor in the fritzing is really a 3V-5V water pump.

Is there something wrong with my wiring? And if so what?

Any and all help is greatly appreciated!

You can't draw that much current from a USB port, the stall current of the pump is way higher than 100 or even 500mA. There's probably a polyfuse on the NodeMCU and in the computer as well, so the voltage drops. Either the CH340G resets or browns out, or the computer turns off the USB port because it thinks the device is faulty.

You should add reservoir and decoupling capacitors as well, and a flyback diode across the motor.

Pieter

PieterP:
You can't draw that much current from a USB port, the stall current of the pump is way higher than 100 or even 500mA. There's probably a polyfuse on the NodeMCU and in the computer as well, so the voltage drops. Either the CH340G resets or browns out, or the computer turns off the USB port because it thinks the device is faulty.

You should add reservoir and decoupling capacitors as well, and a flyback diode across the motor.

Pieter

I see. I thought that might have been the problem.

My external power supply is 5V 2.1A and I believe that should be sufficient for my needs. But when developing from the computer I will then need what you said about a reservoir and decoupling.

Do you know any good tutorials on how to do this?

No, the capacitors and diodes are not a replacement for a capable power supply. You shouldn't power a powerful motor from a USB port. Period.

When developing on your computer, either use an external power supply for the motor alone, or replace the motor by an LED or something.
You could add a diode between the external 5V supply and the NodeMCU's 5V pin for powering it when the USB is disconnected. Take a look at the schematic of the Arduino Nano for example.

Pieter

Hi,
While developing your code, use a LED and current limit resistor instead of the motor.

Tom.. :slight_smile:

Thanks for the replies PieterP and TomGeroge! Appreciate it! :slight_smile:

But would my 5V 2.1A external power supply give me enough juice once I finish developing it?

GurkanG:
But would my 5V 2.1A external power supply give me enough juice once I finish developing it?

How are we supposed to tell? You didn't give us any information on the pump / motor (part number, link to datasheet ...).

Pieter

I'm sorry.... I thought saying it's 3V - 5V powered pump would be enough.

The if I have is:

Power: 3W

Voltage: DC 3-5V

Current: within 0.05A

That's impossible. 3W @ 3V → 1A, not 0.05A, one of these figures has to be incorrect.
Voltage alone means nothing, you need to know the current as well.

Pieter

Okay that's the figures I got from the website.

It's from aliexpress so I thought maybe not everything is correct :confused:

I don't know how to get better figures on the pump I'm afraid.

Thanks for all the help Pieter. Really appreciate it!

Then your only option is to measure the current draw of the motor. If your multimeter has min/max options, try measuring the maximum current drawn by the motor, and the minimum voltage on the 5V line.

Pieter