eGalax touchscreen and Banana Pi and Raspbian OS

I have been using an eGalax Touchscreen monitor with my Raspberry Pi, for a while. With the new Banana Pi board, I wanted to use the same eGalax TS Monitor and try my web kiosk project. After a lot of research and trials,I finally came up with a much more straight forward and simple tutorial, that explains the steps, as in detail, as possible.

Setup specs:

Build PC:
Intel core i3@2.4GHz
Ubuntu 14.04 LTS 32-bit Desktop OS
HDD space available: 120GB
2/4MBits internet

Banana Pi:
SD card: 8GB class 10 SDHC UHS-1
2A power supply via microUSB DC IN.
A/V output by: HDMI
TS i/o by: USB
US Keyboard

Download the “Raspbian_For_BananaPi_v3.1” file from here and burn it on a good SD card with sufficient space(at least 4GB) and speed(at least class 4). If you need help in installing the image onto the SD card, follow the instructions given here.

Verify if the SD card is bootable or not. While booting, you should see the green led on the board blink often and texts start appearing in your monitor and finally a Desktop interface appears.

The default login details are:
username: bananapi
password: bananapi

Shutdown the bananapi and insert the SD card in your computer’s SD card reader, running a linux OS.

Now, we are ready to start building the modified OS kernel.

Step 1:
Install the cross-compiler tools.

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential u-boot-tools uboot-mkimage binutils-arm-linux-gnueabihf gcc-4.7-arm-linux-gnueabihf-base g++-4.7-arm-linux-gnueabihf gcc-arm-linux-gnueabihf cpp-arm-linux-gnueabihf libusb-1.0-0 libusb-1.0-0-dev git wget fakeroot kernel-package zlib1g-dev libncurses5-dev

Note: If you are using later versions of linux, uboot-mkimage would have been replaced by
u-boot-tools. You can remove the uboot-mkimage from the install list.

Step 2:
Create a directory where you will build the OS.
mkdir newos

and cd into it.
cd newos

Step 3:
Download the BSP packages
git clone https://github.com/LeMaker/bananapi-bsp.git
took about 5-10 seconds.

Step 4:
Compile everything.

cd bananapi-bsp
./configure Bananapi

Once the configure script finished without any errors, then do:
make linux-config

It will download bananapi packages from git, which took about 1-2 hours on my system and then menuconfig would open automatically.
In the menuconfig screen, go to:

Device drivers->Input Device Support->Touchscreens->USB Touchscreen Driver

Mark the “USB Touchscreen Driver” option as built-in by pressing the ‘Y’ key, i.e. a * symbol in the []s alongside the option, should appear.
NOTE: Do not select the “EETI eGalax multi-touch panel support” option.

Press ESC key again and again, until you get a dialog box asking if you want to save the configuration changes. Select the YES option.
The build will continue and complete, in a few seconds.

Now, on the command line, issue

It will build the USB touchscreen driver into the kernel and take about 10-15 minutes(as in my system) to complete.

Step 5:
Copy the kernel components to your SD card:

sudo cp build/Bananapi_hwpack/kernel/uImage /media/username/boot
(first FAT partition of the SD card)
sudo cp build/Bananapi_hwpack/kernel/script.bin /media/username/boot

Step 6:
Copy the new compiled library modules & firmware

sudo cp -r build/Bananapi_hwpack/rootfs/lib /media/username/disk2
(Second EXT4 partition of SD card)
sudo cp -r build/Bananapi_hwpack/rootfs/etc /media/username/disk2

Step 7:
Unmount/Eject the SD card and boot it with Banana Pi.
Check if, your touches on the Desktop screen, moves the mouse cursor and then use your calibration program(for eg. eCalib), if necessary, to calibrate the TS inputs.

#1: http://forum.lemaker.org/viewthread.php?tid=1706
#2: http://forum.lemaker.org/1562-1-1-egalax_touchscreen_and_banana_pi.html


Configure eth0 on Raspberry Pi

Connecting my RasPi to my home LAN, was quite easy. Although, the no. of ways I could connect them together are many,  I decided to go the old-school way. Simply connect the Ethernet port of my Router and RasPi , via a straight through cable and get started. My router had already been assigned an IP address, i.e.

The next thing I had to do was configure the eth0 interface on my RasPi and assign it a static IP.

These are the steps I followed:

    1. Open the network interfaces file:
      sudo vi /etc/network/interfaces
    2. In there, replaced the following lines:
      auto eth0 
      iface eth0 inet dhcp
      with this:
      auto eth0
      iface eth0 inet static


    3. Then opened resolv.conf file:    sudo vi /etc/resolv.conf
    4. In the file, removed all lines and typed in only this line:
      Where, is my gateway, which would help me to connect my RasPi on LAN, with internet.
      Save the file and exit the file editor.
    5. Now in terminal, restart the network interfaces:
      sudo networking restart
    6. Then ping my gateway:
      If it pings, then, ethernet interface is ready to use, else you  should reboot RasPi and retry pinging again.

Using RTC PCF8563 on Raspberry PI running Raspbian OS

I built the RTC circuit. Now, I had to start using the “RTC to keep time, in Raspbian OS”! Well,after a bit of digging and experiment, here’s what I did.

I used a PCF8563 RTC with Raspberry Pi Model B, running latest version of Raspbian OS (Release date: 2014-01-07).

NOTE: RTC PCF8563 is supported in the latest Raspbian OS kernels. No need to build a custom kernel.

  • First, sudo vi /etc/modprobe.d/raspi-blacklist.conf
    • Then, comment out the following lines, by prepending them with a # character:
#blacklist i2c-bcm2708
  • Second, you need to configure to load modules at startup.
    • Open the file: sudo vi /etc/modules
    • Add the following lines, at the end of the file:
  • Install i2c-tools:
    sudo apt-get install i2c-tools

    and then REBOOT

  • After reboot, check to see if your h/w is connected and working:
    sudo  i2cdetect -y 1

    If your h/w is working you should see a 0x51 in the output of the above command.

  • Now, you need to add the rtc clock to work right at every boot:
    • Open /etc/rc.local:    sudo vi /etc/rc.local
    • Add the following lines, right before the line containing exit 0 (the exit 0 should be the last line of the rc.local file)
      modprobe i2c-bcm2708
      echo pcf8563 0x51 > /sys/class/i2c-adapter/i2c-1/new_device
      modprobe rtc-pcf8563
      hwclock -s
    • Now reboot again.
  • To change the date in rtc:
    • Check the current date and time in Raspbian OS: date
    • Set the date and time in your Raspbian OS(you should have set the correct timezone, before this step):

date -s "MMM DD HH:MM:SS"

Where, MMM=first 3 letters of months, DD=new date and HH:MM:SS = 24 hr format hours:minutes:seconds.
You should enclose the parameters, within double quotes. For more information check man page of date.

  • To view the current date and time stored in the RTC Pi:   hwclock -r
  • Set the Linux system time to the value in the RTC Pi:   hwclock –s
  • To set the RTC Pi with a custom time directly, use:

hwclock --set --date="2014-12-25 00:00:00" --utc
and then use:
hwclock --hctosys

For more information about hwclock, refer the man page.

  • Done!