Posts: 6
Joined: Thu Apr 20, 2017 5:40 am

Accessing Android Camera from Pi using USB Tethering

Wed Apr 26, 2017 10:48 am

I post this since I could not find any information about above connection to
use an old/unused Android Phone's Camera via RPI. Most of the tutorials I found
are describing the installation of the RPI's camera modul and the rest is covering
the use of an external USB Camera. I also tried 'motion' and 'usbip' without success.
(both are looking for '/dev/video' devices which where not created with tethering).

Rooted Android Phone with 'IP Webcam' and 'busybox' installed.

1) Android
cd /system
edit 'build.prop' (to disable MTP):
search for 'persist.sys.usb.config' and edit the value to 'adb'. This is very important
because MTP tries permanent to connect to your RPI and will disconnect your tethering connection!

2) RPI
edit /etc/network/interfaces:

allow-hotplug usb0
iface usb0 inet static

activate 'forwarding':

echo 1 > /proc/sys/net/ipv4/ip_forward

3) Connect your Phone with USB cabel to your RPI and activate 'USB Tethering'.
Start the app 'IP Webcam'.

4) Login in your RPI with 'ssh' and check if the 'usb0' interface with IP ''
was created (with 'ifconfig').

5) Connect to your phone with 'adb shell' and check if the 'rndis0' interface with the
IP '' was created. (with 'busybox ifconfig').
Add the gw from your RPI:

busybox route add default gw dev rndis0

6) LAN Clients
Create the gw to your RPI:

route add default gw 10.0.0.X dev wlan0

In your browser open the camera with ''
(the port must be defined in your 'IP Webcam' app).

You can also reach your camera via WAN over VPN.

My Network:
Android > USB > RPI ''
LAN Clients > WLAN > RPI ''

Greetings from Vienna

Return to “Graphics, sound and multimedia”