Electronics Newbie -motor and relay hangs module

Discussion in 'The Projects Forum' started by R_L, Apr 24, 2015.

  1. R_L

    Thread Starter New Member

    Apr 23, 2015
    3
    0
    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?
     
  2. DickCappels

    Moderator

    Aug 21, 2008
    2,647
    632
    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.
     
  3. Reloadron

    Active Member

    Jan 15, 2015
    963
    232
    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
     
  4. MikeML

    AAC Fanatic!

    Oct 2, 2009
    5,450
    1,066
    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...
     
  5. R_L

    Thread Starter New Member

    Apr 23, 2015
    3
    0
    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
     
  6. R_L

    Thread Starter New Member

    Apr 23, 2015
    3
    0
    Yes, it is a serial to WiFi module
     
  7. MikeML

    AAC Fanatic!

    Oct 2, 2009
    5,450
    1,066
    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.
     
  8. Reloadron

    Active Member

    Jan 15, 2015
    963
    232
    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
     
Loading...