Saturday, February 18, 2012

How To Make the 23" Android MegaPad

A few months ago I published a video showing me using my home-made 23" Android tablet, which got a bit of attention and made people wonder how it was made. A lot people made plausible guesses - that it was a staged video, that it ran android-x86, etc, but few made the right guess so I wanted to publish a how-to so anyone that's interested can make their own.

The core of the MegaPad is the TI PandaBoard - a $200 ARM development board which contains what are essentially the guts of any modern smartphone - a dual-core 1GHz CPU, 1GB RAM, GPU, WiFi and a host of connectors. The great folks at TI provide both Ubuntu and Android releases for the PandaBoard and it's fairly straightfoward to get one of the releases up and running. For the touch input and video output, I went with the Acer T230H, which was made for Windows 7 and uses optical-touch to provide 2 touch points with acceptable performance. This monitor has been discontinued by Acer, so I found it in Kijiji, but as we'll see, you can substitute with another suitable touch monitor.

The bit that makes it all work is this: pandaboard releases are made to work with a keyboard and mouse and will not recognize the Acer touchscreen if you merely plug it in. Luckily, Linux developers have written a touchscreen driver that works with the Acer monitor, so all we have to do is recompile the kernel with the right drivers and voila! We got ourselves a megapad. There a few more details. The touch driver that comes with the Gingerbread pandaboard release supports only one touch point, so in order to get dual-touch working as in the video, we'll have to patch the driver.

There are a number of improvements one could make to the MegaPad. The lagginess you see in the video is due to the fact that Gingerbread was never made to support 1080 at reasonable frame rates, however the folks at Linaro have been busy making an ICS release for the pandaboard, which you can check out here. I suspect ICS will run far smoother than Gingerbread. Moreover, one can use any size touchscreen, as long as linux drivers are available. I went with the T230H simply because it didn't require the big investment larger screens do. Now, without further ado:


Instructions

  1. First, get a PandaBoard from DigiKey, Mouser or any other retailer. I also recommend a Serial-To-USB connector, since you'll need to use the PandaBoard's serial connection as well as a very fast SD Card.
  2. Get an Acer T230H or any other touch monitor which has working linux drivers.
  3. install minicom or similar serial terminal on your laptop. The pandaboard does not how to boot itself, so you'll need to connect to the serial port and paste some bootargs to tell the bootloader where to find the kernel.
  4. Get everything working with a keyboard and mouse: You can follow the instructions here on how to download and put the binaries onto the sdcard. Essentially, the SDCard will be formatted with 3 partitions: bootfs where you put the boot loader and linux kernel, rootfs where you put Android and data where you can store media files. To boot up the board, put the card in, connect the power and start the serial console. When you see the fastboot countdown on the console, interrupt it by pressing enter so you can get a prompt, then paste in the bootargs found here.
  5. Once you have Android up and running on the pandaboard using a keyboard and mouse, we can recompile the kernel to get our touchscreen working.
  6. Set up your computer and get the tools you'll need to download and compile the kernel by following these instructions. Next, follow the instructions here to download and compile the kernel without any modifications.
  7. Once you have everything set up (and patched, as per the instructions), try compiling the kernel and loading Android on the Pandaboard with it. The compilation, which should take 10 mins or less, will produce a file called "uImage", which is the entire linux kernel. Take that file and copy it into the bootfs partition on your sdcard and start the pandaboard as before.
  8. If everything is working fine and you can compile and load your own kernel, we're ready for the modifications to get the touchscreen working
  9. In your kernel dir, go to arch/arm/configs/panda_defconfig and search for "#CONFIG_HID_QUANTA is not set", which should be commented out. Change the line to "CONFIG_HID_QUANTA=y".
  10. Recompile the kernel, load it on the SD card and connect the USB touch port from the touchscreen into the pandaboard and disconnect the keyboard and mouse. Once the boot is complete you should have a fully operable, albeit single-touch, megapad!
  11. To get dual-touch working, patch the quanta driver using this patch. You can find the driver under drivers/hid/hid-quanta.c. Once again, recompile and reload. You should now have dual-touch fully working.
Tips
  • The pandaboard may appear slow, which may be due to Android's inability to write to the /data directory. Put the SDCard in your computer, go to the rootfs (Android) partition and do "chmod -R 777 /data". I found that this made performance on my pandaboard acceptable.
  • The pandaboard needs a weird 5V @ 20A power supply and most 5V supplies won't work. I suggest merely plugging in the miniUSB port into your computer and power it the way you would recharge any phone or tablet.
  • Getting adb working is much the same as any other device. Add the following (SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d102", MODE="0666") to your udev rules, restart udev and adb and you're good to go

If you have any questions and comments, you can check me out on Google+ here:

Happy Hacking