2
\$\begingroup\$

I'm trying to drive DC motor with PWM using PIC P16F1824. Some books suggest using TIP31/TIP120 as the driver. So I have PWM output pin connected Base pin TIP31, the Emitter pin connected to Ground. I have a LED, the positive pin connected to positive pin from the battery, and the negative pin from the LED connected to Collector pin TIP31.

For LED, it works fine. Using PWM, I could see different strengths on the LED.

BUT, when I connected the DC motor, I could only hear noise sound. The Motor normally run with 200 mA. If I connect the battery directly to the motor, it works fine.

My battery current is 900mA (2 x AAA, 3V). I measured the PWM output from the IC is 5mA, and the current from the Collector pin is 50mA. One of the Motor pin connected to the battery positive pin(900 ma), and the other pin connected to the Collector pin.

My questions:

  1. Why the Motor doesn't run, although it appears it has enough current?

  2. What are the difference between NPN Transistor (TIP31) with MOSFET and Motor Driver?

enter image description here

\$\endgroup\$
  • \$\begingroup\$ What's the PWM frequency? May be too high. \$\endgroup\$ – stevenvh Jun 6 '11 at 13:36
  • \$\begingroup\$ Hi Steven, it's 4000. \$\endgroup\$ – mlam Jun 6 '11 at 14:20
  • \$\begingroup\$ Post a real schematic. Trying to explain the circuit with hand waving leaves too many questions as to what you really have hooked up to what. \$\endgroup\$ – Olin Lathrop Jun 6 '11 at 14:30
  • \$\begingroup\$ I see you added a drawing. That's better than nothing but not as good as a real schematic. It doesn't show which pins on the PIC or the transistor are what, and it's kindof a pain to follow the connections. \$\endgroup\$ – Olin Lathrop Jun 6 '11 at 15:12
3
\$\begingroup\$

The drawing you just added shows that the bypass cap accross the PIC is missing, there are no caps on the crystal, and there is nothing to limit the current out of the PIC into the transistor. Each one of these can cause flaky operation.

EDIT: I just noticed the motor seems to be connected to ground, not power.

EDIT2: And the emitter is connected to power instead of ground.

\$\endgroup\$
  • \$\begingroup\$ The motor is connected to the power. The picture is not clear. And the emitter connected to the ground. But after adding resistor from PIC to transistor, adding cap to the xtal and adding 2 electrolite caps to the motor, I managed to run the motor for a while. after that it has the noise again. Yes, I little but confused about the emiter. \$\endgroup\$ – mlam Jun 6 '11 at 16:25
  • \$\begingroup\$ But if I use the motor driver, does it help? \$\endgroup\$ – mlam Jun 6 '11 at 16:28
  • \$\begingroup\$ My program is to run the motor for 3 secs and pause for 1 sec. After about 5 times of run and pause, the motor no longer run. I just hear the noise. I have to turn off the power, let it "cool" for awhile, before I can try again. But no for long. \$\endgroup\$ – mlam Jun 6 '11 at 16:31
2
\$\begingroup\$

First, get the motor just to be on/off controllable by the PIC. Once that is working you can try inbetween values using PWM.

From your description, it sounds like you're missing the resistor that should be between the PIC output and the NPN base. Without the resistor, the PIC output pin current is likely exceeded, which can cause it to behave unpredictably. The TIP31 has a minimum gain of 25 at 1A. To get 200mA collector drive, it therefore needs at least 8mA base current, preferably rather more. At only 3V Vdd and figuring 700mV for the B-D drop, that leave 2.3V accross the resistor. 2.3V / 10mA = 230 Ohms.

I think what's going on is that the circuit is too weak to driver the motor properly. The motor may take 200mA when running, but will take a lot more when starting and when there is a load on it. In short, a simple TIP31 driven directly from the PIC isn't good enough for this low Vdd voltage.

You could use another transistor to provide more base drive. In this case, a low voltage FET like IRLML2502 sounds like a better idea. Don't forget to put a reverse diode accross the motor else the transistor and possibly the PIC will get fried.

\$\endgroup\$
  • \$\begingroup\$ It's always nice to have a link to a component's datasheet. \$\endgroup\$ – Federico Russo Jun 6 '11 at 14:55
  • \$\begingroup\$ Thanks! Should I use motor driver? SN754410NE, QUAD, HALF H, 16PDIP. focus.ti.com/lit/ds/slrs007b/slrs007b.pdf \$\endgroup\$ – mlam Jun 6 '11 at 15:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.