PIC and L298

Status
Not open for further replies.
Hello! I'm new to this forum (been lurking for a while). I've been working with a PIC to run a L298 as a dc motor driver (seems like its a common combination around here!), and am wondering about the best practice for powering them both. First I used the same power supply to drive the motors as the logic for both IC's. When the motors would start the power drain would reset the PIC (even with decoupling caps) so I decided seperate supplies would be a better way to go. A 9v to drive the logic and a 12v wallwart for the motors, 2-7805's and I'm in business. It seems to be a better way to go for sure. However, it does seem to be more complicated than it needs to be. Is there a 'best practice' for this combination of ic's? I imagine a more solid power supply would run them both without problems, but what do I need to focus on? Bigger caps, more amperage? Or do I have it right with running seperate supplies?
 
The motor will be much more tolerant of a higher voltage unregulated supply than the logic. If you want to operate from wall warts remember to check the voltage under load. If it says 12V @ 300 mA it means the voltage will be 12V WHEN the current drawn is 300 mA. If the current is less than 300 mA the voltage will be higher. If the current is more then the voltage will be lower. Wall warts make really crummy motor power supplies. Get yourself a "Tim-the-Tool-Man" transformer, a bridge rectifier, and a BAC(Big A** Capacitor). A bleeder resistor from the capacitor to ground will prevent a nasty surprise. Run the motor from that puppy and don't look back. A wall wart and a 7805 will do just fine for the processor.

As always run the power ground separately from the logic ground. Connect them at a single point on the L298.
 
You don't have to run separate power supplies. You can use a common supply with the equivalent capacity of the two supplies put together. However, you can protect the logic from the voltage dips by adding a rectifier diode ahead of the filter caps. This will hold steady the voltage input to the regulator for the logic even if the supply to the motor dips.
 

Attachments

  • regulate.gif
    2.5 KB · Views: 602
Motion,

A clever solution. One problem with your approach is that depending on the current draw of the logic it may take a very long time to discharge the filter capacitor when the power is removed. This may not be a big deal unless you need to cycle power to recover from runaway firmware. I think waiting more than a few seconds would get kind of irritating after several repetitions. Just my opinion.
 
Couldn't you fix that with a switch that shorts the circuit through a nice big resistor?
 
Taymo said:
Couldn't you fix that with a switch that shorts the circuit through a nice big resistor?

or grounding the master clear line or a Vcc interuptor switch or ...

by the way, that solution is common in single supply robots.
 
Last edited:
Do not let the voltage drop along the supply cable due to motor current affects the PIC supply.

The following arrangement will help if you have a good(+12V gel battery or regulated) power supply.
 

Attachments

  • supply1.png
    2.2 KB · Views: 468
Awesome! Thanks everyone for the FAST replies! There's definately a passion for electronics in this forum! I'll give the one supply circuit a try. I'm amazed at the number of diodes out there that have specific functions. Just out of curiosity, why a 1n4001 for this circuit? Looking at the spec sheet, it seems like just a basic diode, nothing fancy.
 
the dude of dudes said:
... why a 1n4001 for this circuit? Looking at the spec sheet, it seems like just a basic diode, nothing fancy.

that is correct. it's purpose is to prevent the surges from pulling down the filter cap.

Note that if the voltage in is close to the voltage out, you might want to use a schottky diode to reduces it's forward drop so as to give the regulator a bit more head-room. silicon is around .7V and the schottky will probably less than half that.
 
Unrelated to the 298 and PIC, I see in a lot of power supply schematics a large value cap in parallel with a lower value cap (10uf or 100uf and 0.01uf). I've read that the smaller cap acts as a shunt to the larger cap, but I'm not sure what is accomplished by this. The reason I ask is that I see this in the single supply schematic posted in this thread (10uf and 0.01uf).
 

Capacitors across the supply are to ensure that the supply rails are all at the identical AC potential, this is crucial to how almost all electronic circuits work. Now an electrolytic is good at low frequencies, but at high frequencies it's self-inductance prevents it been effective - so it common practice to put a lower value, non-electrolytic, across the supply to ensure good decoupling at higher frequencies.

However, PIC's are exceptionally tolerant about their supplies, and I only ever use small electrolytics - but adding extra small capacitors across them will theoretically be 'better' - but shouldn't make any actual difference.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…