Portable pi

Tl;dr

I wanted to make my raspberry pi portable so I went out and found a screen that connected via HDMI. Next I needed to get a case, I found a rip off of a pelican case over on aliexpress. After I had the screen and the case I needed to find away to get it all to fit together so I had some acrylic laser cut. I had a power bank that I was using for power that complied the portable side.

Guild towards the bottom of the page

My portable journey

I’ve always had a fascination with using a raspberry pi as a real computer, I’m sure I’m not alone. The first raspberry pi wasn’t up for the task but on release of the raspberry pi 2 this all changed.

Most of the time I used my raspberry pi headless from a laptop or even phone or tablet but for somethings you needed to have a screen attached, This is when I started to look into getting a small screen for my pi. I didn’t want a screen that used the GPIO because most of the time you need to patch the kernel to get it to work and sometimes limited to pre build images only.

I found a 5″ screen that had a res of 800 x 480 which doesn’t sound like much but it’s enough for my needs and it connected to the pi via HDMI which was the important part. It also has a touch screen which i managed to get working. It was easier than I thought it would be. I followed this blog post HERE. First you need to add the lines below to /boot/config.txt


dtparam=spi=on

dtoverlay=ads7846,penirq=25,speed=10000,penirq_pull=2,xohms=150

After a reboot the touch screen should be working be next we need to calibrate it. This is the hard part you will need to find some files by googling “5inch_HDMI_LCD.tar.gz” untar them with


tar -xvzf 5inch_HDMI_LCD.tar.gz

Once untar cd into 5inch_HDMI_LCD and install xinput-calibrator_0.7.5-1_armhf.deb with 


dpkg -i xinput-calibrator_0.7.5-1_armhf.deb

You can find the calibration app in the app menu under preferences

After the first time you run it it will ask you if you want to make it permanent, you will need to save the setting into a file. I couldn’t find the file it was tell me to put the setting into but i found on THIS blog the location and the file you need to create. I created a file called “01-input.conf” in “/usr/share/X11/xorg.conf.d/” this is where you will need to save the output from the calibration software in the terminal window starting with the line section “inputClass” mine looked like this

Section "InputClass"
Identifier "calibration"
MatchProduct "ADS7846 Touchscreen"
Option "Calibration" "149 3976 176 3995"
EndSection

The screen wasn’t as plug and play as I was hoping it would be. The problem was that the pi wouldn’t go full screen on the 5″ screen. After a bit of searching around I found out I only needed to modify the ‘config.txt’ file in the /boot directory. You need to add these lines at the bottom with a command something like ‘sudo vi /boot/config.txt’ or any other text editor

# uncomment to force a specific HDMI mode (here we are forcing 800x480!)
hdmi_group=2
hdmi_mode=1
hdmi_mode=87
hdmi_cvt=800 480 60 6 0 0 0

max_usb_current=1

All you need to do when going back to using a normal screen is comment out

these lines with # and reboot.

Now that the screen was taken care of I need to find something to house the pi and the screen. I always thought the really early portable computer were cool and wanted to pay homage to themimage

This is when I decide to try and find a pelican style like case to house everything. I first looked on eBay but couldn’t find anything that was the right size and not crazy expensive, Next I looked on my new favours shopping site aliexpress. This is where I found the prefect sized case and it wasn’t too expensive ether.

Jpeg

The brand is QIAN they have a shop on aliexpress, The model you need to search for ‘QA1308’.

I was planning to have the raspberry pi and the battery in the base of the case and lay it on its back with the lid laying out the front like in the picture below

Jpeg

I would need to make a front panel for the screen to fit in the top so it would be at just the right angle to use.

I have never had anything laser cut before and didn’t know where to start. After a quick search I found RazorLab (I’m not endorsing them it’s just one that I picked) they had a guide to get me started with the design. I used inkscape for my design because it was free and open source and on all platforms. After measure up the opening of the enclosure I started to draw the laser cut lines. What I like is that when you think your somewhere close in size you can print it out and try out before pulling the trigger on the design. I wasn’t sure how much it would cost to have something laser cut. The price is broken down into 3 things, material cost, making and shipping. The material cost of  a  181mm x 181mm 3mm thick sheet is £1.39. The making cost is £3.63 (The more complex the more this will cost) lastly the postage cost £6.75, Postage will take around 28 days but mine came in 22 days. The total is £11.77 all in all.

Before I have the Acrylic made I mocked up a front panel with some uPVC I had laying around. After 2 different designs I found the final design, This is when I found the problem of how I was going to get power into my raspberry pi. I couldn’t find a right angled micro USB cable that would fit in the tight space. After some searching I found that you could in fact power a raspberry pi from the GPIO. This isn’t advised because there isn’t any protection from over voltage or mixing up the power and ground, I haven’t run into any problems from doing this but you have been warned. The problem is the screen feeds the raspberry pi via GPIO so the GPIO we need to power the pi are covered by the screen. Lucky for us they have breakout GPIO headers on the screens PCB but they are unpopulated. All I need to do is solder a 2 x 13 female head onto the footprint. You can get 2 x 13 female headers but there really expensive since no one needs them anymore nice the raspberry pi 2 onwards uses 2 x 20 headers, I just ordered a 2 x 20 header and cut it down to the required size, Also I need to bend the pins out flat since its SMD

I have to make up a custom cable, I had to get a right angled USB cable cut and strip it back to expose the internal wires. I used a multi-meter to find the power and ground because sometimes the wires weren’t obviously colour coded. Lucky for me there were some nice thick red and black wires for power and ground. I added a right angle male header to slot into the female header I added to the screen PCB.

Jpeg

Jpeg

I’m powering the portable pi from a USB power bank. Luckily the one I had fitted perfectly in the case with my custom cable. I haven’t done any extensive testing of battery life but I’m sure it will out run most laptops plus you can turn the screens back light off if your running scripts in the background.

I found there is enough to space in the case for the usual WIFI and Bluetooth dongles but if you wanted to add a flash drive or a SDR dongle you are out of luck. This is why I added a little cutout in the front panel of the acrylic so that you use a 90 degree USB extention cable and a USB hub to let you plugin what you want

Jpeg

90 degree cable with USB hub for larger USB devices

Jpeg

Cut out for the cable

 

Guild

First things first this is not a definitive guild its just to point you in the right direction. You might want to put your own spin on what I have done and that’s fine. So lets get started with a shopping list.

  • First thing your going to need to get is the screen. Do a search on ebay for ‘XPT2046 P5’ this will give you the same screen I have
  • The waterproof enclosure your going to need to source off of aliexpress by searching for ‘QA1308’
  • The files you will need to send to your chosen laser cutting firm HERE. These were made with the design guild lines set out by razorlab.co.uk so they might have to be changed if your going to go with someone else
  • Power bank, Your going to have to get one that will fit in the enclosure which measures 158*90*72mm and still have room for the usb cable. Your best bet would be to get a 4 x 18650 power bank
  • 2 x 20 female header
  • Standoff washer are next on your shopping list, You will need to source M3 15mm length.
  • And lastly M2.5 washers

When you have all these things on the list you can go about assembling your portable pi.

There isnt much to it really. First your going to need to stick your acrylic parts together. lay the screen down on its face and attach the M1 standoffs but leave the one that sits under the raspberry pi. next lay the acrylic around the screen then lay the surport pieces for a dry fit to make sure it all fits. I just used super glue to fix it all together but you could use acrylic cement, Now that its all fits you can glue it together. To keep the screen fixed to the acrylic this is where the M3 standoff spaces come in, You will need to trim a few mm off the spaces, you can use a Stanley knife for this (watch your fingers). Lastly you will need to drop the M3 spacers along with the washers over the M1 standoff bolts and attach the M1 nuts.

Jpeg

For the power side its alittle tricky, I couldnt find a micro usb cable with a right angled head that was small enough to fit. After abit of the google searching I found that can power your pi from the GPIO pins, This is risky because there is no protection or regulation so its down to you to to make sure the power bank it outputting the right voltage and your don’t get your power (+) and ground (-) mixed up. You can ether find a 2 x 20 female header that SMD (surface mount) or just get a regualor one and bend the pins flat, First your going to have to trim it down to a 2 x 13 pin header (same size as original raspberry pi header) then solder it to the breakouts on the backside of the screen

Jpeg

Breakout Header

Next your going to have to make up a cable, I found that the right angled USB cables fit best, You will need to chop the other end and stirp it back to find the power and gound, I find connecting the stripped cable to a USB power socket then testing the cables with a multimeter is the easiest method. After you find the power and ground wire you can solder jumper cables to these like in the picture below.

Jpeg

Custom cable

Jpeg

Video

youtube – 

Advertisements

One response to “Portable pi

  1. Pingback: Electro_pet | Facelesstech·

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s