MisterMel
Posts: 2
Joined: Mon Jun 08, 2020 12:07 pm

Capacitor to stabilize power supply?

Mon Jun 08, 2020 12:12 pm

I'm using a buck converter set to 5V which is connected to 6 AA batteries. The buck converter feeds the RPi via the header pins and this works perfectly. However, when I hook up my motor driver and send signals from the RPi to the driver to rotate the motors, the RPi completely crashes.

I'm pretty sure this is because the buck converter isn't stable or something like that, since motors use a lot of current when starting vs when running normally. I added a 100nF capacitor at both the motor driver and at the header pins on the RPi. This makes it work a bit better, however it is still does not work perfectly. Would adding a capacitor with a bigger value help here?
I guess I could also just use a secondary battery for the RPi, but I would rather use one battery.

User avatar
thagrol
Posts: 3178
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Capacitor to stabilize power supply?

Mon Jun 08, 2020 2:31 pm

I suspect the issue is the amount of current being drawn by the motors whether that's via the buck converter or not.

If the motors draw too much, either the Pi won't get enough or the voltage will drop too low.

Find the stall current of each motor, total those up, add the current needed by the Pi (see here: https://www.raspberrypi.org/documentati ... /README.md), add some margin to allow for inefficency in the buck converter then add 20% to the total.

That's how much current your battery pack needs to be able to supply. And that your buck converter has to allow if powering the motors through it.
Arguing with strangers on the internet since 1993.

pidd
Posts: 724
Joined: Fri May 29, 2020 8:29 pm
Location: Birkenhead, Wirral, UK
Contact: Website

Re: Capacitor to stabilize power supply?

Mon Jun 08, 2020 4:59 pm

Yes some beefier capacitors would help and I hope you have some decent protection diodes across the motor.

You would be much better off with two separate supplies.

emma1997
Posts: 868
Joined: Sun Nov 08, 2015 7:00 pm
Location: New England (not that old one)

Re: Capacitor to stabilize power supply?

Mon Jun 08, 2020 11:37 pm

MisterMel wrote:
Mon Jun 08, 2020 12:12 pm
I added a 100nF capacitor at both the motor driver and at the header pins on the RPi. This makes it work a bit better, however it is still does not work perfectly. Would adding a capacitor with a bigger value help here?
Yes, but you need a cap ten thousand times bigger (1000uf) to make much of a difference. I find it hard to believe your .1uf had any effect at all. Depending on type of DC-DC there is a common problem supplying impulse power for both the Pi and motors or relays. Their built-in output caps, on the order of 100uf, are rarely enough for this.

Also type of chip used can make a difference. IME the popular LM2596S are not adequate, specially for Pi4 and/or if anything else like HD or SSD is connected. I've had many intermittent/borderline failures with these cheap Ebay modules. Not surprising since that whole TI Simple Switcher technology is many decades old.

Much better luck with more modern devices like XL4015 or even newer sibling LM2596HV. They only cost a few pennies more but worth it IMO. And that's coming from one of the cheapest misers on the planet.

Also bigger inductor helps and toroid is better than spool or open core.

The biggest problem is with startup pulse requirements from motors. relays. solenoids, and computer boards that have big power rail caps like Pi. If steady state current draw is just too much no cap will help.

Also note that AA is a poor choice for most projects, unless a much larger number are in series, IE 12 or more cells. Specially alkaline wich have very poor power density compared to others like NIMH or Lithium. In most cases just a couple 18650 lion work much better for me. Many other benefits too, like cheaper and much longer shelf life and almost zero self discharge.

tombsar
Posts: 46
Joined: Wed May 13, 2020 12:40 am

Re: Capacitor to stabilize power supply?

Mon Jun 08, 2020 11:48 pm

Also note that AA is a poor choice for most projects
Seconded. I once (young and foolish) tried to substitute 6xAA in a kit that called for a 7.2V hobby battery pack, and they burst from the excessive current draw. The contents are quite corrosive!

MisterMel
Posts: 2
Joined: Mon Jun 08, 2020 12:07 pm

Re: Capacitor to stabilize power supply?

Tue Jun 09, 2020 9:17 am

Thanks for the replies everyone! I'm going to try a bigger cap, but if that doesn't work reliably I'll add another battery to power the Pi. In either case I'm going to switch out the AA batteries for something else, probably NiMH.
Yes, but you need a cap ten thousand times bigger (1000uf) to make much of a difference. I find it hard to believe your .1uf had any effect at all.
Sorry, I meant 100uF but wrote 100nF.
Yes some beefier capacitors would help and I hope you have some decent protection diodes across the motor.
By protection diode do you mean a flyback diode? I think the motor driver should be able to handle it, the example diagrams provided by the manufacterer (Pololu) did not show any diodes, just the outputs of the driver connected directly to the motors. I am using a DRV8835 but am probably going to switch it out for something more powerful.

pidd
Posts: 724
Joined: Fri May 29, 2020 8:29 pm
Location: Birkenhead, Wirral, UK
Contact: Website

Re: Capacitor to stabilize power supply?

Tue Jun 09, 2020 9:36 am

I assumed relays, sorry.

The reason I mentioned two supplies is with bigger capacitors the supply voltage rise on power up may be slower and in the past a slow ramp-up of the supply was known to create occasional boot problems.

Perhaps modern devices don't have this problem but I still get a warm comfy feeling when I isolate my digital supplies from others that may have potential surges or droops.

Return to “Troubleshooting”