0

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...

Roh
  • 4,598
  • 6
  • 41
  • 86
danial weaber
  • 265
  • 2
  • 10
  • 1
    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. – gbulmer Sep 25 '14 at 13:43
  • 2
    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). – JIm Dearden Sep 25 '14 at 13:45
  • yes the ground is common in both power supplies – danial weaber Sep 25 '14 at 13:47
  • @Roh: By fixing the OP's sloppiness for him, you have deprived the volunteers here of seeing his true attitude, made it impossible for the OP to fix it himself and therefore repair the problem, you are letting him get away with thumbing his nose at us, and you are showing others that they can be sloppy since someone will come along and fix it for them. If we don't insist on some care and respect here, we will continue to get less and less of both. – Olin Lathrop Sep 25 '14 at 14:01
  • @OlinLathrop please let me know what more details you need. sorry for my poor English. i have asked my three questions clearly. i can provide eny more details you need. – danial weaber Sep 25 '14 at 14:02
  • 4
    @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. – Dave Tweed Sep 25 '14 at 14:38
  • 1
    @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. – Roh Sep 25 '14 at 16:53

1 Answers1

5

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

m.Alin
  • 10,638
  • 19
  • 62
  • 89
  • at the output of 7805 i have added a 10uf and 100nf capacitors. dosnt it do that job – danial weaber Sep 25 '14 at 13:52
  • 2
    As I've said, add the capacitors as close as posible to the microcontroller's pins.. – m.Alin Sep 25 '14 at 13:53
  • 1
    @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. – JIm Dearden Sep 25 '14 at 14:02
  • 2
    @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. – ACD Sep 25 '14 at 14:17
  • i tried adding a 3300uf capacitor between 12v supply and ground, between pic supply pins but the issue is still as it is. when the motors are removed the pic works fine. giving a separate supply how can the motors current draw affect the pic to reset. please help... – danial weaber Sep 25 '14 at 14:50
  • @danialweaber A 3300 uF capacitor is too big too work as a decoupling capacitor for a microcontroller. Try the values that I recommended. – m.Alin Sep 25 '14 at 14:56
  • @danialweaber You do have separate power supplies for the motor and the micro, but the ground is still common and your circuit might experience ground bounce due to bad grounding/bad layout. For more info read the answer that I linked too. – m.Alin Sep 25 '14 at 14:59
  • 2
    @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. – JIm Dearden Sep 25 '14 at 15:38