Electronics Newbie -motor and relay hangs module

Thread Starter

R_L

Joined Apr 23, 2015
3
I'm doing an IOT project to control my home motor (~700mA max.) through a ESP8266, the circuit as attached Untitled-1.jpg, when I power it on the with the USB battery pack, the ESP8266 halt (all lights on)

However, if I disconnect the Ib before power up (connect it afterward), everything works fine. Anyone can give me a clue?
 

DickCappels

Joined Aug 21, 2008
10,171
It might be that "garbage" gets into the module through the power supply or signal lines or that the relay is pulling down the +5V.

I would start with taming the noise by putting a .01 uf capacitor across the motor terminals right at the motor (other the motor leads will act line an antenna, and I would put some decoupling from +5 where the relay connects to it to the emitter of your 2N2222.

It is a good idea to check your power supply voltages when the fault occurs too.
 

Reloadron

Joined Jan 15, 2015
7,517
While I am not sure how the ESP8266 figures into this you mention your motor load is about 700 mA. Depending on data sheet and transistor manufacturer the 2N2222 transistor has a max current of around 600 to 800 mA and some data sheets show as much as 1.0 Amp. Your drawing reflects a base resistor of 1.0 K Ohm. You are using the 2N2222 as a switch driving the transistor into saturation to turn your motor On or Off. While I agree with Dick as to a cap across the motor terminals to clean up any hash I am not sure with a 700 mA load the 2N2222 is a good choice. You may want to look at that 1 K Ohm base resistor and calculate for a 700 mA load what the base current should be. Can you source the needed base current for the circuit? A better choice might be a darlington pair to drive your motor rather than the 2N2222. While I am unsure, that is my thinking.

Isn't the ESP8266 a serial to WiFi module?

Ron
 

MikeML

Joined Oct 2, 2009
5,444
Most USB ports are usually limited to 500mA. Are you sure you are not exceeding the maximum current allowed?

DC motors draw 4X to 10X of their rated running current during startup. Your ~700mA max motor might really be drawing several Amps as the motor starts, pulling down the USB voltage, causing havoc.

It is really a bad idea to be powering a DC motor from a USB port. You should have a separate power supply or battery suitable for the motor load...
 

Thread Starter

R_L

Joined Apr 23, 2015
3
Most USB ports are usually limited to 500mA. Are you sure you are not exceeding the maximum current allowed?

DC motors draw 4X to 10X of their rated running current during startup. Your ~700mA max motor might really be drawing several Amps as the motor starts, pulling down the USB voltage, causing havoc.

It is really a bad idea to be powering a DC motor from a USB port. You should have a separate power supply or battery suitable for the motor load...
I actually use a portable power bank which provides 5.1V/2.1A power source. Besides, an AMS1117 regulator is used to provide 3.3V for the ESP8266
 

Thread Starter

R_L

Joined Apr 23, 2015
3
While I am not sure how the ESP8266 figures into this you mention your motor load is about 700 mA. Depending on data sheet and transistor manufacturer the 2N2222 transistor has a max current of around 600 to 800 mA and some data sheets show as much as 1.0 Amp. Your drawing reflects a base resistor of 1.0 K Ohm. You are using the 2N2222 as a switch driving the transistor into saturation to turn your motor On or Off. While I agree with Dick as to a cap across the motor terminals to clean up any hash I am not sure with a 700 mA load the 2N2222 is a good choice. You may want to look at that 1 K Ohm base resistor and calculate for a 700 mA load what the base current should be. Can you source the needed base current for the circuit? A better choice might be a darlington pair to drive your motor rather than the 2N2222. While I am unsure, that is my thinking.

Isn't the ESP8266 a serial to WiFi module?

Ron
Yes, it is a serial to WiFi module
 

MikeML

Joined Oct 2, 2009
5,444
I actually use a portable power bank which provides 5.1V/2.1A power source. Besides, an AMS1117 regulator is used to provide 3.3V for the ESP8266
Unless you store energy ahead of the regulator, the regulator will not help if the motor pulls down the 5V below the drop-out voltage of the regulator during the start transient.
 

Reloadron

Joined Jan 15, 2015
7,517
Yes, it is a serial to WiFi module
That was not my point, my point in my post was you have a motor drawing 700 mA. That motor is on the collector of a 2N2222 transistor which is a very poor choice, look at the data sheet for a 2N2222 transistor. The linked data sheet shows a maximum collector current of 600 mA. You have a 700 mA motor. Here is another data sheet for a 2N2222 transistor, the linked data sheet shows a maximum collector current of 1.0 Amp. So what do you have? Even that does not matter because you have a 1,000 Ohm base resistor on your 2N2222 transistor. So what will the base current be on the transistor? I see 3.3 Volts applied, so take the base emitter drop of 0.7 volt and we get 3.3 - 0.7 = 2.6 volts with a 1K resistor equals a base current of about 2.6 / 1,000 = 2.6 mA. For saturation, using the transistor as a switch your base current should be a minimum of 0.1 * the collector current. You need a base current of at least 70 mA for a collector current of 700 mA. The only way that can happen is if we reduce the base resistor and reduce it a lot. 2.6 volts / .070 amp = about 37 Ohms. In reality it would be less. You will need to be able to source about 70 mA to the base of the transistor.

Nne of this even begins to take into consideration what Mike mentioned. Your motor start current could easily be 1.4 amps. Granted only for a short time but the transistor needs to handle the start current. This is why I suggested a darlington pair or something else, the 2N2222 for this application is a poor choice.

Ron
 
Top