Two big features of the Raspberry Pi development board are its versatility (due to open hardware/software) and its compact size. I had read a couple of different project articles on the web on how to use a USB Wi-Fi adapter to convert the Pi into a wireless access point. As an access point the Pi is creating a mini wireless network that has data passed through from the ethernet port. Taking just the wireless network part of the code and using it a portable means of communication with other devices seemed like something that could useful in a number of projects. With a bit of tinkering I could use the Pi as a wireless Samba server and a wireless web cam. Adding battery to power the Pi you would have a portable Wi-Fi network you could take with you. Googleing around showed that a number of hackers out there were already had projects doing exactly this. Some example applications include: wireless still/video camera, wireless file servers (Pirate Box), remote control and wireless data collection. I didn’t have a CSI camera at the time but I could see a number of uses just with the camera alone such as: balloon cam payload, motion activated nature cam, and time lapse photography.
Of course the easiest solution for most would be to just buy a portable cell phone charger and plug it into the mini USB port. This solution is a little bulky but takes 0 development time. Looking at the footprint of the Raspberry Pi board I thought it should be possible to build a battery attachment that would be less than 1″ thick and power it for at least two hours. With a little creative packaging it would look cool too.
Most of the powered components for the Pi were designed to be used in portable electronics. More than likely the power for these devices would be from a 3.7V li-ion battery. To power the Pi with a li-ion battery, a circuit would be needed to step the voltage up to the 5V. The battery would also need a special circuit to charge it.
Getting The Parts Together
Thanks the powers of mass production and the ever growing smart phone market most of the components necessary to build a useful battery board for the Pi are available through ebay. The three main components I needed to build my battery board were a inexpensive battery, a charging circuit, and a boost converter to convert the 3.7V to 5V. Note, whenever building something powered by a li-ion battery you have to be sure there is a circuit that has a cut-off for over voltage and under voltage limits on the battery. Since most cell phone batteries have these built into the pack I didn’t have to buy a separate one – though I do have a few in my junk box from previous projects.
It took a bit of web research to figure out what battery I wanted to use. There is a huge after-market for cell phone batteries and buying a good one can be a bit of a craps shoot. Also, though most postings for li-ion phone batteries will show a rated voltage and claimed capacity very few show the physical dimensions of what they are selling. I decided to take a chance and buy an aftermarket battery built for the Samsung Galaxy S3. The Galaxy S3 is very popular phone that has been out for a while, I figured the cost/performance for the battery should be fairly good. The no-name battery I purchased out of Hong Kong ran about $4 US. The label claim 2300mAh but I later found it to be more like 1600 mAh.
Next I needed a boost converter to take the 3.7V from the battery and step it up to provide 5V with at least 700mA of current output. Suprisingly, doing a ebay search for boost converter will yield several options for a tiny circuit board to convert from a lower voltage up to 5V. I wanted a minimum of ! A output for less than $5 delivered. I ordered two boards, one rated at 1A and one rated at 3A. The 3A unit was a bit over $5. The small 1A unit was roughly 3/4″ x 3/4″.
The charger unit was harder to find than the boost circuit. I found a couple of options on the Sparkfun and Adafruit websites but not too much on ebay short of some AC wall-plug chargers. I did notice that the simplest chargers available on Sparkfun and Adafruit used the MCP73831 IC to control the charge. I considered buying a MCP73831 and building up the circuit myself since it only required a few components but when you add in shipping costs and probably a breakout board to make the tiny IC connections it was more than I wanted to spend on a quick and dirty prototype. I went back to ebay and did a search under MCP73831 and found a little charger board for just under $8 delivered.
The image I have of the charger board was taken after I removed the JST plug.
As a platform to hold all my components together I used a piece of perforated prototype board (perf board). I used perfboard for a lot of my projects in the past. Perf board from US vendors is kind of expensive – especially if you want the double sided type with plated through holes. Buying through ebay provides a number of low cost alternatives.
In my work with Ardruino hardware I had put a number of circuits together using combination breakout board glued to a common piece of perf board using double sided adhesive. The double sided adhesive is actually a 3M adhesive film that is applied to a surface along with a no-stick backing material whick removed before the surface is applied to another. I would use this double stick adhesive attached to both sides of a piece of business card stock. Of course this technique only works on breakout boards with components on one side only. The purpose of the business card stock was to allow for a little more compliance between the two surfaces and also provide a layer of electrical insulation when used on circuit boards with exposed backside traces.
To get the final assembly to be as thin as possible i cut the perf board so that when the board was mounted above the Raspberry Pi the header pins lined up with the holes in the perf board – I didn’t want to cut the header pins just yet. I also cut a 1/4″ hole to give some additional clearance to the 220uF filtering cap nex to the USB plug. For mounting the board to the Pi I added four holes for 4-40 standoffs that would be fastend with screws to the perf board. Only two of the stand offs would actually be fastend to the Rasperry Pi board the other two only acting as spacers.
Anyone who has looked at building an acessory board for the Raspberry Pi has probably spent some time deciding how to work around the analog video port. The analog video on the Pi comes out through a RCA Plug that sits quite a bit higher than the I/0 header pins. Designing a acessory board that had a standard header socket mounted to it would have to implement some means of going over or around the RCA jack. As most of the applications I was interested in had no use for the analog Video out my solution was to just de-solder and remove it. While I was at it, I also removed the audio jack. Early on I had decided to use a model A Pi board for this project to avoid having to deal with clearances with the 2 port USB and the Ethernet recepticles.
The one piece of hardware that I didn’t mention earlier, was some kind of switch to switch between battery power and normal micro USB power. Searching through one of the local surplus stores, I found a 4 pole double throw switch marked ‘ALCO‘ that I thought would do the job.
Doing a seach on Digikey for a similar looking switch I found the rating to be 0.4 VA @ 20V. I believe the 20VA is a power rating, so at 5V I should be good to 2A? I don’t think the calculation is quite that simple but I thought there was a good chance the rating was high enough.
Not wanting to have a usb plug hanging off the mini usb port that normally powers the board, I decided to make power connections to the Raspberry Pi by breaking into the power input at the poly fuse. The poly fuse on the Pi is on the back of the board next to the SD card holder. I didn’t use any kind of quick disconnect plug and made the hard wire connections directly on each board.
Below is a hand CAD sketch of how I wired all the parts together:
With the no-name S3 battery fully charged I could run the Xbian version of XBMC with a Wi-Fi dongle streaming video for about 2 1/2 hours. After testing the battery board for a few days I decided that I would build a second battery board. The two major improvements on the second battery board would be : extended battery life, and multiple USB ports through use of a mini hub. The tests I had ran to improve battery performance led me off into another project altogether – a watt hour meter built on the Arduino platform.