I'm using a PIC18F452 in my project, and L293d for driving motors. I'm using two completely separate power supplies for driving motors and driving the PIC. completely separate two power packs. a 12 v 1A one for driving motors. the circuit diagram is as below:

enter image description here

My problem is when motors work the PIC get reset. when motors are disconnected it works fine and when the motors input voltage is reduced to about 6v also it works fine but with less speed. I have three questions.

  1. When the motor supple is separate how can that voltage affect the MCU to reset?
  2. if I use only one supply (12v battery), and 7805 to regulate and supply 5v to PIC how should I modify the circuit to work properly without resiting? (I used separate supply because this method was unsuccessful first, but my second option also was unsuccessful.)
  3. I want to know whether L293D reduse the current flow and how to prevent it? the motors are enough powerful when I directly power it. but when it is driven from L293 and same power pack they are very poor. (I use 12v motors and when they are directly powered and with load it draws about 460mA )

please help me regarding this issue, I can't solve it myself...

  • 1
    \$\begingroup\$ I can't see on the schematic, are the ground (or '-') connections of the two power supplies connected together? If not, all sorts of weird stuff will happen. The grounds must be connected together. \$\endgroup\$
    – gbulmer
    Commented Sep 25, 2014 at 13:43
  • 2
    \$\begingroup\$ Try connecting a 1000uF capacitor across (and near to) the power pins of your L293 driver to reduce the chance of it pulling the supply down when it switches the motor on (brown out for the Pic). \$\endgroup\$ Commented Sep 25, 2014 at 13:45
  • \$\begingroup\$ yes the ground is common in both power supplies \$\endgroup\$ Commented Sep 25, 2014 at 13:47
  • 4
    \$\begingroup\$ @OlinLathrop: If you don't like a question, just downvote it and move on. That's how community review works. Don't leave a comment unless you have constructive criticism for the OP. Telling him to "go away" does not qualify as constructive. \$\endgroup\$
    – Dave Tweed
    Commented Sep 25, 2014 at 14:38
  • 1
    \$\begingroup\$ @OlinLathrop Sorry for delay. unfortunately I have seen some native-speaker's posts that don't follow correct spellings or etc. as you can see he/she isn't a native english then we cannot expect him/her to follow english grammer or something else, completely. also you're right as well and he/she must follow rules. I just tried to help him/her, anyway. I don't know What should I say while you are right and on other hand, here is a community for all. \$\endgroup\$
    – Roh
    Commented Sep 25, 2014 at 16:53

1 Answer 1


You circuit lacks decoupling capacitors for the microcontroller. Try adding 100 nF / 1 uF ceramic capacitor as close as possible to each pair of Vdd/Vss pins.

Related question and great answer from Olin: PIC16f877A resets due to external noise

  • \$\begingroup\$ at the output of 7805 i have added a 10uf and 100nf capacitors. dosnt it do that job \$\endgroup\$ Commented Sep 25, 2014 at 13:52
  • 2
    \$\begingroup\$ As I've said, add the capacitors as close as posible to the microcontroller's pins.. \$\endgroup\$
    – m.Alin
    Commented Sep 25, 2014 at 13:53
  • 1
    \$\begingroup\$ @danialweaber 10uF is way way too small and 100nF will only help with higher frequency noise. As a rule of thumb I would start with about 1000uF for each amp drawn by the load. Starting a DC motor draws an initial high stall current which reduces as the motor speeds up. Its this turn on current that needs the extra kick of current from the capacitor or you risk pulling the supply voltage down momentarily. \$\endgroup\$ Commented Sep 25, 2014 at 14:02
  • 2
    \$\begingroup\$ @JImDearden I don't think we are chasing that problem. The OP states that the PIC has a separate power supply from the motor, so when the motor draws current it shouldn't be pulling the PIC's power supply down at all if the OP was correct. \$\endgroup\$
    – ACD
    Commented Sep 25, 2014 at 14:17
  • 2
    \$\begingroup\$ @danialweaber Just to clarify I wasn't suggesting a large capacitor decoupling at the the PIC terminals. I was suggesting you need to put it across the L293 which actually draws the current. This would also help with grounding problems. \$\endgroup\$ Commented Sep 25, 2014 at 15:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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