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?

  • \$\begingroup\$ First thing to do is to throw away the L298 and replace it with an FET part. Next is to realize that trying to run a rapsberry pi on batteries is a bad idea... \$\endgroup\$ – Chris Stratton Jan 19 at 5:08
  1. 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.
  2. 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
  3. 6 cells times 0.9V/cell works out to 5.4V. Subtract out the 3V drop for the L298, and you have 2.4V.
  • \$\begingroup\$ Wow you just blow my mind. How should i approach this? Sounds like your telling me that I could use more then 6 batteries :0 When you say the H-Bridge drops 3v - does that apply to the voltage the motors and raspberry pi will receive? \$\endgroup\$ – z Eyeland Jan 18 at 18:01
  • \$\begingroup\$ I think I would use 6 batteries and live with the 2:1 change in motor speed as the batteries run down. I'd like to recommend that you use a newer part, but I can't suggest one! Sometimes the hobby world seems stuck in 1975, with L298's and 741's, when the professional world has moved on to much better parts. \$\endgroup\$ – TimWescott Jan 18 at 18:52
  • \$\begingroup\$ The data sheet that I was looking at (ST -- sorry no link, different 'puter) treats the voltage regulator on the L298 as being there purely as a reference for its internal logic. Nothing was said about drawing current from that pin. That says "use at your own risk" to me. 3-terminal regulators are cheap; if you're going to power the Pi from the batteries then I'd use one of those (but not a 1975-era 7805, because they need 7.5V to deliver 5 -- use a true LDO, or better yet a 3-terminal switching regulator module that plugs into a board in place of a 7805). \$\endgroup\$ – TimWescott Jan 18 at 18:55

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.

  • \$\begingroup\$ Ok makes since thanks. The tutorial I watched was youtube.com/watch?v=bNOlimnWZJE&t=646s . This guy uses 9v which doesn't make since to me... \$\endgroup\$ – z Eyeland Jan 18 at 17:53
  • \$\begingroup\$ Ha! I watched the same video when learning about the bridge actually - its quite good. Just to clarify for you, the input voltage is the one passed to the motor, and the speed control is proportional to that voltage. So half speed at 6V is slower than half speed at 9V. I strongly recommend you use the maximum voltage rating of the motor, in your case, 6V. The guy in the video motors are probably rated for 9V or higher so it can take it. \$\endgroup\$ – QuickishFM Jan 18 at 17:56
  • \$\begingroup\$ Oh just noticed that the motors I bought dont specify their voltage ratings. The kit came with a 6 battery holder container. Here is the link to the kit i purchased - amazon.com/Mixse-Smart-Robot-car-Raspberry/dp/B07412K5RP \$\endgroup\$ – z Eyeland Jan 18 at 18:10
  • \$\begingroup\$ Since it came with 6 battery pack holder should I assume the motor ratting are up to 9v? Originally I assumed it would be 3-6 volts since it looks like most cheap 3-6 motors. \$\endgroup\$ – z Eyeland Jan 18 at 18:12
  • \$\begingroup\$ I'm willing to bet that you can put in 9V, and that the motors are either connected in series (leaving each one with 4.5V) or they really are 9V motors. That specific board has 2 motor ports - so i'm guessing that 2 motors are connected to the same source. If there is a schematic you can look at, you will be able to confirm. They also look like low voltage motors to me but I may be wrong too. In any case, you should be able to safely connect 9V. You could also use it to power the Pi if you want (using the onboard 5v regulator). \$\endgroup\$ – QuickishFM Jan 18 at 18:15

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