I am currently wiring up my raspberry pi, H-Bridge and (4) 3-6v ratting motors. My question is, how will performance change based on me using 6 or 4 batteries to power motors? I noticed some tutorials using (6) aa batteries totaling 9V. Why waste two extra batteries and risk too much voltage? Besides the motor ratting is 3-6v; wouldnt 9volts fry the motors? Ive read the H-Bridge has a 5v regulator. Does this mean even if you supply more then 5volts the h-bridge will keep it at 5v?
- The L298 is a very old technology part. It drops about 3V total from battery to load -- so a 9V source would only be 6V at the motor in the end.
- Dry cells only deliver 1.5V/cell when they are freshly charged and moderately loaded. At heavy load, or any load when they're discharged, they supply less. If you want to suck the life out and not throw away batteries with charge left, design for 0.9V/cell
- 6 cells times 0.9V/cell works out to 5.4V. Subtract out the 3V drop for the L298, and you have 2.4V.
The L298N chip itself will only supply the motors with the supply voltage, and change it based on PWM values. Many common L298N boards are available in project kits, with the chip itself, a heatsink, a 5V regulator, and terminal blocks etc. I think you have one of these - they are very common online, for example, an example listing of one. These have a 5V regulator that you can use (if you want) to power the Pi - as long as your input source is larger than 5 (should be over 7V), the regulator will fix the output pin at 5V. The voltage into the motors should depends on the voltage that the motor is rated at - using 6 AAs will make it faster than only 4 AAs, but the motor needs to be able to handle 9V.
From your question it appears you are concerned about the regulator - rest assured, there is a limit (based on the regulator) where the regulator will keep working, and will supply a constant 5V out regardless of the supply voltage. Since the Pi runs off of 5V (USB power) it can be run from there, which means you only need 1 power supply. The motors would be your main area of concern - a 3-6V motor should not be connected to a 9V supply. You should use a 6V regulator, buck-boost converter, or potential divider to reduce the voltage. Otherwise, stick to 4AAs which should give you 6V nicely.