Nano-Linux systems, wearables and portable equipment all need electrical power to operate.
Most devices I work with, like the Raspberry Pi, the CHIP computer, the Arduino and the ESP8266 require either 3.3- or 5-volts at up to about two amps of current. Many boards have solderable headers, where you can hook up from five to 20 volts DC and the onboard voltage regulator will take care of making sure the right voltage gets to the microcontroller. Other devices have standard micro USB-B sockets that handle both power and a serial signal.
What’s great about modern microcontroller boards is that there are a lot of options on how to power them. Today’s discussion will cover some of these options.
A standard Arduino Pro-Mini has solder pads for all connections. It can accept from 5- to 12- volts on its RAW voltage input pin. So, you could just wire it into a 6-volt lantern battery or hook up a couple of leads to a car battery. Spec sheets for other Arduinos and clones will tell you what voltages are acceptable.
I’ve run some of my Pro-Mini projects with four AA or D cell battery packs, giving a total of six volts. Naturally, the larger the battery size, the longer the device will run. My AA powered (about 500 mAh capacity) projects might run for a half a day while powering something, while D cells (about 8000 mAh capacity) might be good three to five days of continuous running. Keep in mind that battery life varies widely, due to the number of sensors you are using, the size of the batteries, type of cell and so on.
Suppose you want to run a Raspberry Pi 3 or a CHIP board from that same four D cell battery pack?
An OK way to go is to build yourself a little 6-to-5 volt power supply using an L7805 voltage regulator chip and a hacked up micro-USB cable. Hook a 100 uF capacitor to + power lead and ground on the 7805. Then connect a 10 uF capacitor across the 5-volt output pin and ground. So, six volts goes to the + power lead and five volts flows from the output pin to the positive wire attached to the micro USB-B connector. Ground goes to the ground (probably black or green) wire attached to the micro USB-B connector.
The 7805 can supply up to about 1.5 amps and uses input voltages from 6- to about 18-volts. If you use input voltages toward the upper end, you should consider adding a heat sink to the 7805, because all excess voltage is dissipated as heat.
There’s also a 3.3-volt version, called the LD1117V33. It hooks up the same way as the 7805. You’d use this model for devices that need a 3.3-volt supply voltage, like an ESP8266.
Here’s a Fritzing diagram showing the old ESP8266 infrared sensor project. Note the 7803 and the two capacitors, on the right-hand side.
Lead-acid batteries are plentiful and might work for Arduino-type (non-micro-USB equipped) boards that run on 3.3- or 5-volts.
There’s a much easier-to-use solution for powering the Raspberry Pi and CHIP computer. It’s called a cell phone power bank.
Rechargeable Power Banks
External cell phone battery banks are available everywhere. They’re typically a set of lithium-ion batteries housed in some type of case, possibly with a charging circuit, a standard USB-B on the computer/wall wart facing side and a micro-USB-A connector on the 5-volt side.
I’ve picked up small ones (2200 mAh capacity) at conferences, as swag.
You can buy them everywhere at malls, convenience stores and big-box electronics outlets. Online sources usually have huge varieties. Some even have multiple output connectors and an LED flashlight. Capacities range all the way up to 15,000 to 20,000 mAh monsters. These things weigh about a pound and cost between $25 to $35. A power bank this size could easily run your Raspberry Pi project for a few days.
So how do you charge a power bank?
That little white Samsung wall wart charger that came with your Galaxy Android superphone, makes a great power bank charger. It puts out a solid 5.3-volts at 2 amps. One cool aspect is that you can plug the thing into a standard 110-volt North American outlet as well as a 220-volt European outlet, with an appropriate adapter.
Either way, 5-volts comes out the other end. The output current may vary, from the charger to the charger, so check the specs on the side of the case.
The Samsung charger takes an hour or two to charge up a small (2200 mAh capacity) power bank. Larger capacities will probably require longer charging times, although your mileage will vary.
Most chargers will charge most power banks, even if they are of different manufacturers. That’s been my experience anyway.
The hot ticket is to keep your charger AND associated standard USB cable together and on your person at all times. That way you can charge your phone and power bank, whenever there’s an AC outlet available.
By-the-way, the charger will usually power your Raspberry Pi or CHIP by just plugging it in. That’s right, you can use the charger, in place of a battery or a power bank. My steampunk conference badge has run flawlessly for days on my Galaxy cell phone wall wart. Be sure to use one that supplies at least 2 amps, for the Raspberry Pi, otherwise, the device might periodically hang or reboot, due to voltage sags.
Modern microcontrollers will run on a number of different power input options. Solar is another possibility, so maybe we’ll explore that topic in the future. Don’t forget that you can also plug the micro USB-B side into the Pi, then the USB-A side into a running notebook, for power, too.
So then the big question becomes, will a Pi run from a plug-in car-charger adapter?
I’ll leave the answer to the reader’s research.