Project GamePi: Raspberry Pi Based Portable Game Console

Hi!

DSC_3044

 

Hope you’re well. In this weeks episode of ‘Weird Electronic Devices You Can Make In Your Own Home’, we’ll be diving into a Raspberry Pi based handheld inside of a Game Boy (DMG). My inspiration to pick this one up was seeing the awesome SuperPiBoy,  as well as the wonderful PiGRRL from Adafruit. I took bits from both of those projects, and added my own small touch.

Parts:

My little bit of spice for this project were the additional 3 controls on the rear panel. Instead of using momentary switches,  I used capacitive touch sensors. I chose the standalone versions that Adafruit sells, because the form factor is favorable to this application, and for simplicity.

I started with a trashed original Game Boy. I found it in a lot buy with a broken Game Gear (I can see another project in my future… :)) for 15$. I handed off the internals to a chip tune obsessed friend, and began the conversion.

I chose not to retain any of the original parts, except for the plastics. I first measured the LCD window, and shaved it to the appropriate size for the 3.5 inch LCD. I shaved down as much of the internal plastics as I could. I then mounted the LCD in place with hot glue. The KB button PCB mounts using the original mounting hardware, no modification required.

DSC_3008

With that done, I soldered a ribbon cable onto the button PCB, and removed the 12v -> 5V regulator from the LCD PCB. I found a datasheet for the regulator on my board, but your results may vary. Apparently, there are many revisions of this device. Here’s a link to a thread which speaks out the conversion in detail (Thanks SuperPiBoy). You can see where I soldered on to the 5V OUTPUT pad on the chip footprint in the photo. Worst case, you can search the board for a chip that has 12V on one pin, and 5V on another, it is likely that’s the chip that needs to be removed.

DSC_3028

The LCD PCB ends up being slightly too large to fit into the case, but can be safely shaved down without having to move any traces. If you needed to keep going with the shaving, the buttons can be moved easily.

DSC_3007

With that done, the Mini USB breakout gets mounted where the old power switch was. It’s the perfect footprint for that spot, and with a tiny bit of shaving, gets supported by the plastic standoff post in that corner.

  • The USB 5v and GND output get tied to the LiPoly Charger 5V and GND.
  • The Charger BAT and GND get tied to the respective V+ and GND on your battery of choice. (Please though, only use LiPoly with the LiPoly charger, obviously.)
  • Pass the V+ from your battery through your SPDT switch, and then along to the PowerBoost V+ input.
  • GND on the battery can go straight to the PowerBoost GND.
  • 5V Output from the PowerBoost goes to the TP2 pin on the Raspberry Pi, and PowerBoost Output GND goes to TP1 pin on the Pi.

Congrats! Your Pi is powered. Your LCD board will also need 5V output from the PowerBoost, as well as the three capacitive sensor boards and audio amplifier.

DSC_3016

DSC_3017

DSC_3023

After a significant amount of shaving of the rear case, I was able to mount all of the aforementioned electronics. The chargers and power input devices are mounted on the recessed area of plastic for the cartridge. The capacitive pads are underneath the label area of the rear plastic. I mounted a female USB port where the old Link port was, and the SPDT switch where the volume knob used to be. I hotglued my snazzy Kitch Bent battery cover in place, and cut it’s locking tab to save space.

DSC_3020

I drilled holes in the center of the cap-pad plastics, so there can be a tactile feeling when searching for the buttons on the rear case. I also used a significant amount of nuts/bolts and standoffs to hold everything in place solidly, so the rear case is littered with bolts in different areas. I used a “Cell” format battery, so that it would sit nicely on the bottom of the case. The battery I chose also has an in-circuit thermal cutoff, so if there’s a problem charging it, it will (hopefully) prevent serious damage/fire. I cut the “fuel gauge” board off of the cell, as I didn’t need it.

DSC_3025

DSC_3026

DSC_3021

For the Raspberry Pi, I removed the Audio Jack, Composite Jack and relocated the USB port. Being a Model A, it did not have the Ethernet jack or second USB port. I soldered wires onto the respective areas to pull the signals I needed. Take care when soldering to the Composite Video pads, as it’s easy to damage the Pi’s composite output with too much heat. For the audio, I routed the Audio Jack output direct to the headphone port, as well as to the amplifier board. Since I did not have a “switched” variety headphone jack around for this project, I came up with the following arrangement. When booting, the Pi runs a program to check the state of the 3 Cap Pads. If they’re all HIGH, it will boot into “Headphone Mode” and drive the Shutdown pin on the amplifier board, freeing the headphone jack. For the speakers, I stuffed a set of Macbook (3Ohm) speakers into the area where the old GB speaker used to be. I tied them to the outputs on the amp board.

I trimmed down the GPIO pins down to half height, and soldered the Common Ground PCB and OUTPUT pins (from the cap-sensors) to their respective BCM GPIOs. I then cleaned up the wiring with a couple of wire ties, and routed the wires as best I could.

DSC_3033

DSC_3036

DSC_3035

And, that’s it!

As far as software goes, running on a Model A means that running RetroPie 2.0+ is out of the question (as ES 2.0 is apparently more graphically intense, and requires a 256/256 GPU split). I loaded RetroPie 1.10 onto a high speed SD card, and shimmed in my custom bits of software to glue everything together. Cave Story runs great! 😀

 Post-Mortem:

When shaving the case down to fit the LCD, I neglected to do something about the standoffs for securing the two halves of the case together. This lead to complications at the very end of the project, because there was no reliable way to join the halves together. I fixed this by hot gluing a bolt down in two corners of the case. I then fed a machine screw up into the case, and into the bolt. My screws ended up being the perfect length to pull the bolt, without going all the way through. It hurts the project’s aesthetics, as it’s clear the halves no longer join seamlessly, but it has an acceptable amount of mechanical strength.

The Capacitive Sensors are HIGH when active, and LOW when dormant. The opposite is true for the Common Ground Button PCB, which (when the internal pullups are activated) are HIGH when dormant and LOW when active. This lead to complications using Retrogame (the Adafruit C utility used to convert the physical button presses into keyboard events), as the ‘always-active’ buttons would pin it. I’m in the process of writing a program that is compatible with mixed button conditions, and will update this post when I push it to my git.

DSC_3042

 

 

 

Project I-Love-Lamp: Adafruit Qualia + Lamp

Hi dere, internet.

It’s me, the human embodiment of a baloney sandwich, at it again.

DSC_2989

Recently, one of my favorite sites in the whole Multiverse, Adafruit, released a new product called the Qualia Board! If you haven’t heard, this little board makes it easy to use your iPad Retina (3/4) screen, as a secondary monitor! That’s 2048×1536 resolution on a ~10 inch panel. Pretty fantastic.

I purchased one of the bareboards and got to work. (There’s also this awesome kit, if hand rolling is not your thing. The kit is pretty rad all on it’s own.) The idea is, to take the iPad screen, mount it in an iPad shell, and mount the iPad shell onto a lamp base! I did something similar in one of my previous projects with a broken Nexus 7. I really am happy with my little N7 Lamp, so I decided to give it another shot with something a little bigger.

Parts:

Adafruit Qualia Board

iPad Retina Screen

Hampton Bay Architect’s Lamp (22 in. Matte Black)

Display Port (Full Size) to MiniDisplayPort (It MUST be DisplayPort, you cannot use a converter.)

12V-9V 1A Supply

I used: iPad 1 Back Panel

(You could probably do better with an iPad 3 Back Panel, but I couldn’t easily find one for cheap enough.)

Machine Screws:

8x 2x8mm

2x 3x12mm

2x #3 Flat Washers

12x #2 Metric Hex Nut

2x #3 Metric Hex Nut

Tools:

Grinder/Dremel Tool

Power Drill with various bits

Needlenose Pliers

Philips Screwdriver (or a flat, whatever head you chose for your machine screws)

Sharpie

Sheet of 8×11 Paper

 

The Plan:

First thing’s first. Take your drill, choose the appropriate size (one size larger than the silver rivets holding the lamp head to the arm), and drill out those pesky rivets. Snip and pull the AC cord out from the body of the lamp arm.

DSC_2970

DSC_2971

 

DSC_2972

 

Next, place your Qualia board onto the 8×11 sheet of paper. Trace it with the Sharpie. The ribbon cable for the screen will exit the LCD to the left middle of the iPad backing, if you have it mounted horizontally, so you have to cut it a whole to run it to your Qualia board. Trace a smaller rectangle inside the one you made when tracing your Qualia board, about 75% of the original size. This will be the template you use to cut the whole in your iPad backing. I completely botched this part of mine, and cut the hole too big, so I added some perfboard to mount the Qualia to.

DSC_2977

DSC_2978

Be sure to add some insulating material between the Qualia and the iPad backing. It’s conductive aluminum, and will potentially short it, otherwise. Test fit your iPad screen into the backing, make sure the ribbon can reach the board easily. It should not be bent in a strange way, or it can be damaged. It’s very easily broken, so be careful when handling the ribbon cable. Mark the 4 holes of the Qualia on the iPad backing (using your 8×11 sheet), and drill them using a #2+ drill bit. Mount the Qualia using 4x of your 2x8mm machine screws and the corresponding bolts.

Place your 8×11 sheet up to the end of the lamp arm, and mark the paper for the two oval holes. Use this as a template to drill the two holes in your iPad backing, where you’d like the arm to mount. I chose dead center (because the arm can go portrait/landscape). Use a #3+ drill bit. Place the 2x 3x12mm screws through the end of the lamp arm, through the iPad backing, put on the 2x #3 flat washers, and then thread on the #3 nuts on both screws. Make sure these are secure.

Now, place your iPad screen atop the 8×11 sheet of paper. Mark the 4 holes for the mounting bracket. Double check once more that the ribbon cable from the screen reaches and plugs in properly. Now, place your paper atop your iPad backing, and drill out the 4 mounting screw holes. Same drill bit that you used for the Qualia mounting points. Put your other 4 2x8mm screws through the backing, thread a single nut on each screw. Now, place your iPad screen onto those 4 bolts. Put another single nut on each screw to secure the screen in place. Connect your screen ribbon cable.

DSC_2979

DSC_2980

Plug in your DP and power cables, and run them down the arm. I secured mine with zip ties. Just make sure you leave the appropriate amount of slack on the cables, so that the arm can flex properly, or you’ll limit your motion.

DSC_2991

DSC_2986

Kapow! Done!

 

Post-Mortem:

I love that this thing articulates. My at-home desk is a very small table, and previously I did not have enough room for a second monitor. I’m addicted to having one thanks to my work-desk, so this totally beats that problem. It’s a neat little gadget. It could be a lot nicer looking if you used a donor broken iPad 3/4 as your shell, but I only spent 15$ on the iPad 1 backing, which is pretty cool for a sweet piece of a aluminum like that. Same goes for finding a 10 inch capacitive touch panel to place over the screen, but… that’s not that easy.

 

Adventures in armel – Debian Wheezy – udevd[XXX]: unable to receive ctrl connection: Function not implemented

Hi!

I’m running a tiny specially designed ARM system with a heavily patched 2.6.3x kernel on an armel install of Debian Squeeze. It was my goal to bring this system into the realm of security updates, and Debian Wheezy. Simple dist-upgrade right? Wrong. After the udev package was updated to the Wheezy version and I rebooted, udev immediately started spitting out this log message:

udevd[PID]: unable to receive ctrl connection: Function not implemented

Login either never started, or was just getting completely stomped by udev, because I couldn’t do so much as login to the console. I rebooted my machine in Single User mode, which succeeded. (If you’re having trouble getting into Single User mode on your Debian box, you can change your init kernel parameter to: init=/bin/bash You’ll get access to basic functions, such as file movement and such, which might save you in the event of a complete meltdown.)

I double checked the minimum kernel requirements for udev in Wheezy (2.6.18+), and double-checked that I wasn’t missing any critical udev components in the kernel. Both checked out, which didn’t leave me much to go on. (If you’re able to kill udev and login, you could strace the calls to udev during startup to see which ones are causing the failure.) After checking around online, I found a couple of threads where people had the same problem. One of them talked about lack of the accept4 syscall mapping in the kernel on ia64 devices. In that thread, there was a reference to a similar bug for armel. Hmmm.

Here‘s the ia64 thread. Here‘s the armel bug filing.

Sounds like exactly what I’m experiencing. Digging a little further, I was able to find the patch referenced there, as well as a C program that tests whether your kernel is able to use the accept4 syscall. Unfortunately, if you’ve gotten to this point, your system is quite broken, so the accept4 test might not work for you.

Here is the patch to fix 2.6.3x armel kernels to use the accept4 syscall:

From e3b4f8cdd8d2a83e8ffaed2a8f682959150365d1 Mon Sep 17 00:00:00 2001
From: Ingo Albrecht <prom@berlin.ccc.de>
Date: Sun, 18 Sep 2011 02:53:04 +0200
Subject: [PATCH 01/15] backport: wire up sys_accept4() on ARM

 * This is required to run current debian unstable (because of udev)
 * Original commit from kernel git: 21d93e2e29722d7832f61cc56d73fb953ee6578e
---
 arch/arm/include/asm/unistd.h |    1 +
 arch/arm/kernel/calls.S       |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/arm/include/asm/unistd.h b/arch/arm/include/asm/unistd.h
index cf9cdaa..8f32b6b 100644
--- a/arch/arm/include/asm/unistd.h
+++ b/arch/arm/include/asm/unistd.h
@@ -392,6 +392,7 @@
 #define __NR_rt_tgsigqueueinfo    	(__NR_SYSCALL_BASE+363)
 #define __NR_perf_event_open		(__NR_SYSCALL_BASE+364)
 #define __NR_recvmmsg			(__NR_SYSCALL_BASE+365)
+#define __NR_accept4			(__NR_SYSCALL_BASE+366)
 
 /*
  * The following SWIs are ARM private.
diff --git a/arch/arm/kernel/calls.S b/arch/arm/kernel/calls.S
index 9314a2d..1dff6a0 100644
--- a/arch/arm/kernel/calls.S
+++ b/arch/arm/kernel/calls.S
@@ -375,6 +375,7 @@
 		CALL(sys_rt_tgsigqueueinfo)
 		CALL(sys_perf_event_open)
 /* 365 */	CALL(sys_recvmmsg)
+		CALL(sys_accept4)
 #ifndef syscalls_counted
 .equ syscalls_padding, ((NR_syscalls + 3) & ~3) - NR_syscalls
 #define syscalls_counted
-- 
1.7.6.3

Here is the test_accept4.c program:

/* test_accept4.c

  Copyright (C) 2008, Linux Foundation, written by Michael Kerrisk
       <mtk.manpages@gmail.com>

  Licensed under the GNU GPLv2 or later.
*/
#define _GNU_SOURCE
#include <unistd.h>
#include <sys/syscall.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <stdlib.h>
#include <fcntl.h>
#include <stdio.h>
#include <string.h>

#define PORT_NUM 33333

#define die(msg) do { perror(msg); exit(EXIT_FAILURE); } while (0)

/**********************************************************************/

static int
do_test(int lfd, struct sockaddr_in *conn_addr,
       int closeonexec_flag, int nonblock_flag)
{
   int connfd, acceptfd;
   int fdf, flf, fdf_pass, flf_pass;
   struct sockaddr_in claddr;
   socklen_t addrlen;

   printf("=======================================\n");

   connfd = socket(AF_INET, SOCK_STREAM, 0);
   if (connfd == -1)
       die("socket");
   if (connect(connfd, (struct sockaddr *) conn_addr,
               sizeof(struct sockaddr_in)) == -1)
       die("connect");

   addrlen = sizeof(struct sockaddr_in);
   acceptfd = accept4(lfd, (struct sockaddr *) &claddr, &addrlen,
                      closeonexec_flag | nonblock_flag);
   if (acceptfd == -1) {
       perror("accept4()");
       close(connfd);
       return 0;
   }

   fdf = fcntl(acceptfd, F_GETFD);
   if (fdf == -1)
       die("fcntl:F_GETFD");
   fdf_pass = ((fdf & FD_CLOEXEC) != 0) ==
              ((closeonexec_flag & SOCK_CLOEXEC) != 0);
   printf("Close-on-exec flag is %sset (%s); ",
           (fdf & FD_CLOEXEC) ? "" : "not ",
           fdf_pass ? "OK" : "failed");

   flf = fcntl(acceptfd, F_GETFL);
   if (flf == -1)
       die("fcntl:F_GETFD");
   flf_pass = ((flf & O_NONBLOCK) != 0) ==
              ((nonblock_flag & SOCK_NONBLOCK) !=0);
   printf("nonblock flag is %sset (%s)\n",
           (flf & O_NONBLOCK) ? "" : "not ",
           flf_pass ? "OK" : "failed");

   close(acceptfd);
   close(connfd);

   printf("Test result: %s\n", (fdf_pass && flf_pass) ? "PASS" : "FAIL");
   return fdf_pass && flf_pass;
}

static int
create_listening_socket(int port_num)
{
   struct sockaddr_in svaddr;
   int lfd;
   int optval;

   memset(&svaddr, 0, sizeof(struct sockaddr_in));
   svaddr.sin_family = AF_INET;
   svaddr.sin_addr.s_addr = htonl(INADDR_ANY);
   svaddr.sin_port = htons(port_num);

   lfd = socket(AF_INET, SOCK_STREAM, 0);
   if (lfd == -1)
       die("socket");

   optval = 1;
   if (setsockopt(lfd, SOL_SOCKET, SO_REUSEADDR, &optval,
                  sizeof(optval)) == -1)
       die("setsockopt");

   if (bind(lfd, (struct sockaddr *) &svaddr,
            sizeof(struct sockaddr_in)) == -1)
       die("bind");

   if (listen(lfd, 5) == -1)
       die("listen");

   return lfd;
}

int
main(int argc, char *argv[])
{
   struct sockaddr_in conn_addr;
   int lfd;
   int port_num;
   int passed;

   passed = 1;

   port_num = (argc > 1) ? atoi(argv[1]) : PORT_NUM;

   memset(&conn_addr, 0, sizeof(struct sockaddr_in));
   conn_addr.sin_family = AF_INET;
   conn_addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
   conn_addr.sin_port = htons(port_num);

   lfd = create_listening_socket(port_num);

   if (!do_test(lfd, &conn_addr, 0, 0))
       passed = 0;
   if (!do_test(lfd, &conn_addr, SOCK_CLOEXEC, 0))
       passed = 0;
   if (!do_test(lfd, &conn_addr, 0, SOCK_NONBLOCK))
       passed = 0;
   if (!do_test(lfd, &conn_addr, SOCK_CLOEXEC, SOCK_NONBLOCK))
       passed = 0;

   close(lfd);

   exit(passed ? EXIT_SUCCESS : EXIT_FAILURE);
}

Just to be clear, these aren’t my patches, I simply found them, and I’m mirroring them for historical purposes. All credit goes to the original authors referenced in both snippets. And, that’s that! Apply the patch, rebuild your kernel, and reboot into your Wheezy installation. Udev should now work like a charm.

If you’d like to do this the opposite way, you could patch the udev source with the following patch found here: (But, I have not personally tested this — This will also make future updates a pain.)

diff -Nru udev-177.orig/src/udev-ctrl.c udev-177/src/udev-ctrl.c
--- udev-177.orig/src/udev-ctrl.c    2012-01-10 01:43:22.125518772 +0100
+++ udev-177/src/udev-ctrl.c	2012-01-22 16:46:31.339378651 +0100
@@ -15,6 +15,7 @@
 #include <stddef.h>
 #include <string.h>
 #include <unistd.h>
+#include <fcntl.h>
 #include <sys/types.h>
 #include <sys/poll.h>
 #include <sys/socket.h>
@@ -182,6 +183,7 @@
         struct ucred ucred;
         socklen_t slen;
         const int on = 1;
+        int flgs;
 
         conn = calloc(1, sizeof(struct udev_ctrl_connection));
         if (conn == NULL)
@@ -189,13 +191,18 @@
         conn->refcount = 1;
         conn->uctrl = uctrl;
 
-        conn->sock = accept4(uctrl->sock, NULL, NULL, SOCK_CLOEXEC|SOCK_NONBLOCK);
+        conn->sock = accept(uctrl->sock, NULL, NULL);
         if (conn->sock < 0) {
                 if (errno != EINTR)
                         err(uctrl->udev, "unable to receive ctrl connection: %m\n");
                 goto err;
         }
 
+        /* Since we don't have accept4 */
+        flgs = fcntl(conn->sock, F_GETFL, NULL);
+        if (flgs >= 0) fcntl(conn->sock, F_SETFL, flgs | O_NONBLOCK);
+        fcntl(conn->sock, F_SETFD, FD_CLOEXEC);
+
         /* check peer credential of connection */
         slen = sizeof(ucred);
         if (getsockopt(conn->sock, SOL_SOCKET, SO_PEERCRED, &ucred, &slen) < 0) {

Project Airbag: MacBook Air Rev. A USB SSD + Sound Fix

Howdy!

I’m back again with another project! This one is another relatively short one, but it’s full of hilarity, so hold on to your hats.

DSC_2215System Backstory: I managed to get a hold of a Rev. A MacBook Air (Original) in poor (but salvageable) condition a few months ago. It had a damaged hinge, damaged display cable, no hard drive or hard drive ribbon, non-functional on-board sound, no battery and a damaged I/O ribbon. These computers are interesting because their motherboards are quite tiny! Here’s a photo of one. You could put that in just about anything. Plus, it wouldn’t take a large heatsink to convert the cooling system to completely passive! Neat.

Anyway, due to the damage, the computer was extremely cheap. But, it needed some things. A lot of things, actually. Another thing to note, these machines (Rev. A) will only run up to OS X 10.7.5. Additionally, the hard drive is a PATA microdrive. Drives not really known for performance, or long term reliability. Rather than opt to use another PATA microdrive, I sought an upgrade. ZIF-PATA SSDs are expensive for their size. Or, were manufactured by brands with poor quality/poor warranty support. Well, as it turns out, you can get something that performs close to, if not better than those ZIF-PATA devices, with a bit of work.

Parts:

MacBook Air Rev. A Battery

SanDisk Micro-SATA 64GB SSD

1.8 Micro-SATA to ZIF Adapter

MacBook Air Rev. A Hard Drive Ribbon

MacBook Air Rev. A Display Cable, Hinge and Plastics Set

1.8 ZIF to USB Adapter

USB Sound Card Belkin Ultra-Mini USB Hub

Let’s start with some failure: I thought it would be as simple as popping in a new HD ribbon, connecting the uSATA to ZIF converter, and dropping in my SanDisk SSD… But, for whatever reason the MBA would not detect the uSATA to ZIF converter. But, when I hooked it up to my ZIF to USB converter, it would detect just fine. I found a lot of useful info here, but unfortunately, my tinkering did not pay off.

I tried removing the 5V regulator and components (as the drive in the MBA.A is 3V3, as is my new SSD), and soldering a jumper to force mode select on the adapter. The good news is that the SSD is very short, and fits well (even with the adapter) in the area where the hard drive previously was. I was also able to find some interesting information about the latent USB ports on the MacBook Air motherboard. Which (while unfortunately, only full-speed) could be used for utility devices. Here’s a link to the info on those. My big plan originally, was to solder in the USB sound card onto one of these locations, and wire it into the original headphone jack. But, with the hard drive not working… I had to come up with a new strategy.

I decided the best course of action (Bahahahahahahaha… Best… Right…) would be to cut the USB port out of the I/O panel, wire in a USB hub, and the wire the USB port back into the hub, allowing me to hook up USB high-speed devices internally. Then, wire in the USB sound card, and the SSD via a ZIF-to-USB converter board.

And, that’s what I did. It’s not pretty, and the fitment isn’t wonderful… (There’s not a lot of room in there, not that you needed me to tell you that.), but it works. The benchmarks are respectable given the circumstances. It falls somewhere between UDMA2 and UDMA3. Hardly a speed demon, but it’s very usable. Operates like a normal setup would. The only caveat is that effective disk bandwidth will fluctuate according to activity on USB.

Here’s an Xbench benchmark:

Screen Shot 2014-01-16 at 1.39.31 PM

The Process: I used my Dremel to remove the USB port from the I/O plate, mounted a replacement port in it’s area (which required a bit of Dremel action as well, since that connector is half-length). After splitting the casing off of the USB hub, I removed the 4 USB female connectors, and soldered the hub input onto the MBA root port pads. I used a ribbon cable to connect the new USB port to the USB hub. Then, I removed the micro-SATA connectors from both the ZIF-to-Micro-SATA adapter, and the SSD, and soldered them together. (The connectors add a lot of height to the stack.) I also removed the status LED and USB mini connector from the ZIF to USB adapter, as they also added a lot of height.

IMG_3111

I removed the casing from the USB sound card, removed the 3.5mm connectors, and USB male connector. I soldered two ribbons to it, one on the pads for sound output (which were soldered onto their corresponding pads on the MBA 3.5mm jack) , and the other linking the card to the USB hub. I had to cut the 3.5mm jack off of the I/O panel (without damaging it) to disconnect it from the logic board, since it was causing interference, despite not functioning.

DSC_2233

Once that was done, I soldered a ribbon from the ZIF to USB adapter onto the hub, and sealed it all up with electrical tape. In the end, the case bulges on that side a bit (but, does not offset the computer…), and I had to remove the aesthetic strut that goes across the bottom panel for some extra room. I sealed all of my solder joints with hotglue once everything was tested and working, and then did my best arrange the components for best fit.

DSC_2231

DSC_2232

DSC_2225

While there isn’t much (re: any) space left, the hard drive ribbon is now unoccupied. I’ve toyed with the idea of trying one of these 8GB Intel PATA SSDs on there, for the OS, and then use the 64GB for extended storage… But, it works great as is. There are some subtle things to watch out for when using USB for your main boot device. Plugging something in could A. Consume too much power, crash your SSD/System, B. Short out the USB hub, crash your SSD/System, C. That port may not charge high current devices, if your SSD is on the same line (because of it’s current draw).

DSC_2239

Was it worth it? Well… The value of all the components tallies up like so:

SanDisk Micro-SATA 64GB SSD – 70$

1.8 Micro-SATA to ZIF Adapter – $5

MacBook Air Rev. A Hard Drive Ribbon – $15

1.8 ZIF to USB Adapter – $5

Belkin Ultra-Mini USB Hub – $10

(Note, the auctions I linked are not directly ones I purchased from originally.) Comes to $105. I’m not including the cost of other parts for repairing the other defects in the storage device comparison. Comparatively, OWC has a 60GB drive upgrade (without the need for an HD ribbon) for $130.

That +$25 gets you a 3 year warranty, +40MB/s performance and you can spend the hours of your life you save, watching TV instead. In the end, it’s a wash, but I had fun doing it. The MBA presented me with an interesting challenge.

DSC_2235

If you’re one of the Rev. A models with busted sound, give this a try:

Strip one of the $2 USB sound cards down to it’s PCB. Remove the USB connector, and the 3.5mm connectors. Solder a ribbon cable from the USB pads on the sound card, grab 5V and GND from the root port on the I/O panel, and tie D+ and D- to one of the free USB ports illustrated in the linked article above. Solder a ribbon from the 3.5mm output jack pads (on L/R/G) to the 3.5mm jack pads on your I/O panel (check out my photos to see which pads). Snip the headphone port from your I/O panel PCB, and BOOM! Your sound works again (albeit only through headphones).

Project CarFire: RasPi-based In-Car Music Streaming Box

Hi. This is a short little project I whipped up on my lunch break today.

IMG_2474

I recently saw this hack floating around the Intertubes. The basic run-down is that an Airport Express (A1392) has it’s power supply replaced with a 12V->5V->3.3V step down sequence, so it can run off of a car’s DC power. It is then setup to pipe audio to the car’s audio system. It’s a really neat hack, I wish I had thought of this when I drove down to Florida from New England.

I decided to spin my own version of this from components I had lying around. I wasn’t keen on spending 100$ on a new Airport Express when I could whip my own up for free! I used a WAP54G, as I have many of them lying around, and it runs on 5V direct. This is nice because the RasPi also uses straight 5V, which means I’d only have to step the voltage down once.

Disclaimer:

I am not responsible for your actions if you choose to follow this tutorial. Miswiring could cause serious property damage, risks to your vehicle, and life. Seriously, be very careful. Your cigarette outlet is protected by a fast-blow fuse (on most vehicles), but that does not give you a license to do anything stupid. You’ve been warned.

Parts:

Raspberry Pi with 4GB SD Card (Rasbian Preloaded)3.5mm Male to Male Cable
Micro-USB Cable
USB Extension Cable
Voltage Regulator (I used the LM317, but any ~14V->5V will work.)
Linksys/Cisco WAP54G V2
Garmin GPS Power Cable/Cigarette Power Adapter Without Regulator

Prerequisites:

Install DD-WRT on your WAP54G/WRT54G

Install Rasbian On Your RasPi

Install/Compile Shairport

Make sure you set Shairport to start when your Raspberry Pi boots, and test that it comes up properly. Configure your DD-WRT with a DHCP server, and disable the Internet Connection. Being that the WAP only has 1 Ethernet port, you cannot easily do other routing. However, with the WRT this is not the case. I’m not sure if you can run a DHCP server on the default Linksys firmware on the WAP, but I don’t believe you can. DD-WRT is much more powerful, I recommend it.

We start by chopping the end off of the Garmin power cable. My power cable came from a Street Pilot C550, which has a barrel jack connector. I am not covering the other type found on later Garmin models. The barrel is center positive.

Cut the Garmin adapter wire 3/4 the way to the barrel jack connector. Strip the wires on the side with the cigarette adapter. Red goes to IN+ on your LM317 board/circuit. White goes to IN-. Solder these in place, if you haven’t already. If you have an adjustable regulator, move your trimpot until your output is 5V.

Strip and solder the Red and White wires on the barrel connector side of the cable to OUT+ and OUT-. The barrel will fit into the power supply on the WAP54G! So, no other adapting necessary. If you have a WRT54G, your router uses 12V input, and this will not work at all. You will have to power your router straight from the 12V coming off the cigarette socket.

The Garmin cable has a built-in quick-blow fuse, that’s hidden under the tip of the cigarette socket adapter. If the red indicator LED on the socket adapter is mysteriously not working, check this fuse by unscrewing the cap.

Now, snip the male end of your USB extension cable off. Strip the female end’s insulation, peel back the shield, and snip the green and white wires. Solder the Black wire to the OUT- on your VREG circuit, and the Red wire to OUT+. Plug your Micro-USB cable into the Female end and test to see that your RasPi starts up. If it doesn’t, or if you see your USB device enumeration going crazy, try a different Micro-USB cable. If the problem persists, your VREG may not be supplying enough current. The WAP and the Pi together should pull close to 1 amp under full load, and a bit less when quiet.

Connect an Ethernet cable between the RasPi and the WAP, and make sure that it assigns the RasPi an IP address when the interface is brought up. Now, attach the RasPi and the VREG to the casing of the WAP somehow (I chose to mount everything on an aluminum plate… Not very efficient or elegant, but I think it looks awesomely crazy.) Tape up all of your connections to prevent shorts, and verify that it works! Name your wireless network something snazzy. I named mine ‘CarFire’. I also added a giant heatsink, since the processor on the WAP was getting pretty hot. Necessary? Absolutely not. Hilarious? Yes, very.

IMG_2484

IMG_2482

IMG_2481

IMG_2485

Project BlackBook: Return Of The Backlight

This project has been hiding on the back-burner for a while, but I finally had some time recently to complete it.

 cat /dev/urandom | hexdump, because The Matrix.
cat /dev/urandom | hexdump, because The Matrix.

A couple months ago, I found myself with a dilemma. As a favor to a friend, I traded them a perfectly working 2009 MacBook Unibody 13 Logic Board, for one with a broken headphone jack (jack snapped off inside, physical damage to the connector) and problems with the keyboard controller. It also had a busted fan.

Replacing the broken components isn’t fun for me, as it stretches the limits of my soldering ability. Surface mount, fine pitch for the keyboard controller, and deep through hole for the headphone jack, make for irritating replacement. Earlier model MBPs had the keyboard controller and trackpad controller built onto a single board (the trackpad itself), and then connected to the logic board via a dedicated USB connector. There were additional pins for the power button, but that was pretty much it. Newer models (Multi-Touch Trackpad 2008+ Models) have the trackpad completely separate, with the keyboard controller positioned on the logic board itself. The keyboard backlight is driven by a WLED driver similar to the LCD backlight in those models, with maximum brightness measured at 18V. The LEDs are wired in series. This design remained constant between the Pre-Unibody and Unibody designs, with the only difference being the Unibody designs contain more LEDs in the chain. Both systems have a separate connector for the KB backlight. Here is a link that describes using the Pre-Unibody trackpad and keyboard as a USB device, which I used to find the pads on my 17″ top case.

I decided the best solution to the logic board problems was to build a Pre-Unibody keyboard (with the controller board) into the body of the Unibody system, and place a USB sound card inside some free space. Measuring out everything was quite fruitful, as I found that both have a recessed area for the keyboard, with the Pre-Unibody keyboard pan being only slightly thicker. The Unibody system is designed with some pretty tight tolerances, so there isn’t too much room for mistake. With that, I began the conversion.

For the rest of the article, I’ll write up U as Unibody, and PU as Pre-Unibody. I’m sure you’re just as sick of reading it, as I am of writing it. (Also, all of these pictures are out of chronological order. Sorry.)

First, I measured out the area of the PU top case to cut out. I left myself a seam of the original palm-level part to work with. I was using a 17″ PU MBP top case as my donor, so I had a lot of spare material in case of a mistake.

DSC_4288
DSC_4285
DSC_4289

Once I cut the pan free, I placed it against the U top case, and measured out where to cut the hole. As I mentioned earlier, the U case has a recessed area in the body for the keyboard, so this was my target area for the new one. The tapered edge of the recess was used as my general guide for the cut.

After this was one, I pulled the keyboard wireframe out of the U top case, and placed in the PU keyboard pan. Using duct tape, I joined the two together by placing strips across the body longways. I then poured clear epoxy into the seam. The duct tape kept the epoxy from running, and gave me a nice smooth seam on the front, with minimal running.

DSC_4295
DSC_4291

Some curing time later, I sanded the epoxy down to a nice (pretty) smooth finish. I used a test motherboard to see how the fitment was. I found that I needed to grind some of the epoxy down to get the board to fit. After some fancy-footwork with the Dremel, the board fit like a charm.

DSC_4322

The thickest area of contiguous free space inside the system is believe it or not, the hard drive bay. At first glance, it seemed to me as though the best area for the extra electronics was going to be the area where the optical drive previously resided. But, it isn’t. There’s much more vertical space where the hard drive is mounted, for a variety of reasons… So, that was where I cut the hole for the relocated USB port and new headphone jack.

DSC_4533
DSC_4563
DSC_4577

I purchased an 8 dollar optical drive slot hard drive mounting bracket, and hacked it to pieces. The HD fit snugly inside the optical drive area, and after some shaving, there was even a little room left over.

DSC_4578

Rather than spend any more money on this system, I reused a 2007 MacBook fan as the main fan. Since the fan mount is reversed on these models, I had to mount it upside down. This was a problem for airflow, so I drilled holes in the bottom cover. They were haphazardly drilled, and I’m ashamed at how ridiculous it looks, but, it does the job. I also made the rubber feet much taller in the back using Sugru, which did wonders for my temperatures.

IMG_2141

Time for paint! I wish I had the facility to anodize the aluminum of the body, because I’d be all over that. But, I don’t, so paint it is. It’s a shame Apple has yet to release a “Black Edition” of any of the Unibody line, because they’d be pretty.
I thoroughly sanded the main layer, but did not remove all of the aluminum coating on the U top case. The lid I left stock.

DSC_4560

I painted both the U top case, and the bottom cover, with two coats of Krylon All-Surface Matte Black spray paint. The coat is reasonably durable, and the Krylon has been resistant the torture of my backpack so far. I would get automotive clearcoat if you really want your paint to last.

DSC_4559

Using hotglue, I replaced the right speaker, and mounted the subwoofer to the center support rail. The left speaker needed to be shaved down significantly in order to fit in it’s original position between the logic board and the keyboard pan. I sealed the holes with hot glue (the body of the speaker is hollow for improvement in bass response).

I stripped apart a powered 4 port USB hub that I had (A nicely designed one with a regulator circuit) and cut off the connectors. I soldered a ribbon cable to one of the root ports on the logic board to feed the hub, and then the sub devices were wired onto the hub. I added a USB sound card, a 16GB USB flash drive (case removed), the Trackpad/Keyboard Controller for the PU keyboard, and then wired the last to a female USB port I mounted to the U top case. I mounted the female port using epoxy. You can see in one of the photos, I didn’t properly clamp the port the first time, and it was slanted. I removed it, and had to repoxy it.

DSC_4580

I wanted the original KB backlight to work, but I also wanted to try backlighting the trackpad and the ports. I took the LED panel from underneath the original Unibody keyboard, and cut the diffuser down to just slightly larger than the trackpad. I soldered wires onto the ribbon, wired those in series with the PU’s KB backlight LEDs, soldered them to another ribbon, which was then connected to the logic board. (Whew. That was a mouthful.) For the ports, I wired 3.0V fat SMD LEDs in parallel (with an in-line resistor) to the 5V feed of the PU KB controller. The LEDs are secured with hot glue. I used the hub for the 5V source, so that if there is any short of sorts – the hub will protect the root port from being damaged. The root port on the logic board has two beads of hot glue inside the port, so that I cannot plug anything into it.

Testing LED Lit Port Theory
IMG_2137

DSC_4579

The PU keyboard controller had a limited area where it could be mounted, as the ribbon cable for the PU KB is short. I chose to place it underneath the battery, which is a very tight fit with the trackpad backlight. However, both the PU keyboard controller and backlight panel are very thin, so while it’s tight, there is no adverse pressure on the battery. There is no room on top of the battery for the PU keyboard controller.

DSC_4320
DSC_4572
DSC_4577

 

Since I cut out the supporting circuit for the power button, there was no way to turn the system on. On every MacBook, there’s a set of pads that can be used to boot the system without the keyboard. For the 2009 Macbook Pro Unibody 13 Inch logic board, these two pads are located next to the trackpad connector. Here is a high res photo. The pads are highlighted in blue. I mounted a large push button on a piece of perforated board underneath the power button, and wired this to those pads. The button is now recessed a bit, due to the difference in height, but I think this ended up being a benefit.

DSC_4335
DSC_4593

That’s about it. The port LEDs are always on, which does drain a bit more battery than without, but they’re tiny LEDs, so the difference is minimal. Since the TP and KB backlights are wired in series, the fading effects and brightness control still work as they did originally. I wish that the trackpad backlighting effect was more pronounced, but it’s subtly nice. The keyboard is nice to type on. I like the PU style better than the chiclet-style on the U-models for typing, but definitely not for cleaning. The 16GB flash drive is loaded with my Lion ESD Drive, and a seperate partition for my special system images/testing Linux distros, etc. The USB sound card is a $10 job I picked up at a local electronics store. Here‘s a tip for switching your sound output device from the menu bar in OS X, which makes using the USB sound device less cumbersome. I painted over the IR eye, status LED, and battery status LEDs on the case, so… I don’t have those. If you’re more diligent than I, you can pop the little plastic diffusers out before painting. I completely removed the HD ribbon to the logic, to save space in that area. I used way too much tape, and the ribbon cable I chose for the USB was too thick. I think the contrast of the black vs. the silver looks awesome. Overall, I’m very happy with how it looks. It’s an one-of-a-kind eye catcher.

Eventually, I plan on adding a hardware serial port using a USB->TTL converter and a 3.5mm jack. Adding effects to the port LEDs using a microcontroller, and adding more LEDs for the mouth of the optical slot.

There are more photos of the process in the gallery. Now, for the finished shots.

 cat /dev/urandom | hexdump, because The Matrix.
cat /dev/urandom | hexdump, because The Matrix.

DSC_2171  DSC_2191 DSC_2193 DSC_2194 DSC_2197 DSC_2200 DSC_2204 DSC_2207

(TL; DR: I built the keyboard from a Pre-Unibody MacBook Pro into a Unibody MacBook Pro 13. I also added a USB hub, a USB sound card, USB flash drive and relocated an active USB port to the area adjacent to the hard drive bay. The ports and trackpad have also been backlit, and the original keyboard backlight works as well.)

How To Ruin A Perfectly Good Lamp With A Nexus 7

Hi Friends!

DSC_4424

I hope you’ve all had the opportunity to enjoy your favorite food recently. (I tried to come up with an alternative friendly greeting. I think I nailed it.) This post could alternatively be called “What To Do With Your Nexus 7, When You Crack The Screen”, but, I’m weird.

ANYWAY! (As most of these posts start off) I was browsing eBay a couple months ago for a secondhand Nexus 7, and I learned some things.

  • Once you crack the screen on a Nexus 7, the digitizer will completely stop functioning. (In most cases, but perhaps not all… N7 users can chime in here?)
  • Replacement digitizers are really expensive. ($60+, and I saw as much as $160+ for some.)
  • Due to these facts, people were selling their tablets at what could only be described as “mega-balls cheap”.

Most of my queries turned up an average unit price for an 8GB cracked screen N7 of $50. I managed to snag one at $45 shipped, which is a fantastic price for the specs this tablet carries. Just now, the lowest price I could find was $60. There’s some amount of luck involved. Just to quickly recap the N7s specs:

  • Quad-Core Tegra 3
  • 1GB of RAM
  • ~8GB of Storage
  • Wifi + Bluetooth
  • USB Host/USB OTG
  • Built-In Battery, Charger
  • Audio Out
  • Unlockable Bootloader

So, basically… features that you’d pay a sizable amount more for an equivalent ARM SBC. And, the icing on the cake is that this will run: Ubuntu 13.04, Android 4.2.2, and Ubuntu Touch. I’m sure there’s more that I’m leaving out, but for all my intents and purposes these will do just fine. Out of the box Android 4.2.2 will allow you to use a keyboard and mouse with your N7, provided you have a USB-OTG cable.

I’m sure if you’re trying this out, you’ve realized the problem. In order to efficiently use your N7 with an external keyboard and mouse, you need to prop it up on something. If you’re using it in your lap, it’s falling over a lot, and you’re probably wanting to crack the screen more out of spite. DON’T DO IT, FRIENDO.

Instead, this cute $20 lamp can help you create a new friendly desk (immobile) robot. You’ll be the TALK OF THE TOWN, let me tell you.

Hardware Disclaimer:
If you ruin your Mom’s favorite lamp with this hack, you’ll be in big trouble. Don’t do anything silly. If you drill holes in your $1,000,000 Persian Rug, I cannot help you. I take no responsibility for your actions if you’re following this tutorial, and CERTAINLY NOT IF YOU’RE NOT FOLLOWING IT, since I spent all this time writing these instructions, for you to just IGNORE ME, GAH!

Parts:
Hampton Bay Architech Lamp (Matte Black) – $20
Nexus 7 – Cracked Screen – ~$40 – $60
Dremel with Metal Cutting Discs
Wire Cutters
USB A->B 6FT
USB OTG Cable
Soldering Iron
USB Hub
Philips Screwdriver
Needlenose Pliers
Flat-Head Bolts+Nuts+Crush washers
5V Supply (or hopefully, the Nexus 7 Charger)
Drill+Bits

Steps:

1. Unbox poor defenseless Lamp. Attach to base. Promptly break out your Dremel and metal cutting discs, saw off the two rivets that connect the lamphead to the springy-body. Be careful to leave the silver bracket intact, as you’ll be using that for the N7. Once the head is loose, you have to take pieces of the body apart to remove the AC cable. You might be able to get away with chopping it up, and tugging on the cable until it comes free… But, to save yourself some busted knuckles, I suggest you do it the slow way.
DSC_4418

DSC_4419

2. Your lamp will now refuse to do anything but spring completely upright, as there’s no weight to counterbalance the springs. Measure out where you’d like to mount your N7. I measured to what is roughly the center of my tablet, and made marks on the backplate that correspond to the holes on the silver bracket of the lamp body. Remove your backplate, (You should be able to stick something along the seam and pry it off, it snaps right off, no screws.) and drill the holes. The holes should be the about size of the flat-head bolts you selected. The washers will make up the play, so don’t sweat it if they’re a little loose. Also, don’t drill through the NFC coil, or any of the antennas. That’s important.

DSC_4420
DSC_4421

 

3. Thread the washers onto the bolts, and the bolts through the silver lamp-body bracket. Put the bolts through the holes you drilled in your backplate, and secure the backplate with the nuts. Tighten them fully. Use your Dremel to grind off excess bolt, as that’ll press against your N7’s battery/motherboard if left there. Clean dust thoroughly, then apply a dab of hot glue on one of the nut faces, against the backplate. Cover the nuts with electrical tape, (Hahahahahahahaha… Sorry, sorry.) so they don’t short anything out.

DSC_4422

4. It should look something like the above. ^ Now, snap in your Nexus 7! Congratulations, you’ve made yourself a cute little Pixar-lamp-buddy.

DSC_4424

DSC_4436

Software Disclaimer: Look, I hate writing these, but if you brick your device, you’re on your own. These instructions are in no way all-encompassing, or perfect. There is a lot of assumed knowledge. If you need some advice, email me. I’m always happy to help.

Now, you’re at a crossroad. There’s a lot of software routes to take, and I’ll in no way cover them all. I’m sure you’ll also wondering why I listed all of that USB cable stuff in the Parts section. Let’s start with Android, since that’ll be the default. If you fancy it, you can follow the steps here to flash CyanogenMod, unlock your bootloader and root your tablet. I will not cover CyanogenMod steps, which differ (slightly different kernels), but the general concepts will apply.

The conundrum about this setup is that it’s currently impossible to use a keyboard/mouse and charge your tablet at the same time. The N7 will boost it’s battery power to the USB OTG port while it’s in host mode, which means it cannot be accepting current for the charger. This awesome person named Timur created a kernel for the stock Android 4.2.2 setup that will allow you to charge and host devices at the same time. You can find it here. You want the one for “Fixed Installation”.

You’ll need to unlock your device’s bootloader before you can flash the USB+Charging Kernel. For this, you’ll need fastboot. Here are the instructions for unlocking your device’s bootloader, courtesy of Ubuntu. For Mac and Linux, here is a page that hosts the fastboot binary – you can find it in the zip for your respective OS. You don’t have to run that silly shell script if you don’t want to “install” the binary, you can just invoke it directly.  If using Linux, you may also find it in your respective package repository, which is a better option.

Unpack Timur’s USB+Charging Kernel for Android 4.2.2 ZIP (Make sure you are running 4.2.2….), and grab the boot.img file. Boot your tablet into fastboot mode (following instructions on Ubuntu’s Wiki.), and connect the microusb cable to your Linux/OS X machine.
Now, issue the following command (this assumes that fastboot is in the PATH and the boot.img is in the current directory):

fastboot erase boot && fastboot flash boot ./boot.img

Once fastboot reports success, you can reboot your tablet. It should boot up just fine, and look exactly as before, but now, if you go into your About Tablet menu, your kernel version will be “3.1.10-gdb06546-dirty Timur-USBhost-FI-2013-01-29@hexa #27”. Success!

If your tablet goes into a boot loop, or doesn’t boot at all… Don’t panic. (42) Google has the stock Android images and instructions on how to flash them, here. “Fastboot mode” can always save you if you nuke your device, but… just be careful. And, don’t EVER pull power on your device while a flash is in progress. I should also warn you, flashing kernels/ROMs from the Internet carries some risk, as you can never be fully sure what changes were made. (Unless you diff the source yourself… Good luck with that.) But, I’ve tested Timur’s kernel, and it works as expected.

Timur’s explanation page shows you how to wire your N7 so that you can use the hub and charge it at the same time (with the modified kernel.) It also goes into some more detail about what is meant by “Fixed Installation”. The wiring diagrams are in the “Using An USB Hub” section. I’ve noticed that there are times when I’ll need to replug the USB OTG connector to get the hub to recognize the connected devices again. It’s somewhat fragile, but generally, it works as it should.
DSC_4541

DSC_4542

DSC_4543

DSC_4544

Wrap-Up:

My N7 runs Spotify/Clock duties at my desk, and thanks to the lamp arm, can be positioned right above my screens. The lamp arm also swivels, so you can use it in portrait and landscape mode! The USB subsystem will occasionally be confused when returning from sleep, which will require a replug. In your Settings, under Developer Options, there’s an option called “Stay Awake”, in which the screen will not sleep while the system is charging. Be sure to enable “Day Dreaming” aka “Android Screensaver’ though, to prevent any chance of burn-in. That’s about it! It’s a great little machine for extra-desk stuff. The sky’s the limit in terms of apps, THE WORLD IS YOUR OYSTER! (This is also awesome for video chats. Just saying.)

DSC_4552_small

Project eyeMac: Aluminum Dreams

Hello FriendlyNerdFriends,

It’s spring time again, and as always, my collection of spare parts and I get into a turf war, AND SOMEBODY GETS CAPPED (Modded).

And, here begins the saga of Project EyeMac (2): Aluminum Dreams. This is technically the second of these that I’ve built, but the first one isn’t written up. I apologize in advance for the underexposed photos, I blew the ballasts for my overhead lights in a tragic accident involving french toast.

DSC_4514

 

 

So, I was browsing the eBays a couple weeks ago, when I stumbled upon this beauty right here:

DSC_4451

Someone was selling a mint condition 20 inch Aluminum iMac case (with front glass!) for only 35$. It’s one flaw (that I could find) was that it had a chip in the upper right corner of the front glass.
Hardly a deal breaker for somebody like me, so I bought it. It was one of those impulse buys that I knew could be something cool. Worst case, I could make it into a strange lamp or something.
The very next week, I was browsing Newegg for something job-related, and BAM. There was a 20 inch LED slim monitor on sale, from Acer, a reputable brand. The gears started turning,
and off I went. I already had a Core i5 13 Inch MacBook Pro logic board with permanent damage to the battery interface, a perfect candidate for a desktop mod.

DSC_4456 DSC_4458

The monitor is impressively thin, thanks to it’s LED backlight. By design, the LCD glass was built into the plastic housing, rather than it’s own independent frame, meaning it wouldn’t be very sturdy without it’s bezel. Another major contributor to it’s thinness. If you can believe it,
the bezel fits perfectly inside the iMac’s aluminum case. I did have to shave it in some places, to clear standoffs, and whatnot, aside from those rather small modifications, you’d think it was made for this purpose.

DSC_4459 DSC_4460DSC_4471 DSC_4482DSC_4470 DSC_4495

I flipped the LCD control board around, and double-stuck it to the front frame. The monitor has built in auto-off/on and input scanning features, so for the most part, I knew I wouldn’t need the button panel. So, that stayed in it’s original location. It’s my intent in the future to break out some of the buttons, and take advantage of the unused DVI connection, but for now, it’s fine as is. I did a couple small mods in this area, removed the barrel jack connector (It was mega-thick, like… Xbox big.) and re-routed the ribbon cables. I also made a super-fancy rainbow right-angle VGA adapter, because EVERYBODY likes rainbows. The last photo in that set is the final configuration.

Now, some fools are gonna get CUT. With the Dremel, that is. I removed many of the plastic standoffs from the case, and many of the steel ones as well. I also cut some notches out of the bracing center frame, to leave room for my SSD bracket and power supplies. I stripped out as much as I possibly could. The most important detail with the case, is it’s thickness. I wanted to close normally, and ended up accepting “somewhat” normally. I’d use different USB ports next time, as the ones I chose were a tad too thick.

Next up, I grabbed some IO panel USB headers, snipped the connectors and soldered USB-A Male cables to them. I took a tiny USB hub I had, extended the connector, and plugged those males into it, with the exception of one, which went to a root port on the logic. After that, they were mounted to the iMac in the stock locations. The last port is in the Firewire connector hole, which has a similar enough footprint that the connectors fit well. I cut a hole in the IO panel for my RJ45 male to female, to break the GigE out to the panel. I also mounted a 3.5mm Male to Female for the speakers. I left the rest of the IO empty, as those were the only things I needed. I stripped an AC input (with filters) from a busted computer PSU, snipped the end, and patched it into a two-prong adapter fits into the MacBook PSU. I also split this AC input for the monitor PSU. The logic board was mounted on a cutout from the MacBook Pro 13’s bottom case. The standoffs for the logic are intact, but the IO panel was removed. There are bolts that brace the logic to keep it from being bent (as the iMac’s case is beveled). Mounting the logic upside down (as it is on the MacBook) recreates the same airflow pattern, as that was a concern of mine. The SSD is a 256G OCZ Agility 4, and it’s mounted on a 2.5->3.5 Inch Hard Drive Bracket for SSDs. The bracket is secured to the case using bolts, all of which are visible from the back. I like the scattered bolts across the back of the iMac. It gives it the Frankenstein look. The hard drive ribbon is curved, but not crushed at a right angle. These ribbons are extremely delicate, and bending them fully will break them.  The multitude of tape you see in the left upper corner is bracing for the ribbon. Also in that area, the WiFi/Bluetooth module. I ran the iMac’s built in antennas to the upper left corner, and attached them to the WiFi card. Great reception. That’s mounted to the case using a single bolt, through the shaved mounting bracket/heatsink. The DC input board is mounted near the logic, braced by two bolts that go through the case. The grounds for the DC input and logic were tied together using a small wire, unnecessary as it might be. Nothing too special here, the regular MagSafe wire attaches to the DC board as it does in the stock setup.

I attached a set of speakers to the logic on it’s stock connector. These are strictly for the startup noise, as they’ll be deactivated when OS X detects there are headphones plugged in (my 3.5mm male to female adapter). They’re secured using hot glue. I use a Thunderbolt to VGA adapter for the video connection. The MacBook will default to an external monitor connection if there is no monitor detected on it’s internal connector. If your MacBook doesn’t behave this way, try resetting the NVRAM, as I ran into that at one point.

DSC_4461 DSC_4462

DSC_4472 DSC_4473 DSC_4475 DSC_4479

The power button mod. Next to the SMC on the MacBook Pro logic, there are two tiny little pads. Shorting these pads together will boot the system, without a keyboard! They’re REALLY tiny. I used 28AWG wire, and there was still overhang. Also, once you’ve attached and tested those wires, seal them with something. I made the mistake of letting these wires flap around while I was working on the placement, and I lifted one of the pads. I then had to solder onto the smallest via in the known universe to get it back. We’re talking like, only slightly bigger than a Quark particle here.  Here’s a link to a high-res shot of the pads, with them highlighted in red. Run these two wires to the Power Button on your iMac shell, and you’re golden.

DSC_4491 DSC_SMC2

And, that’s it! I removed the iSight and obviously didn’t bother with the SuperDrive, since I don’t have a need for either of those features. Now, I’ve got a machine that maxes out at 16GB of RAM, is powerful enough for all of my daily coding routines, and is pretty damn confusing to most. I love how the Acer logo aligned perfectly above the Apple. It’s…. IT’S ALIIIIIIVE! MUHAHAHAHAHAHAHAHAHAHAHAHAHAHA

Final Specs:

Core i5 2.3Ghz
16GB DDR3 1333 (G.Skill)
256GB OCZ Agility 4 SSD
Intel HD 3000 Integrated Graphics
4x USB Ports
1x Gigabit Ethernet
20 Inch Acer LED Monitor (Here’s a link to the monitor, if you’d like to try this yourself.)

Comments from Coworkers:

“What a piece of garbage. That asshole should just go buy an iMac instead of wasting everyone’s time.”

“I like your weird monitor thing.”

“That’s not going to start some kind of fire, is it?”

DSC_4500 DSC_4505 DSC_4508  DSC_4515

UNIX Domain Sockets (Datagram)

Hello friends!

I am here in Internetland to talk to you about my adventures with UNIX domain sockets. I’m designing a collection of separate programs that all need to communicate. The communication has to be multiclient, single server, and easy to implement. In this case, a datagram is the preferred mode due to it’s tiny connectionless nature. UDP seems like a good option at first, but it has problems with reliability. Dropping packets in stateful IPC can cause issues with synchronization, etc. TCP could work, but why use the networking stack when there are APIs dedicated to IPC?

Sounds like a job for UNIX domain sockets. These wonderful little things use the file system for their endpoint identifiers, but the actual communication happens within the kernel. You can configure them as a pipe, or use datagrams. With datagrams, it’s in a single packet context, rather than a stream. There’s no established connection to speak of (but you do call connect()). A bit confusing. You create a file handle for your client and connect to the server’s file handle. If there’s already a file on the filesystem with the same name, the socket’s bind will fail, so cleaning the handles up when done (or before you init) is important too.

If you’re just getting into IPC, then I highly suggest reading Beej’s Guide To Unix Interprocess Communication. It’s great. I should say, there are many different types of IPC, and domain sockets are just one. I prefer domain sockets to shared memory, for the sake of simplicity. For your implementation, look at the many methods available, and see what works best for you.

Without further ado, here’s the code! This first part is the server.

#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>

char * server_filename = "/tmp/socket-server";

int main(void)
{
    int s;
    struct sockaddr_un srv_un = {0};

    if ((s = socket(AF_UNIX, SOCK_DGRAM, 0)) == -1) {
        perror("socket server");
        exit(1);
    }

    srv_un.sun_family = AF_UNIX;
    strncpy(srv_un.sun_path, server_filename, sizeof(srv_un.sun_path));
    /*If you leave the file behind when you're finished, or perhaps crash after binding, the next bind will fail
    / with "address in use". Which just means, the file is already there.*/
    unlink(srv_un.sun_path);

    if (bind(s, (struct sockaddr *)&srv_un, sizeof(srv_un)) == -1) {
        perror("bind server");
        exit(1);
    }

    for(;;) {

        char buf[1024] = {0};
        read(s, buf, sizeof(buf));
        printf("RECEIVED: %s", buf);

    }

    close(s);

    return 0;
}

And, here’s the client.

#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>

char * server_filename = "/tmp/socket-server";
char * client_filename = "/tmp/socket-client";

int main(void)
{

    int s;
    char obuf[100];
    struct sockaddr_un srv_un, cli_un = { 0 };
    
    srv_un.sun_family = AF_UNIX;
    strncpy(srv_un.sun_path, server_filename, sizeof(srv_un.sun_path));

    cli_un.sun_family = AF_UNIX;
    strncpy(cli_un.sun_path, client_filename, sizeof(cli_un.sun_path));
    unlink(cli_un.sun_path);

    if ((s = socket(AF_UNIX, SOCK_DGRAM, 0)) == -1) {
        perror("socket server");
        exit(1);
    }

    /* (http://stackoverflow.com/questions/3324619/unix-domain-socket-using-datagram-communication-between-one-server-process-and)
    Here, we bind to our client node, and connect to the server node. As Unix domain sockets need to have endpoints on either end
    of the connection. For more info, visit the URL.*/
    if (bind(s, (struct sockaddr *)&cli_un, sizeof(cli_un)) == -1) {
        perror("bind client");
        exit(1);
    }

    if (connect(s, (struct sockaddr *) &srv_un, sizeof(srv_un)) == -1) {
        perror("connect client");
        exit(1);
    }

    //printf("Connected.\n");

    while(printf("> "), fgets(obuf, 100, stdin), !feof(stdin)) {
        if (send(s, obuf, strlen(obuf), 0) == -1) {
            perror("send");
            exit(1);
        }
        break;
    }

    //printf("Sent successfully.\n");

    close(s);

    return 0;
}

Macbook Tablet Project “MessagePad”

It’s that time again. The weather’s getting nice on the East coast, and out comes my modding spirit.

Here are some of the inspirations for this project:

http://lifehacker.com/5654478/turn-a-macbook-into-a-tablet-for-100

http://weistudio.com/mac_com.htm

Seeing these projects made me remember the time before the iPad/iPhone and tablet boom, where tablet projects on full size laptops were all the rage. The dynamic of those projects were to fill a gap in a companies offerings, to suit your needs. Apple hadn’t released anything truly handheld oriented since the Newton MessagePad. (Where I decided to pull my project name from.) Every year, there were rumors of the next iTablet. At the time, it was fairly difficult (though, far from impossible) to procure OS X/9 compatible touch overlays for cheap. This project is sort of a “Unicorn” for me. It’s been on the list for ages. And, now… finally finished!

There certainly is a giant continuum of portable, touch-oriented devices that have existed over the years, and where this one fits in, I’m not sure.

Features:

Resistive 13 Inch Screen

User Facing iSight Camera

Rear Facing iSight Camera with Colored Flash

Teensy 2.0 (Built In)

32GB SSD

Sleep Switch

mDVI Port

USB 2.0 Port

Firewire Port

Gigabit Ethernet Port

Line In

Built-In Speakers

Want to skip my ranting and go to the pictures? Head down to the bottom, Chief.

Caveats:

Once you start cutting into your Macbook’s lid, there’s no going back. Measure everything roughly 4,000 times before you make your cuts. There is some tolerance for error on the viewport for the LCD, so don’t let it bother you if it’s slightly off. Do your absolute best to make it straight, and the Sugru will do the rest. That last part will make sense later, the point is… measure 1,000,000, cut once.

This project entails doing a lot of (nearly) irreversible things to your expensive computer. Going back to stock is going to require replacement of a nice pile of parts. Know this going in.

The touch screen is not a perfect fit, there is a ~25px cutoff on the bottom of the screen. I’ve tried to mitigate this using forced resolutions in OS X, but the LCD’s firmware is programmed to crop to available area, so my efforts have been fruitless. That said, if you position the overlay so the blackout area is on the bottom, there is very little loss to screen real estate. The touch screen is also resistive. (Here for a quick comparison of touchscreen types. iPhones/iPads are capacitive.) Resistive has a couple major drawbacks. It can only accept input from a single point of touch at the time (No multi-touch), it’s affected by heat, it cannot be bent or crushed, and most times, it will have low resolution. Take your expectations for that overlay and take them down a couple of notches. It’s relatively difficult to do precision work (Kiss those dreams of doing Photoshop, or using this as a serious drawing tablet goodbye.) but it’s well suited for day to day work and games. (Plants Versus Zombies on here is awesome.)

Don’t try and use the Bluetooth’s USB port directly. This port, and the bluetooth board itself are both 3.3V. It will not properly power any of the hubs, or devices commonly available.

Parts are very easy to crack or deform. Take time disassembling the computer. Let me be absolutely clear: You can remove EVERY part on this computer without major force. If you’re forcing something, it’s likely you’ve forgotten a screw. Adhesive is used on some parts, which require a slight bit of force to remove. The Apple logo, for example. You should use a heatgun to loosen the adhesive and pop it out. Don’t try and force it out. You WILL crack the lid. I speak from experience.

It’s important to remember that just because computers have the same model number and name does not mean they share parts. Core Duo Macbooks have a completely different motherboard mount and fan vent strut. Core 2 Duos were the advent of ZIF low rise sockets for a half of the connectors on the board. 2009 Core 2 Duos changed the optical drive connector, and who knows what else. Point is, they’re all different, damn it. Get parts specific to your Apple Order Number or Design Year. Mactracker is a wonderful resource for this. Couldn’t recommend it enough.

Disclaimer:

While this project is nowhere near as dangerous as my Macbook Dye Project, it still is dangerous. Working with Dremels, sharp cutting tools, drills, routers, and other equipment can be very hazardous. In no way do I cover all of the safety steps here, but – goggles, dust masks, gloves, clamps and an apron help A LOT. BE CAREFUL OUT THERE. These things can hurt you/people around you. I’m not responsible if you drill through your favorite desk, your pinky toe, your cat, your laptop, your brand new TV, or anything else that may happen based on what you read here. You CAN ALSO ruin your laptop, if you’re not careful (Which is more important than that life and limb stuff right? Who needs limbs.) Do as I say, and not as I do.

If none of that scared you, then you are an enterprising individual (And also, INSANE) and, you should high five yourself.

With all of that out of the way… Let’s get started!

 Supplies:

White Macbook Pre-Unibody (I used the Macbook 3,1 – Core 2 Duo, GMA X1300 – 2007)

eGalax Touch Overlay 13.3″ 16:9

Normally Open Pushbutton

Normally Open SPST Toggle Switch

iMac G5/Intel iSight Board

“Thin” USB Hub – (Try to find a hub that supports high-power devices. These usually have nice sized capacitors on them.)

8GB Flash Drive

22 AWG Multi-Strand Wire

28 AWG Single-Strand Wire

Spare Set Of Macbook Lid Magnets (or any flat Neodymium magnet that will fit)

Electrical Tape

Gorilla Glue

Any Dremel with Cutting, Buffing and Smoothing Discs

Sugru

Cake! (To eat in stupendous celebration when you’re done!)

(For the Rear Facing Camera Flash Only)

ShiftBrite Module (I used a 1.0 module, but I’m sure a 2.0 module would work just fine.)

Teensy 2.0

Procedure:

First off, remove your Macbook’s display and optical drive. I’m not going to detail taking apart the computer here, I’ll leave that to the mages at iFixit. Their take-apart guides are the absolute best on the interwho. Follow them and you’ll never lose your way.

Set the bottom case, battery, and their assorted counterparts aside for now. Focus on the display. So, the basic idea behind this, is that we turn the LCD around in the lid, and use the lid as our new display bezel. Remove all of the guts from the display housing. But, leave the lid magnets alone, and save the sleep magnet for another project or your fridge. Once you’ve got the LCD out with it’s mounting frame – Remove the mounting frame from the LCD by unscrewing the handful of small screws around the edge. Remove the iSight from it’s aluminum frame, but leave it’s plastic bezel attached. Remove the hinges from the lid. Where we’re going WE DON’T NEED HINGES. Your lid should now be (mostly) empty.

Place the frame back into the lid, but don’t screw it in. Use the frame as your guide for marking where you have to make the cuts in the lid. The end goal, is that we turn the LCD around and reattach it to it’s normal frame, giving it a nice stable mount, and relieving us of some  fabrication work. Once you’ve made the markings, triple check that it looks right. If so, cut the lid where you marked. Check fitment of the LCD in the new hole. Using the frame as the cutting guide will actually leave a small boarder of dead LCD space (Black boarder + LCD’s frame). Later on we’ll use the Sugru to fill this gap and add stability to the touch overlay.

Choose the orientation of your touch overlay, and ascertain where the ribbon cable will have to surface. Use your Dremel to remove any plastic standoffs that may be in the way. Make sure you smooth it out, as those ribbons are very fragile. You may have to make a small notch in the LCD mounting frame to allow the ribbon to pass through. Once that’s done, attach your LCD to it’s original mounting frame in the reverse direction, so it faces the new hole in the lid. There are a couple ways of doing this part. You can drill holes in the LCD’s mounting frame and use the LCD’s original screws to reattach it (None of the original holes will match up in the reverse direction, have to make your own.) Or you can Gorilla Glue it to the frame in the reverse direction. I chose the latter, but I recommend the former.

Now, while your glue is drying (or you’re reveling in your frame drilling powers) use your smoothing wheel to thin out the plastic around the inside of your new bezelid (Awesome word, yeah? Bezel + Lid.) The touch overlay cannot be smooshed between the bezel and the LCD, and presently there isn’t enough clearance to fit it in there. Shave 1mm or so off of that bezelid around the overlay, and you should be good to go. If in doubt, test your overlay and LCD in place, once your glue is dry. If the touch seems to be wonky, or sticking to one side, there’s likely to be a crease. Test and test again.

Once there seems to be enough clearance, tape your overlay to your LCD+Frame. Run tape around the edges, and I ran a strip over the “dead” area on the bottom of the LCD to protect it. Make sure the overlay is stable and in the right position on your LCD. (This is where the overlay’s short comings become apparent, it is too short vertically to fill in.) Mount the LCD inside the bezelid with the taped on overlay. From the front of the bezelid, you can see the electrical tape boarder now. These are the areas where you should apply your (White or whatever color you want) Sugru. It creates a nice soft boarder, and you can taper the boarder so that you can reach the very edges of the LCD to touch. It’s a hard thing to describe, but just use your best judgement. Sugru is a lot like Playdoh, only it hardens into a permanent rubber-like form. It will hold the touch overlay in place inside the bezelid firmly, and be nice and soft on the user’s fingers.

Test your overlay again! Looking good? Try the 25pt Calibration inside the eGalax Touch menu. Better? Awesome. Hard part is almost done. Give yourself a second to be proud of your work there. NOW! Let’s mount the user facing iSight. The iSight cannot fit in it’s previous position due to the framing change. So, instead, we’ll use the part of the frame where the hinges were previously mounted, as it has ample space. Use your Dremel to smooth out a surface dead center of the “bottom” of the bezelid. Find a drill bit the size of the iSight lens, again, drill dead center. This is going to take a little trial and error. Remove the plastic bezel from the iSight. The lens can float freely attached to it’s PCB, or be disconnected as well, the Microphone will stay attached to the bezel. Align the bezel in the smoothed area with the hole you drilled for the lens, and glue it in place. When it’s dry, pop in the iSight and you’re good to go! You should probably tack down the iSight PCB with some tape, screws or glue. But, I’ll leave that up to you.

One last part for the new top case, and then you’re done! Take your spare set of lid (neodymium) magnets, and glue them in place in the two magnet-less corners of your lid. Try to align them against the other two ones mounted in the bezelid’s frame. We’re going to use these later on to attach the top case to the bottom case! Magnets make it easier to do maintenance in the future, but also provide a strong bond for carrying around. The aluminum iMacs are held together by magnets! Kinda neat, huh?

Top case – Done! Time for some cake! Not too much. Don’t want to go into a sugar-coma. YET.

Now, set your awesome new top case/bezelid/thingy aside. Bottom case time. I’d take this opportunity to take off your heatsink, replace your thermal grease, and clean out your fans. Remove the logic board from the bottom case. Place it on a soft surface (Foam works well) until you’re ready to do your soldering. Now, I attached my power button and sleep toggle to the solid metal area in the fan vent, near the Bluetooth board. It’s notable because air cannot pass through it. Use your Dremel/Drill to cut holes in this area the right size for the switches you chose. Screw your button and switch in, and fill in any gaps with white Sugru. Take care not the bend the metal strut that’s build into the bottom case. After cutting this, make sure to thoroughly clean the bottom case. This cut produces aluminum dust, which is very bad for the logic board/electronic components.

We will not be re-using the optical drive. Chances are your’s doesn’t work anymore anyway. (They’ve got a shelf life of 2 years in these machines. :/) Now, if you’re looking to save weight, and don’t care about the rear facing camera, 8GB recovery drive, or Teensy, you can skip the hub installation, tie your touch driver board into your Trackpad/Keyboard USB port, route the power and sleep buttons, and you’re done! But, that way isn’t anywhere near as much fun.

Now, by far the hardest part of this, is soldering onto the Trackpad USB connector. There we’ll pull signals for the power button, and the USB hub to host our other add-on devices. Use a fine soldering tip, watch a bunch of soldering YouTube videos and take your time. Here’s the pinout. The power button is active when it’s pulled LOW to ground. So, whenever you ground that pin, the computer will boot. Attach the power signal wire to one side of your power button.  Attach the other side of the button to a grounded area. USB ground works just fine. Test! The other 4 pins listed are an internal USB port used by the MacBook’s trackpad and keyboard. We’re going to take that and attach it to a hub to add some devices. Solder your hub onto those pins and place it into your empty optical drive bay. Use small wires so you can route them in the lanes on the logic board. Make sure to double check the pins to be sure they’re matched properly. Now! Boot it up and test. Hub works? Rock on. [An alternative method for this part, is to use one of the external USB ports. I won’t detail it here, but those pins are a lot easier to solder onto.]

Strip your 8GB flash drive of it’s casing, wrap it in tape or heatshrink and attach it to the hub. Glue your hub down in the corner of your empty optical drive bay out of the way. Take this time to tape your touchscreen controller to the bottom of your LCD panel. Keep it out of the way, shorten the USB cable that attaches to the hub to the shortest length possible without making it ballshard to connect when you’re reattaching the top case.

Now’s the time to install your rear-facing camera! For this part, I used an iSight from an Intel iMac 17 inch. You can use an iSight from any iMac G5 (15, 17) or (White) Intel iMac (17, 20) using this guide. But, you can use just about any iSight (or even just a USB webcam, using something like Maccam.) where the pinout is available. Since almost all iSights are just USB, it’s fairly easy to ascertain the pinout. Go crazy. The world is yours. I won’t be covering that here though. Grab your iMac iSight, and pop the clips out for the plastic bezel holding the lens. Detach the lens from the bezel (It may be glued. Some I’ve encountered were not, but some were.) gently. The lens and ribbon can be damaged very easily. Cut the bezel using snips so it can be turned down at a 90 degree angle, instead of forward. Drill a hole in your optical bay roughly the size of the glass lens protector (This piece does no image modulation, just protects the lens from debris/dust.) and pop the bezel/lens protector in. Check your orientation and then glue the bezel in place. Since the glass is a cube shape, rather than round, there may be some space in between the two. If so, use a little Sugru and neaten it up. I used a couple of foam pads to lift up the board to the right height, use your best judgement to determine that. Once everything is dry, attach the board! Now, it’s time to wire it up.

I know it’s tempting to plug that iSight into an iLink (Firewire) cable and fire it up, but DON’T DO IT. The board is not actually Firewire, despite that connector, it’s USB. Check the wire colors if you don’t believe me! You can actually just snip off that end, since we’re not going to use it. Get a male USB A end, and solder it onto the iMac iSight, matching the wire colors. Done! For sanity, you should boot up your system (or another) and plug your iSight in to double check. If everything’s good, tack your lens to the plastic bezel, tack the board down and clean up those wires!

I cover the ShiftBrite flash module in another article.

Just a tip, I seal all of my solder connections with hot glue, just to prevent shorts and give the wires some strain relief. I use a full size hub to make components/wires easy to change, but it does occupy a significantly larger amount of space. You could do better by removing all of the USB female A ports, and just soldering directly to the hub PCB.

Now, I’m sure you’re thinking right now… Where are we putting this inverter? YOU CALL YOURSELF THE BRAIN? YOU ARE NOT. Well, gee. Calm down. I’m getting to that. I moved my inverter to the empty optical drive bay with the rest of the components. It’s a four wire connection, and can be extended without knowing the pinout. Cut a single wire at a time, and attach it to your extension. Seal the connections with heat-shrink tubing. IDE/Floppy (40 pin. 80 pin don’t work very well.) ribbon cables are the perfect form factor for these extensions. Quite easy to deal with, as well.

Now, we need to make sure the top case has 4 magnetic objects to attach itself to when we go to close the case. I took a water damaged scrap top case I had, and popped the two metal alloy pads that the lid uses to grip the bottom case off. I glued them in their respective places on the bottom case. That covers the lower area. Now, the top… I used razor blades with tape over the blade. I don’t recommend you use these. Any rectangular piece of metal (preferably not sharp) will work, but not all alloys are magnetic! Glue them in place (corners of the fan strut). Done!

Home stretch here. Solder two wires onto the pins of your sleep switch. I have a picture of which pins here. Run these two wires to your toggle switch. Now, when the switch is in the on position, the system will “think” the lid is closed, and go into sleep mode. Open the switch, and the computer wakes up.

I used Sugru to seal the optical drive slot, and smooth out the side of the system, as well as seal the areas where the hinges previously were. You can also protect the bottom of the user-facing iSight with a bit of Sugru. It really works wonders.

Install your SSD (Install OS X on here, if you haven’t already.), RAM cover and battery… Attach all of the cables for your top case, route the cables so they aren’t stressed when the bezelid is shut… Let the magnets hold the two pieces together and… you’re done! Boot it up. Revel in the glory and wonders of your own Mac OS X tablet, install some software that’ll make using this thing easier (and possible.)

Now for some neat software!

MacFlip (Accerometer-based Screen Orientation App, Made for the Axiotron Modbook.)

How To Enable Ink On Touchies

Enable On-Screen Keyboard for OS X (10.4, 10.5) – (Note: In 10.6 Snow Leopard: The System Preferences Item is called Language And Text, then Input Sources, then check the Keyboard & Character Viewer Textbox at the top.)

SmcFanControl – (Use this to tweak the speed of the fans to vary based on power state.)

What I Learned:

Pecking at the on-screen keyboard is a bit of a bother. The touch overlay doesn’t support multiple touch points at the same time, so using modifier keys is impossible. The tablet’s battery life is about 4 hours or so under load. Later generations have better sleep-power consumption, and should be able to sleep for long periods of time. The generation I used does not, but can sleep for a week or so before depleting it’s battery. The system is surprisingly light, definitely comfortable to hold. It’s large, but nice. I enjoy using it. Tap to click is an absolute must, double clicking on things is tiresome using the touchscreen. The LCD should be protected under a layer of lexan. Right now, pressing on the overlay is pressing on the physical screen glass. Very bad for the screen. It works in this configuration, but could be much better with some protection. Could even be made waterproof with a significant amount of work. Speakers don’t quite reflect sound towards the user without the lid. When placed on a surface though, very loud, good.

It gets moderately warm, but nothing uncomfortable. MacFlip is not able to do vertical screen orientation… Just scrambles everything. It will also bury the menubar in the deadzone if it’s flipped the opposite direction. A higher quality overlay would make this even more awesome. Using Photobooth to switch between the cameras (and controlling the flash by sending characters to a ttyUSB) was so cumbersome I wrote an app in Processing to do it for me. It’s not quite done yet, but I’ll update when it’s complete.

Software Projects Inspired By This Work:

Shake To Exposé

Camera.app (Built-In Processing – Allows easy switching between Front/Back Cameras, Flash duration/Color)

PriTunes (Processing implementation of iTunes API. Allows quick song searching, play/pause, visualizer. Good for Carputers.)

Future Features:

SD Card Reader (In Optical Drive Slot)

Portrait Mode

ALL DONE! Hug pandas. Eat cake. INITIATE SUGAR COMA. Enjoy your MessagePad‘s big brother. And, hey… This runs Adobe Flash. 😉