The Raspberry Pi Foundation recommends Raspbian
, a version of Debian Linux developed specifically for the Raspberry Pi.
Before the LittleBox will function correctly, and to enable the touchscreen we have to go through a few steps to firstly update the OS, and then to install the touch screen drivers.
It took a while to figure it all out. I'll detail exactly what I do to get the LittleBox to work.The basics.
After downloading and writing the Rasbian image to an SD Card, insert the card into the Raspberry Pi and turn on your LittleBox.
Your LittleBox will need to be connected to the internet.
At the setup menu expand the root partition to use all of the SD Card, change the memory split to 128mb from 64mb, and set it so it boots to the desktop.
When it loads into the desktop you might find a black border around the screen. We need to increase the screen size, or if you want the technical term, change the overscan.1 |
Double-Click on LXTerminal on the desktop2 | TYPE
: sudo nano /boot/config.txt3 |
move the cursor down and remove the # signs in front of
Change the four values from 16
to -465 |
Hit CTRL & X
to exit, select Y
to save the file.6 | TYPE
: sudo reboot
The LittleBox will reboot and there should now be no border around the edges. If you find that there is no image on the screen you might need to remove the SD Card and edit the config.txt file on another PC to alter the overscan so it correctly fits the screen.
The audio for the Raspberry Pi is set by default to use the HDMI digital audio output. To make sure the sound comes through the headphones socket and out the the amplifier we need to change the audio configuration.7 |
Double-Click LXTerminal on the desktop8 |TYPE:
sudo amixer cset numid=3 1
Linux needs updating before we install any programs, or drivers.9 |TYPE:
sudo apt-get update10 |TYPE:
sudo apt-get upgrade
If this is your first time running the upgrade command it can take a while, 10 minutes or more, for the process to complete.
Next we'll install an updater for the Kernel.11 |
Double-Click on Midori on the desktop, this will open a browser window.12 |
goto https://github.com/Hexxeh/rpi-update13 |
Follow their instructions!
That is it for the basics. Next we'll get the Touch Screen working.sudo gives you administrator privileges (link).
nano is a terminal text editor (link).amixer controls the audio (link).apt-get is a command-line program manager (link).The Touch Screen.
The TouchScreen Controller is an eGalax Inc. USB TouchController, You can confirm the controller is correctly connected by typing lsusb
at the command line.
This process can take several hours, about six of them, so make sure you can leave your LittleBox switched on for a long time. I would recommend leaving the LittleBox to compile overnight. This process can be done on another Linux machine but for the purposes of this instructable I will assume another Linux machine is not available.14 |
Double-Click LXTerminal on the desktop.15 | TYPE:
will download to your home directory (if that is the directory you are in), the latest Raspberry Pi Kernel source from GitHub. You can read more about the Kernel by visiting their page on GitHub, https://github.com/raspberrypi/linux
.16 | TYPE:
tar -zxvf rpi-3.6.y.tar.gzTar
will take a few minutes to extract the archive.
We need to install some dependencies before we can compile the Kernel;17 | TYPE:
sudo apt-get install git libncurses5 libncurses5-dev qt4-dev-tools build-essential18 | TYPE:
cd linux-rpi.3.6.y/19 | TYPE:
That will clean the source before compiling.20 | TYPE:
cp arch/arm/configs/bcmrpi_defconfig .config
This will copy the default configuration into the install folder.21 | TYPE:
This will load a GUI Kernel configuration. There are other options available, for further information open the README file in the ~/linux-rpi.3.6.y/ directory.22 |
Click on the Folder Icon to load the default configuration (.config
Navigate to Input Device Support in the left tree.24 |
Scroll down to Touchscreens in the right tree.25 |
Scroll down to USB TouchScreen Driver and click the tickbox.
There should now be a selection of drivers ticked in the tree.26 |
Click the Floppy Disk Icon to save the configuration.27 |
Close the configuration GUI.28 | TYPE:
The Kernel will now compile. This really will take several hours
. Go make a cup of Tea.29 |
Drink your Tea.
If there are any errors when compiling the Kernel, check over the instructions and confirm all the dependencies are installed.30 | TYPE:
sudo make modules_install
That will install the Touchscreen drivers, amongst others.
Next we copy the newly built kernel to the boot folder31 | TYPE:
sudo cp arch/arm/boot/Image /boot/new_kernel.img
To make the new Kernel load at boot we'll have to add an entry to the config.txt file32 | TYPE:
sudo nano /boot/config.txt33 | TYPE:
kernel=new_kernel.img34 | CTRL & X
, and then Y
The Kernel and modules should be installed & correctly configured, to load them you need to restart.35 | TYPE:
If the LittleBox doesn't reboot, turn off the power and remove the SD Card. Put the card into another machine and edit the config.txt file. Comment out, place a # in front of, kernel=new_kernel.img replace the SD Card in the LittleBox and try again. You will need to carry out some troubleshooting to find out why the new Kernel has not booted.
If all has gone well when the LittleBox boots to the desktop you should be able to touch the screen and move the cursor.
We'll now need to install a program to calibrate the screen.36 |
We need to install some more dependencies.37 | TYPE:
sudo apt-get install libx11-dev libxext-dev libxi-dev x11proto-input-dev38 | TYPE:
wget http://github.com/downloads/tias/xinput_calibrator/xinput_calibrator-0.7.5.tar.gz39 | TYPE:
tar -zxvf xinput_calibrator-0.7.5.tar.gz40 | TYPE:
cd xinput_calibrator-0.7.541 |TYPE:
./configure42 | TYPE:
make43 | TYPE:
sudo make install
Once the install is finished the calibrator should now be ready for use.44 |
To load the program click on the program icon in the bottom left corner of the screen, go to preferences and click on Calibrate Touchscreen
Touch the four calibration points with either a stylus or your finger. Try to avoid using a pen or any sharp pointy thing.
When the calibration is complete a terminal window will open with the calibration information. This needs to be permanently saved to a calibration file.46 | TYPE:
(in a different LXTerminal to the one with the calibration information) sudo mkdir /etc/X11/xorg.conf.d47 | TYPE:
sudo nano /etc/X11/xorg.conf.d/99-calibration.conf48 |
On the calibration terminal highlight the text;
MatchProduct "eGalax Inc. USB TouchController"
Option "Calibration" "78 1970 1805 136"
The numbers and options may be different for your calibration.
49 | Click Edit - then Copy on the Calibration LXTerminal menu bar.
50 | Click Edit - then Paste on the 99-calibration.conf LXTerminal menu bar.
51 | CTRL & X then Y to save.
Confirm the touchscreen is working and the calibration has corrected any inaccuracies. if you're happy;
52 |TYPE: sudo reboot
When the LittleBox boots back to the desktop check the calibration settings have been saved and all is well, then;
53 | Hack the planet.