3
\$\begingroup\$

I've been messing around with a robot kit from Parallax (the BOE Shield Kit), which has a 5xAA (7.2 V?) power source. The BOE shield includes its own 5 V regulator, which is used to control servos that in turn spin the wheels of the robot. The regulator is rated for up to 1 A of regulated power.

Now for the fun part: I want to also power a Raspberry Pi from this same circuit. I've been able to successfully power the Raspberry Pi via the Arduino's own 5 V output (not through the BOE regulator) and the GPIO pins. The Raspberry Pi has a single USB peripheral - a Wi-Fi adapter. When the servos are not running, or when they're running steadily, there's no problem, and the whole system, including the Raspberry Pi, chugs along happily. When the Raspberry Pi isn't doing anything over Wi-Fi, turning the servos off and on also has no effect on the Raspberry Pi's operation.

However, when the Raspberry Pi is using Wi-Fi heavily (I ran 'apt-get update' as a proof of concept), and I start turning the servos, the Raspberry Pi resets. I'm assuming it detected an undervolt condition and rebooted to protect itself.

Would a decoupling capacitor across the Raspberry Pi's inputs work to overcome these periods of "startup" servo load? Something like this:

CircuitLab Schematic ufmj8z
(source: circuitlab.com)

If so, what type and size of capacitor should I use for this? Does it make a difference how far from the Raspberry Pi the capacitor is placed (I don't really want to solder one directly to the Pi)?

(Yes, I know, I used a relay symbol to depict the servo in the CircuitLab diagram, but they didn't have a "servo" block. Just imagine it as "thing that draws a lot of current for a very short time".)

\$\endgroup\$
1
  • \$\begingroup\$ Clarification: The 5V regulator on the BOE powers the servos. It has the 1A limitation. The RPi is pulling directly from the Arduino's 5V pin. That is not attached to the same 1A limit. (I'm not entirely certain if it has a limit, other than the 7.2V power supply's limit.) \$\endgroup\$
    – Devin R
    Mar 21, 2013 at 17:53

4 Answers 4

4
\$\begingroup\$

A bypass capacitor on the input to the RPi might be enough, but it depends on the duration and magnitude of the dips caused by servos.

I would use an oscilloscope to investigate the dips. If they are very short (us) then I would add arbitrary caps (100uF, 1000uF) and re-test.

Another solution would be to try and confine those peak draw pulses by adding a diode from the battery to the Arduino, then connecting the Vin to the 5V regulator to before the diode. This way, transients won't pull from the input caps of Arduino, only from the battery.

\$\endgroup\$
4
  • \$\begingroup\$ Thanks Mark, I like both ideas. I will see if I can get my hands on an oscilloscope and test it out. Meanwhile, I'll hook up an ammeter and find out exactly how much the RPi is pulling from the 5V output. If it's up to 1A as Gustavo suggested in his answer, I'll probably need a separate supply for the Pi, or maybe just a separate regulator. \$\endgroup\$
    – Devin R
    Mar 21, 2013 at 18:55
  • \$\begingroup\$ Just some feedback: Arbitrary caps up to 470 uF (the largest I have) didn't work, so I'm assuming that the dips are longer (or larger) than the capacitors can handle. Based on some other issues I'm having, I'm thinking my batteries aren't capable of pumping out enough current to handle even the servos and a couple sensors on their own. \$\endgroup\$
    – Devin R
    Mar 22, 2013 at 15:56
  • \$\begingroup\$ @DevinR Could be a nice improvement to switch to using a li-poly or li-ion battery pack, they will have much better peak current outputs. \$\endgroup\$
    – Mark B
    Mar 22, 2013 at 19:36
  • \$\begingroup\$ I actually just posted a new question related to that: electronics.stackexchange.com/questions/61939/… \$\endgroup\$
    – Devin R
    Mar 22, 2013 at 19:50
1
\$\begingroup\$

WiFi usually requires around 200mA in RX and TX, but the peaks can reach 1A or more. Adding bypass capacitor might help if these dips are momentary, but if the regulator struggles to provide the required average current, a beefed up regulator might be required.

\$\endgroup\$
2
  • \$\begingroup\$ That's good to know about the peak current draw. I was assuming that the draw would be more or less constant, since technically USB isn't supposed to pull more than 500 mA. The RPi v2 doesn't have a fuse limiting current through the USB accessories, so if it is spiking to 1A or more, that could certainly explain the issue. \$\endgroup\$
    – Devin R
    Mar 21, 2013 at 18:56
  • \$\begingroup\$ The spike usually lasts for a few tens of microseconds. I doubt any fuse could limit it fast enough (you wouldn't want to). \$\endgroup\$ Mar 21, 2013 at 19:30
1
\$\begingroup\$

A decoupling capacitor on the RPi will certainly help. Though you will want to get as close as possible to the supply pins. Use an electrolytic and try and find one with the lowest ESR possible.

Analog Devices has some good recommendations:

  • A large electrolytic capacitor (typically 10 µF – 100 µF) no more than 2 in. away from the chip.
    • The purpose of this capacitor is to be a reservoir of charge to supply the instantaneous charge requirements of the circuits locally so the charge need not come through the inductance of the power trace.
  • All decoupling capacitors should connect to a large area low impedance ground plane through a via or short trace to minimize inductance.

Adding a bulk storage cap to the servo would also be a good idea. Again look for low ESR and a value in the thousands of μF.

\$\endgroup\$
2
  • \$\begingroup\$ I understand the document to say that I'd want two bypass caps: a larger one that can be a couple inches away that will take care of larger transients and a smaller one that should ideally be physically touching the pins to filter out higher-frequency noise. Am I reading that properly? \$\endgroup\$
    – Devin R
    Mar 21, 2013 at 19:18
  • \$\begingroup\$ @DevinR Yes you want that but those are already on the RPi board so you don't need to add them. See all the 220nF on the VDD_CORE line and the 100nF on the VDD_BAT line on the schematic? There's also already a single 10µF on VDD_BAT. Adding more capacitance in parallel will allow it to absorb bigger glitches. \$\endgroup\$ Mar 21, 2013 at 19:26
1
\$\begingroup\$

I had a similar problem with an Arduino powered by 4 NiMH batteries that also drove two servos. Whenever the servos would start or change direction, it would reset the Arduino. I solved the problem by placing a large 4300uF electrolytic cap near the Arduino's Vin & Ground. After using the cap, the arduino never reset no matter what the servo's did.

The Raspberry Pi has a larger current draw than the Arduino. A 4300uF cap may work. You may also want to use two caps, a large one right before the Voltage Regulator, and then another one right before the Raspberry Pi.

Really though, you should use a scope and look at the line. It could be noise (and not a voltage drop) is causing the Rpi to reset. In that case, you'd want to use small filter capacitors (ie 0.1uf) on each servo motor to try an filter the noise.

\$\endgroup\$
2
  • \$\begingroup\$ So I just tried a very similar setup today. A Rpi + Arduino Nano + 7805 Voltage Regulator + 2 Servos (con to bat) + 8 AA NiMH batteries. W/O any capacitors, the Rpi would reset immediately once the servo's did anything. After adding a 3300uF cap across the 8 NimH batteries, the Rpi was a bit more stable, but would still reset most of the time after the servo's started moving. I broke out my scope, and noticed that the 5v line was dropping down to 4v for a few ms when the servo's came on. I added a 2200uF across the output of the 5v regulator, and that seemed to fix the resetting... YMMV.. \$\endgroup\$
    – Gene R
    Jun 5, 2013 at 5:45
  • \$\begingroup\$ Just wanted to add that this is very YMMV. With larger servo's, the 8v line was being pulled down to 6v for a few milliseconds, which is outside of the specs for the LM7805 regulator, which then causes the BOR to trip on the Raspberry Pi, thus resetting it. With smaller 9g servo's, I'm seeing a negligible voltage drop. \$\endgroup\$
    – Gene R
    Jun 5, 2013 at 18:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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