Tuesday, April 11, 2017

Handheld Linux Computers with Raspberry PI

This tutorial will teach you how to create your own handheld linux terminal with built in screen, QWERTY thumb keyboard and battery. It has four passive USB ports for expansion and extra connectivity. It's super portable and is about the size of a Nintendo DS (if slightly thicker).



I initially made it because I thought it'd be cool to fit down into such a small form-factor, but it also has some interesting purposes. It's basically a full handheld linux system that can do almost everything a normal sized computer can do. It's not going to destroy any benchmark tests, so it's best suited to command line stuff. Since this is the case, it's actually a pretty good tool for learning the command line interface as well as basic scripting. The keyboard has all the special characters you need which is really handy.

Almost all the design choices here are made entirely out of necessity for space. If I had a chance to make a custom keyboard and case, it'd be alot sleeker. Considering it's a bunch of off the shelf stuff, I think it turned out pretty nicely.

PHOTOS
- Front view
- Opened flat
- Closed
- Size comparison against 11inch Macbook Air

PARTS
- Raspberry Pi A+ (700MHz, 256MB RAM)
- 4 Port USB hub (make sure it's compatible with the Ras Pi)
- 500mAh+ battery with JST connector
- Adafruit PiTFT - 2.8" Raspberry Pi Touchscreen
- Adafruit Powerboost 500 Charger
- 2x 2.5inch plastic hard drive enclosures (perfect size for a case)
- Wireless 2.4GHz Mini thumb backlit keyboard
- Power switch with JST connectors
- Piano hinge (thickness depends on your case)
- 16GB micro sd card (larger the better)
- Micro USB male component
- Some spare wires

TOOLS
- Soldering iron / solder
- Desolder pump
- A fine-ass file
- Power drill
- Small hacksaw blade
- Solder wick/tape (optional)
- Wire cutters / strippers
- Needle nose plyers (optional)
- Hot glue gun (optional)
- Insulating tape
- Helping hands stand (optional)
HOW-TO GUIDE - SOFTWARE
We're going to get the software side of things sorted first before we start hacking up the hardware.

Step 1. Ok, first things first. Since this RasPi uses the PiTFT display, you're limited to using Raspbian because (I think) it's the only distro that supports the displays drivers. Go to this page on Adafruit's site [https://learn.adafruit.com/adafruit-pitft-28รข€¦] to download their custom Raspbian image which already contains the drivers. Follow the instructions, write it to your Micro SD and boot up your Pi.

It's worth noting that this custom distro only boots up properly when the PiTFT is attached.

Step 2. When you boot up your Pi, make sure that you have the receiver dongle for the wireless 2.4GHz mini keyboard connected. It should automatically recognize it without any additional tinkering required. If you plan on using a mini wired keyboard that should work fine too.

You'll notice that the standard font used in the command line is a bit derpy, so we're going to change that up since the screen realestate is so important. Type the following and press enter:

sudo dpkg-reconfigure console-setup
This will bring up a menu which allows you to change the font and the size. Have a play around to see what you like. When you're finished reboot the Pi by typing:

sudo reboot
Step 3. That's it! Now you have a usable Linux base system that you can experiment with how you like.

HOW-TO GUIDE - HARDWARE
Step 1. Slice that Pi! Ok, once you've gotten all the hardware working correctly, you'll need to remove all the extraneous components that we don't absolutely need. That means basically removing everything including:

- GPIO pins
- HDMI port
- USB port
- Audio/Mic port
- 2x camera module ports

This isn't really that hard to do, you just need to be really careful and take your time. Not everything will be easy to desolder from the board, and often I resorted to using the mini hacksaw blade + the sharp wire cutters to literally hack it apart. As long as you don't break any of the other components or scratch the board surface, you should be good. You now have a super slim Raspberry Pi that's around 5-6mm thick! [http://i.imgur.com/8pifHrR.jpg]

Step 2. Remove and shorten the GPIO pins on the PiTFT. One thing to note, if you can get the unassembled version of the PiTFT that will save tonnes of time and possible headache. The solder on these boards seem like they need a pretty hot soldering iron to melt, so bare that in mind too. Again, it's not particularly difficult, it just takes a long-ass time.

Step 3. Solder the PiTFT directly to the A+. You can use the GPIO pins you took off either of the other boards if you like. I originally tried doing it with a load of small wires, but that turned out to be pretty tricky. I ended up using the metal pins from a bunch of unused LEDs I had lying around.

This is super fiddly work, and I found the best way was to solder the pins directly to the Pi, then once attached, straighten and trim them until they were uniform. Then hopefully you can slot the PiTFT ontop and solder it in place. I inserted a piece of thin plastic in between the boards so they wouldn't short each other. The reason for doing it this way is that you end up with a ridiculously small all in one package of the Pi+Display which is about 1cm thick. [http://i.imgur.com/di5cvwy.jpg]

Step 4. Power up the Pi and cross your fingers. If it boots up and the screen turns on that's good. If not, I'd first check the connector which joins the display to the PiTFT board and see if it is in all the way. If it is, check your handywork on the GPIO pins.

Step 5. Chop up your USB hub. You need to remove it from it's plastic casing, desolder each of the USB ports, remove any LEDs or anything that doesn't 100% need to be on the board and then strip the main USB wire that the supplies power and data info. These things seem to be ridiculously fragile and badly made (I went through 4 fucking hubs!) so be careful.

Step 6. Prep your case. Depending on what kind of enclosure you want to use, this is probably the time to get it ready. Here are the things I did:

- Cut holes out for the screen/keyboard - Drill holes and attach the hinge - Chop out some holes for the USB ports (the hacksaw blade is very handy here) - Drill a hole in the side for the USB wires that connect the top and bottom case halves. - Cut hole in the side for the switch

I did all my cutting with a sharp craft knife. Measure everything a few times so you know you've got it right and take your time whilst cutting. If you make mistakes, you could always cover over them with vinyl tape or something. [http://i.imgur.com/vNrVjmK.jpg]

Step 7. Wire up the powerboost, battery and switch. I used a standard type of switch that you can buy for RC cars. It was bigger than expected so I had to chop it down. Also the JST connectors can be a bit bulky so I hacked up the female sockets and soldered the wires directly to the powerboost.

I added the micro usb plug to a wire so I could connect the Pi directly to the powerboost. Unfortunately I didn't have enough room or spare parts to wire up the charging port, but I can still charge the battery manually no problem.

If your battery and switch work correctly, when you switch it on, a blue LED will come on for the powerboost.

Step 8. Cram everything into the case, plug in the micro USB to the Pi and switch on the power. If everything goes well, it should boot up. You now have a handheld linux terminal!

CONCLUSION
If I was to make this again, I would do a few things differently. First I'd probably add a slightly larger screen like this one from Tindie [https://www.tindie.com/products/hwlevel/40-ips-screen-for-raspberry-pi/]. I'd also figure out an easier way to add charging ports directly onto the case so that I wouldn't have to open it up to charge the batteries in both halves.

I'm thinking about how I could use this way of creating inexpensive hardware to make a touchscreen open source phone (using the Adafruit Fona), or perhaps a mini tablet or something.

Hope you enjoyed and if you end up making your own version, I'd love to see it.

--
BY NODE