I have followed a few sources on how to do this project but i found that there was some information missing at times and also had not been updated. I will try to bring the most recent version of this. These were the hardware and materials i used:
- Nexus 7 (2013) WiFi only version
- Raspberry pi 3 model B
- Rocksoul foldable USB keyboard (of course you can use any USB keyboard for this)
- Ethernet Cable
- 2 x Micro USB cables
- USB to wall charger
- Curiosity! and The urge to tinker with technology
Step 1: Prepare the Pi
I am going to assume that you have the OS installed on the Pi already, if not, here are some links to help you with getting NOOBS os installed on the Rpi:
Connect the ethernet cable to the pi and to your pc or mac (or linux - equality for all).
You will need a program to SSH into the pi. There are many other programs such as WinSCP that you could use but i found putty to be my favourite (not to say one is better) plus here is a handy link to get you started with. Connect to the Pi using putty. In the host type in email@example.com. Note that the hostname of 'raspberrypi' is the default name of the pi, you can change this later on.
When the prompt comes up for a password type raspberry (Again this can be changed later on).
For Mac and linux:
Open up the terminal and simple type in ssh firstname.lastname@example.org (see the picture to see what it should look like)
First we have to make sure that we can connect to the internet via wifi and also setup the usb connection for the monitor.
In the terminal type:
sudo nano /etc/network/interfaces
You will now be in the file to edit some connection settings. You can read up on what each does if you are truly interested but for the purposes of this project we will focus only on setting up the wifi and usb
NOTE: Somehow setting up the connection to the USB messes up the wifi where it sees 'No network interfaces' when you log in to the desktop (WEIRD!). Have not figured this error out yet but found a workaround and what it involves is knowing the wifi's name and password instead of scanning for the wifi network.
Type in the following information at the end of the file:
The first lines configure the wifi even though it may say its not connected and there are no wireless interfaces
iface wlan0 inet dhcp
iface default inet dhcp
This will configure the usb tether to use on the nexus. You will be setting a static ip for the usb connection.
iface usb0 inet static
Then in the terminal type:
sudo nano /etc/wpa-supplicant/wpa-supplicant.conf
From here enter your wifi information:
country=CA //NOTE THAT THIS IS FOR MY COUNTRY of CANADA, you can change it later on when you are on the desktop.
Do the following in the terminal:
After everything is updated, install x11vnc by typing
apt-get install x11vnc
After it is installed, set up a password to connect to your PI.
Type, x11vnc -storepasswd
Now you will want to autostart the vnc server every time the pi boots up. type in the following:
sudo nano .config/autostart/Xterm-autostart.desktop
This will create a file called Xterm-autostart.desktop. When the file opens type in the following:
Exec=x11vnc -forever -usepw
Hit ctrl+x and then press Y to save the changes
In the terminal you will need to edit one more file to get this autostart action happening.
sudo nano .config/lxsession/LXDE-pi/autostart
At the end of the file type the following: @x11vnc
Great! now you have the vnc server set up on the pi and ready for autostart every time it boots up and you are all ready for the nexus to be setup. Almost there!
Step 2: Setting Up the Nexus (or Any Android Device Actually)
The beautiful thing about android is the customisation. If you have an android device with USB tethering integrated into the OS then you can skip to the section where it says CONNECTING TO PI.
In the event you dont have USB tethering on the device, you can try to flash a rom on the device that has USB tethering. For me i used crDroid for my Nexus 7 and it works great (so far!). Here is the link if you want instructions on how to install crDroid and all the files.
CONNECTING TO THE PI:
Ok so now that you have USB tethering on the device, you need to download a few apps, precisely two. One to ssh into the pi and the other to remotely control it.
SSH: JuiceSSH or VX ConnectBot
Remote Control: VNC Viewer or bVNC Free
Now that you have those downloaded (i have used VX connect bot and VNC Viewer so i will explain the setup for those). Power up your Pi, connect your usb keyboard and android device to the pi. Turn on USB tethering (for me this setting was located under Settings > More > Thethering & portable hotspot. Once the hotspot is on, you can either ssh into the pi or VNC or why not both!?
Go to Vx connect bot and at the bottom type in the following: email@example.com
The address can be whatever you set it to be previously but in this example that was the IP address used. Once connected, it will ask you for the password which is 'raspberry'. Then it will lead you into the terminal for the pi where can do all the terminal magic you want for the pi.
Go to VNC viewier and add a new connection. In the address filed type in the following: 192.168.42.42:1
You can type anything you want in the Name field.
The :1 is important here. Then it should take you to your pi's desktop.
AND THAT's IT!
You now have a monitor for your pi.
Leave any questions for me in the comments. Glad to help troubleshoot!