Devan
Posts: 2
Joined: Mon Oct 01, 2012 7:26 am

HOWTO: Use Android Tablet as a screen / keyboard

Mon Oct 01, 2012 8:45 am

What this does:

1. Allows you to use your Android device as keyboard input and terminal display for your Raspberry Pi

2. Allows you to tether your Raspberry PI to your Android device's WiFi (3G untested, but should work).

Background:

I love the idea of a truly portable Raspberry Pi box. I wanted to make one, but I don't have a compatible WiFi dongle, nor do I have a wireless keyboard and mouse. Even if I did all of these things, I'd like to save myself the extra USB port by having both my network and input go over the same port. I guess the next thing to do after this would be to set up some sort of VNC server and connect to the Pi's GUI via the Droid.

My Build:

Raspberry Pi v2 (Linux raspberrypi 3.1.9+ #125 PREEMPT)
Asus Transformer Prime (Android 4.1.1. Jelly Bean)
Yoobao "Long March" -11200mA 1A / 2A battery (good for 10+ hours!)
VX ConnectBot terminal emulator (Free in the Google Play store)
Hackers Keyboard - because I like tab complete (Free in the Google Play store)

How it looks (Click URL to embiggen)

Image
http://farm9.staticflickr.com/8032/8042 ... b520_b.jpg

Assumptions:

Your PI is configured to run SSHd on startup
You are using the default Pi username / password
Your Android device has internet connectivity via WiFi/3G and it is enabled

How to do it:

1. Add the following to /etc/network/interfaces
iface usb0 inet static
address 192.168.42.42
netmask 255.255.255.0
network 192.168.42.0
broadcast 192.168.42.255
2. Power down your Pi

3. Connect your Android device to your Pi via it's USB data cable

4. Power up your Pi... wait about a minute.

5. On your Android device, go to Settings / Wireless & Networks / More / Tethering & Portable Hotspot... click "USB tethering"

6. Start up VX ConnectBot and SSH "[email protected]"

7. Keep hitting return until it asks you for your password. Enter it.

Congratulations - you should now have terminal access to your Pi with a software keyboard... kinda. Mine seems to disconnect the session every minute or so - very annoying.

Now to set up routing so that your Pi can see the world via your Android device.

8. Root yourself up
sudo su -


9. Check to see which IP address that your Android device is using
arp -a
mine is 192.168.42.129

10. Add a default route pointing all traffic from your Pi out to your Android device. It's worth noting that this static route is temporary and will not survive rebooting your Pi. I've left it like this because I don't know if Android likes to change it's tether gateway address very often. If you've gotten this far, I'll assume you can figure out how to make a static route permanent if need be :)
route add default gw 192.168.42.129 usb0
11. Test it!

Datathrash
Posts: 3
Joined: Wed Oct 10, 2012 5:26 pm

Re: HOWTO: Use Android Tablet as a screen / keyboard

Wed Oct 10, 2012 5:29 pm

I've got a spare android tablet to try this on, just what I was looking for! Do you know if I'll still be able to use my wireless keyboard/mouse along side this?

Coburn
Posts: 78
Joined: Tue Sep 06, 2011 2:57 am

Re: HOWTO: Use Android Tablet as a screen / keyboard

Thu Oct 11, 2012 1:52 am

Datathrash wrote:I've got a spare android tablet to try this on, just what I was looking for! Do you know if I'll still be able to use my wireless keyboard/mouse along side this?
Wireless Keyboard and mouse in what? The R-Pi or the Android tablet?

Datathrash
Posts: 3
Joined: Wed Oct 10, 2012 5:26 pm

Re: HOWTO: Use Android Tablet as a screen / keyboard

Thu Oct 11, 2012 3:08 am

Wireless keyboard in the pi. I only want to use the android as a monitor and for wifi.

Devan
Posts: 2
Joined: Mon Oct 01, 2012 7:26 am

Re: HOWTO: Use Android Tablet as a screen / keyboard

Sat Oct 13, 2012 7:26 am

Datathrash wrote:Wireless keyboard in the pi. I only want to use the android as a monitor and for wifi.
Unfortunately not, the tablet is connected at a virtual terminal. I can imagine some sort of hackery that might feed your keyboard input into an existing terminal session, but I've never seen it down.

That being said, if you have a keyboard for your tablet - it should give the same effect.

tempest69
Posts: 16
Joined: Sat Sep 15, 2012 10:58 am

Re: HOWTO: Use Android Tablet as a screen / keyboard

Sat Oct 13, 2012 8:33 am

Starting vncserver on the rPi and using a vncviewer on the android side ==> you have the same thing but not only a text terminal : a full graphical desktop and finally ...
Cheap usb touchscreen for your rPi (comparing to stand alone usb touchscreens)?

Datathrash
Posts: 3
Joined: Wed Oct 10, 2012 5:26 pm

Re: HOWTO: Use Android Tablet as a screen / keyboard

Tue Oct 16, 2012 4:03 pm

Can you expand on the vnc usage a little? Is it really that simple?

MishMich
Posts: 11
Joined: Fri Nov 23, 2012 9:35 am

Re: HOWTO: Use Android Tablet as a screen / keyboard

Fri Nov 23, 2012 10:08 am

Hi,

I received my RPi today, and have to say to the creators that I am very impressed with this little device, and think this is great for youngsters. While I was waiting for mine to arrive, I looked through this and other articles about finding ways of interacting with it.

Setting it up was pretty straightforward, using a USB keyboard (which has a hub for the mouse, so only takes up one USB port) and DVI input on a Samsung monitor. I ran updates, localised the setups, installed XFCE, Synaptic, Chromium, X11vnc, etc., all without any hassle. I tested the VNC connection from Remmina on a laptop.

But, what i want to do is something similar to what I could do with my old Nokia n900, where I could run Debian in a chroot environment. It is possible to root an Android device to do something similar with Ubuntu, but from what I can make out, this works OK with WiFi devices, but is not a good idea with 3G versions. The idea is to use the RPi alongside my 3G Motorola Xoom, accessing the RPi from the Xoom.

So, where I am up to was pretty straightforward (although only seems to work via a USB hub for some reason). I can attach the RPi via the USB, and establish USB tethering from within Android. In a terminal I typed 'ifconfig', which showed me the usb networking was identified as 'usb0'. Typing 'sudo dhclient usb0' gave me an ip address. I tested in Chromioum that I could search on Google and access the web.

I then set up Android VNC to connect to the X11vnc server I had set up earlier. That worked, and I could use the tablet interface to move the mouse pointer, pull-down menus. But, that is where I hit a bit of a brick-wall. I can use the USB keyboard plugged into the RPi to input text, but I'd prefer to use the Android keyboard, to minimise the clutter. But, the Android keyboard doesn't function through the VNC client.

Anybody figured a way round this?

I'm wondering whether the solution might be to install a virtual keyboard via Raspbian.

The other issue is the usb hub, which detracts from the portability, and adds the need for another portable power adapter when running off a 12v supply.

Anybody got any ideas about that?

I'm surprised how responsive the RPi is via VNC, although I have yet to try installing things like LibreOffice & Gimp.

MishMich
Posts: 11
Joined: Fri Nov 23, 2012 9:35 am

Re: HOWTO: Use Android Tablet as a screen / keyboard

Fri Nov 23, 2012 10:34 am

Update to this.

Text can be input via the VNC session using a bluetooth keyboard connected to the Android tablet. But, that seems to affect the ability to search online via a browser. That is not a problem, as the Chrome browser in Android is more than adequate for mobile browsing.

SDreher71
Posts: 1
Joined: Sun Nov 04, 2012 11:05 pm

Re: HOWTO: Use Android Tablet as a screen / keyboard

Wed Nov 28, 2012 2:21 am

I found a VNC viewer app in the Play store called Free bVNC Secure that has virtual keyboard capability. When connected to my RasPi vnc server on my Acer Iconia A500, on the right side of the screen is a little widget that looks like some keyboard keys. If you don't see it at first, tap the desktop background, to take focus away from any windows that might be open. Once you open the keyboard, you can return focus to your window and type. I hope this helps.

RedP
Posts: 1
Joined: Thu Dec 06, 2012 4:05 pm

Re: HOWTO: Use Android Tablet as a screen / keyboard

Thu Dec 06, 2012 4:13 pm

Using the gnu-screen terminal multiplexer, you should be able to connect from your raspberry pi and from your android device to the same terminal session enabling to use the keyboard connected to your RasPi and at the same time use the android phone or tablet as screen.
The project Kindleberry http://www.ponnuki.net/2012/09/kindleberry-pi/ shows how to use gnu-screen on your RasPi and it should be compatible with what Devan explained in this thread.

michaelmd
Posts: 3
Joined: Tue Sep 25, 2012 8:08 am

Re: HOWTO: Use Android Tablet as a screen / keyboard

Fri Dec 07, 2012 11:08 am

very interested in this.

I'm looking ways to have a low cost portable screen

Only got my RPi a couple of weeks ago and have so far been using it via ssh/vnc from a pc
(I don't have any hdmi gear and also don't have an old tv handy)
- so currently exploring it headless.
I do have a linux pc and an sd card reader here so I can still edit config files with that if something breaks sshd and have given it a static local ip to make things easier for now.

I don't currently own a tablet but do have an android phone.- the on-screen keyboard is a little too small to be easy to type on - but its definately portable....

Android tablets are also starting to get cheap enough to start tempting me - saw a $99 one advertised by a LOCAL store the other day!

maxmike
Posts: 2
Joined: Thu Jan 03, 2013 5:50 pm

Re: HOWTO: Use Android Tablet as a screen / keyboard

Sun Jan 06, 2013 7:06 pm

Devan's setup sounds intriguing and I thought I could save myself a keyboard at first glance, but the
settings that have to be entered assumes I have a keyboard in the first place, so what's the point?
Also, which USB is used as connection - there are two on the TF700 keyboard.

Wessix
Posts: 18
Joined: Wed Jul 11, 2012 9:12 am

Re: HOWTO: Use Android Tablet as a screen / keyboard

Tue Feb 05, 2013 8:06 pm

x11vncserver could be a solution, with this you can log into the "premier" X11 running on the raspberry and not the virtual one. haven't tested with android device, but with pc it works.

User avatar
DrDeath
Posts: 7
Joined: Sun Mar 03, 2013 7:00 am

Re: HOWTO: Use Android Tablet as a screen / keyboard

Sun Mar 03, 2013 7:06 am

very smart idea, i was looking for a way to have portable screen for my RPI

and this idea is perfect, thanks
{ Theory is when you know everything but nothing works.
Practice is everything works but no one knows why.
In our laboratory, theory and practice are combined:
nothing works and no one knows why!!! }
-- Albert einstein

hws
Posts: 8
Joined: Thu Mar 21, 2013 11:17 am

Re: HOWTO: Use Android Tablet as a screen / keyboard

Sun Apr 14, 2013 8:11 pm

Hello Devan,
I wonder whether in due course I may ask you to give me advice as to the use of an android tablet with the raspberry pi. I would prefer to have as few bits and pieces and leads etc. as possible, thus looked in the forum for mail on android and raspi - and found your mail with suggestions.
I am not quite certain whether I understand all that you explain, however, I will try my best.
Looking forward to hearing from you,
hws

ofey
Posts: 152
Joined: Tue Jul 16, 2013 9:41 pm
Location: St.Gallen, Switzerland/Dublin, Ireland

Re: HOWTO: Use Android Tablet as a screen / keyboard

Mon Oct 14, 2013 10:32 pm

SDreher71 wrote:I found a VNC viewer app in the Play store called Free bVNC Secure.

Hi SDreher71,
Is there any chance you could give some details on how you used free bVNC to connect your pi to an Android Tab2 (or maybe you didn't use a Tab2)? Does ssh have to be enabled on the pi. I am able to connect to my pi from my laptop (Win 7) using VNC. But I can't get bVNC to connect do the same from the Tab2. The pi is set up so that tightvncserver starts on startup. Should free Bvnc be able to connect to the tightvncserver?
Any help would be greatly appreciated,
Thanks,
Shane
PS I did gte this work. The problem was that I was using '1' as the port instead of '5901', which works :oops:
Last edited by ofey on Thu Oct 17, 2013 12:18 am, edited 1 time in total.
Pi = too much fun!

suchenwi
Posts: 27
Joined: Fri Sep 27, 2013 8:40 pm

Re: HOWTO: Use Android Tablet as a screen / keyboard

Tue Oct 15, 2013 7:41 pm

My setup (tested to be working):
Pi B 2.0, runs tightvncserver.
Cheap (69€) 7" Android tablet (TrekStor Surftab Breeze), runs android-vnc-client. Screen resolution only 800x480.
WLAN router connecting both.

Operation is smooth, though I have to scroll the virtual screen around a bit. Typing is inconvenient, as the "Hacker's keyboard" covers more than half of the tablet screen.

Tested alternatives:
(1) Pi with dedicated keyboard, mouse, 24" Full-HD screen. (Very much superior, but not very portable).
(2) Pi connected via Ethernet and USB power line to Netbook running tightvnc client (or ssh). (Also superior, higher-res screen, physical keyboard off-screen ;^)

For really mobile use of Pi + Android tablet, there must be a common WLAN. Or I'll have to investigate further for USB tethering between Pi and tablet (which could also power the Pi - at least the Netbook can).

One use case I can think of is lengthy operations on the Pi, and more convenience to check how it's going (no need to switch monitor, keyboard, mouse...)

I'm happy "because I can" (and it was much easier than to do some hardware magic), but I'm undecided how and when to use it...

Archie630
Posts: 2
Joined: Mon Jun 11, 2012 6:17 pm

Re: HOWTO: Use Android Tablet as a screen / keyboard

Thu Oct 31, 2013 10:41 am

Topman, done that, now for a wireless option.

Try this if you're interested.

http://forum.xda-developers.com/showthr ... ?t=1365371

Cheers

technix
Posts: 126
Joined: Sat Jul 13, 2013 4:55 pm

Re: HOWTO: Use Android Tablet as a screen / keyboard

Sun Nov 03, 2013 4:55 pm

Weird - why is that ever needed??

I have no Android devices but I think this method will work - plain old SSH.

Just use SSH with X forwarding on your tablet and it should be okay.

iriseth
Posts: 20
Joined: Sat Aug 24, 2013 4:03 pm

Re: HOWTO: Use Android Tablet as a screen / keyboard

Mon Dec 30, 2013 2:06 pm

hi, having issues with the usb0 interface. any hints how to make it working?

using wheezy with kernel 3.10.24+
and getting no such device when trying to bring up usb0 interface.

on the other hand, having dwc_otg bcm2708_usb: DWC OTG controller

thanks.

vslash
Posts: 6
Joined: Sat Feb 23, 2013 5:56 pm

Re: HOWTO: Use Android Tablet as a screen / keyboard

Thu Sep 25, 2014 10:52 am

A small patch :
/etc/network/interfaces :

Code: Select all

allow-hotplug usb0
auto usb0
iface usb0 inet static
        address 192.168.42.42
        netmask 255.255.255.0
        network 192.168.42.0
        broadcast 192.168.42.255
... is better, or you will loose the config btw each plug and will receive a "no route to host" 'cause your 'if' don't have any address, then, no route ...
Thanks,
v/

seths
Posts: 1
Joined: Fri Mar 27, 2015 8:48 pm

Re: HOWTO: Use Android Tablet as a screen / keyboard

Fri Mar 27, 2015 8:52 pm

Can you post a tutorial video on how to do this?

geertivp
Posts: 1
Joined: Sat Jul 18, 2015 7:23 pm

Re: HOWTO: Use Android Tablet as a screen / keyboard

Mon Jul 20, 2015 11:38 am

You can better enable DHCP on your Raspberry for the USB0 NIC:

Code: Select all

vi /etc/network/interfaces

allow-hotplug usb0
iface usb0 inet dhcp
The IP addresses are as follows:
  • Raspberry: 192.168.42.159
  • Android: 192.168.42.129
More information: http://elinux.org/How_to_use_an_Android ... net_router

svice
Posts: 14
Joined: Tue Jul 28, 2015 4:58 pm
Location: Rio de Janeiro, Brazil

Re: HOWTO: Use Android Tablet as a screen / keyboard

Tue Jul 28, 2015 5:14 pm

That's a pretty interesting tutorial. Thanks a lot.
I have another device connected to the RPI Ethernet port (with a different network setup) and I'm wondering if it will be possible to access it on the tablet usb using the RPi as a gateway usb0 -> eth0

Return to “Networking and servers”