Power

From www.chip-community.org
Jump to: navigation, search

Supplying power to CHIP and its peripherals is not always easy.

See Care and Feeding#Power for a short-and-sweet version.

See Measurements#Power needs for careful measurements of CHIP's power needs. See this post especially for a high-resolution view of CHIP's current consumption over time. Eye-opening.  :-)

This page gives details. Thanks to JKW and leonardwong for providing much of the information consolidated here.



Power Designs

Many people try to power CHIP plus its peripherals using a simple 5V USB charger supply connected to the MicroUSB port, and find that they have problems with CHIP abruptly losing power (the LEDs turn off suddenly). There are several possible solutions, described here.


Power Design 1: MicroUSB and Powered Hub

This requires a MicroUSB power supply that can provide at least 900 mA without any voltage droop or excessive noise. Remember that the ratings printed on cheap USB chargers OFTEN LIE, so you still may need to try more than one supply before you find one that reliably powers CHIP. Also note that a low-quality cable can degrade the power of even a good-quality power supply. Multiple users have reported that by switching to a different USB cable, their power problems went away.

This design requires two supplies - one for the MicroUSB on CHIP, and the other for the powered hub. (See Power Design 6: Powered Hub Only for a single-supply alternative.) Note, however, that even this solution does not help the power demands of "DIP" or "shield" devices that plug into CHIP's header pin connectors, like an VGA or HDMI adapter. If CHIP DIP peripherals need more than 900 mA, you'll need a different power design.

One advantage to this approach is that if a out-of-spec USB device demands more power than the powered hub can supply, it won't steal power from CHIP. I.e. the powered hub provides CHIP with some level of protection from a bad USB device.


Power Design 2: Enhanced MicroUSB

This solution consists of using NTC's "no-limit" CHIP OS that allows unlimited current to be drawn from the MicroUSB. If you cannot use that OS, see this post. These solutions disable the current limiter, allowing significantly more current to be diverted to the peripherals while still giving CHIP adequate power. Note that if power-hungry USB peripherals are desired, a powered hub may still be required.

WARNING: be aware that this removes a protection for your laptop, which may not be able to supply more than 900 mA. If you plug a CHIP into a laptop (perhaps to flash it), make sure that NO peripherals are attached to CHIP. No USB devices, no video boards or other "DIP" plug-on boards. Just naked CHIP.


Power Design 3: MicroUSB Plus Battery

This is the same as power design 1, with the addition of a LiPo battery.

This will work for CHIP plus full-size USB loads that average below 900 mA, but can spike significantly above 900 mA for reasonably short periods. The battery will handle short-term current demands greater than the AXP allows from the MicroUSB, and allows charging of the battery during periods of lower power consumption.

The battery also provides uninterrupted power (UPS) during loss of MicroUSB, either intentionally (moving the device from one room to another) or unintentionally (power failure).


Power Design 4: CHG-IN

CHG-IN (pin 2 of U13) is allowed to provide up to 2.5 A (2500 mA) to power CHIP plus peripherals. The power supply is still restricted to providing 5V of clean power (i.e. should be capable of supplying the desired current level without voltage droop or excessive noise).

Note that if power-hungry USB peripherals are desired, a powered hub may still be required.

A battery can also be added to this solution to provide uninterrupted power (UPS).


Power Design 5: Queso

The Queso DIP board is a combination 4-port powered hub plus voltage regulator which supplies power to CHIP via CHG-IN, and allows the use of a much wider variety of power supplies with output voltages ranging from 7 to 28 V. If you have an old laptop supply, it will probably work.


Power Design 6: Powered Hub Only

This approach is used by some NTC engineers. Connect CHIP's full-size USB port to a powered hub. Then connect CHIP's MicroUSB to one of the powered hub's ports. Choose a powered hub that can supply at least 1A to the port CHIP is plugged into; preferably 2A if DIP boards are desired.

Note that in this setup, it appears that CHIP is connecting itself as a peripheral in kind of a "loop". Apparently this is OK and does not pose a problem.

An advantage of this approach is you only need one power supply (for the powered hub). A disadvantage is that connecting a VGA, HDMI, or other power-hungry DIP board might push CHIP over the 900 mA limit on the MicroUSB, requiring the use of the "no limit" OS or the axp209-nolim startup script.


Surges

According to CHIP documentation, CHIP (with no peripherals) requires 500 mA at maximum. However, CapnBry has proven with his oscilloscope that CHIP can briefly spike at 1.1A. It appears that the AXP209's 900 mA limiter allows very brief spikes of current without cutting power.


AXP209 Power Controller

CHIP has a pretty sophisticated power controller, the AXP209. This chip allows three separate power sources:

  1. MicroUSB
  2. CHG-IN (formerly known as ACIN-5V) - pin 2 of U13
  3. Battery

You can supply via any one, any two, or all three of the above, and the AXP209 will seamlessly switch between them as appropriate.

The AXP also allows programmable current limits, in and out of CHIP. By default, the AXP limits current draw from MicroUSB to 900 mA. If CHIP plus peripherals demand more than 900 mA for more than a very brief period, the AXP209 will cut power. This is to protect laptops and other devices which could be damaged by connecting too-heavy a load to USB. Fortunately, 900 mA is more than enough to power CHIP with no peripherals plugged in.

The 900 mA limit becomes an unnecessary limitation when a good power supply is used (instead of a laptop), and can cause problems when one or more peripherals are plugged into CHIP, such as keyboard, mouse, flash memory, ethernet adapter, VGA/HDMI adapters, etc, etc. Those peripherals plugged into CHIP's full-size USB or into the header pin connectors essentially steal power from CHIP, and if the total current consumption rises above 900 mA, the AXP209 immediately shuts CHIP down. Note that the shutdown is abrupt, *not* graceful, which is bad (see Care and Feeding#Shutdown). It is important to use a power design that avoids AXP209 shutdowns.

The AXP also enforces a limit of 500 mA on the full-size USB port. If you plug it into a passive USB hub, then the total current demanded by your USB devices must total less than 500 mA. This is true even if your power supply is able to cleanly supply much more. A powered hub is necessary if you have USB devices that total more than 500 mA.


Why it's Harder to Power CHIP Than Other SOCs

Many people have complained that CHIP has more trouble with power than other popular SOCs, like Raspberry Pi. There are some reasons why things are the way they are, and they trace back to some fundamental design decisions. (Note: this was written by a CHIP user, not an NTC employee, so some of this is based on educated guesses and speculation.)

  • NTC wanted a low-cost, ready-to-use SOC, suitable for use as a component in a larger project. They chose not to have an SD card slot, and instead to solder NAND flash directly to the board. The NAND is lower cost than an SD slot plus an SD card of the same capacity. It is also easier (read cheaper) for them to pre-flash CHIP with a working OS prior to shipment than it would be to program an SD card and insert it in the slot prior to shipment. Also, soldered-in is always going to be more durable than an SD card in a holder. NTC's experience with RPi in OTTO cameras was that the harsh realities of the outside world resulted in occasionally unreliable operation. The SDs weren't failing right and left, but they did sometimes fail. Soldered-in NAND can also fail, but is statistically much more reliable, overall.
  • So, what does that have to do with power? I'm getting there. The decision to use soldered-in NAND means that customers need a way to FLASH a new OS. NTC's solution was to enable high-speed communication between a laptop and CHIP via MicroUSB. I.e. CHIP owners connect their devices to laptop USB connectors. I am told the MicroUSB connectors on other SOCs are almost always "power only". There is no reason to connect an RPi to a laptop via its power supply MicroUSB.
  • As a result, RPi is free to violate USB guidelines regarding current draw. The different USB specs give limits on how much current a USB device is allowed to draw. Since RPi's MicroUSB is not a full-function USB, it can violate those guidelines. Thus, RPi has no need to place an artificial limit on the current draw of it's MicroUSB.
  • But since CHIP actually *NEEDS* to be connected to a laptop for certain necessary operations, NTC realized that they needed to be more careful about conforming to USB guidelines. That is why they make use of the 900 mA current limiter.
  • There is a non-zero risk of damaging a laptop USB port if a device goes too far out of spec and demands too much current. NTC wanted to be on the safe side.
  • 900 mA is plenty of current to power a "naked" CHIP (i.e. no peripherals attached).
  • NTC recommends the use of a powered hub when connecting USB peripherals. This allows the 900 mA limiter to be only for CHIP's internal needs. 900 mA is often NOT enough to drive CHIP plus keyboard plus mouse.
  • NTC may have made a miscalculation regarding the NTC VGA and HDMI DIP boards. I suspect that their early calculations suggested that the 900 mA limit would be OK for CHIP plus DIP. But it looks like it is very close to the edge, and many users need to use the "no limit" OS, which removes the 900 mA current limit.

In summary, NTC's decision to use the MicroUSB for both power and data led them to chose a current limiter on the MicroUSB power. That limit has made it somewhat more challenging for CHIP users to settle on a power solution, as compared to the average RPi user.


AXP209 Current Limit Settings

The following commands need to be executed as root (e.g. with "sudo").

# Set to 900mA
i2cset -y -f 0 0x34 0x30 0x60

# Set to 500mA
i2cset -y -f 0 0x34 0x30 0x61

# Set to 100mA
i2cset -y -f 0 0x34 0x30 0x62

# Set to no limit
i2cset -y -f 0 0x34 0x30 0x63

# Show current value
i2cget -y -f 0 0x34 0x30


Charging Batteries

Batteries in Parallel

There is not a clear consensus on the advisability of connecting two LiPo batteries in parallel without charge balancing circuitry. The NTC employees Bleepbloop and Gush recommend against doing it, but community members Lukanite, BananaGuns, and anisbet say it's OK, so long as the batteries being connected together are identical. Anisbet goes on to say that you need to make sure, which building the battery pack, that the batteries are at very similar charge levels. If one is charged more than the other, it can lead to rapid heating and possible damage to one or the other battery. If the charge difference is great enough, it could even lead to a fire. BBS user nbastin says that connecting cells in parallel will typically reduce their lifetimes, further advises that each cell must have its own individual overcharge protection circuit, and strongly advises against soldering directly to a cell in a way that might heat the cell, even temporarily. here is another post I consider very informative on the subject, but subsequent posts disagree.

Note that CHIP has two ways to connect a battery: the JST connector and the header pins. Be aware that these are wired directly together, so attempting to connect a separate battery to each is in effect connecting them in parallel.

Finally, some people have asked if using a Booster (battery-operated USB charger, a.k.a. "Battery Bank") counts as "batteries in parallel". The answer is no. These are high-capacity batteries which offer 5V on a standard USB connector. The idea is that if your mobile phone (or CHIP) is low on batteries and you can't plug in a charger, you plug your phone into the Booster and it charges your phone. This is fine to use with your CHIP, even with a battery connected to the JST connector. Plug it into the MicroUSB port, or CHG-IN on the header, just like it is a normal power supply, and CHIP will use that power to charge its JST-connected battery. Note that in this configuration, a Booster attached to CHIP's MicroUSB will not be charged by CHIP, even if a power supply is connected to CHG-IN.


Saving power

How can you minimize power consumption by CHIP? See this post.