Last time I used Android phone as a keyboard and mouse to remotely control the RPi X-server, but it required WiFi connection to login the RPi if I need to control the terminal.
This time I tried to make RPi work as an access point to directly communicate with Android phone.
- hostapd settingsInstall hostapd package.
Get hostpad that is for the RTL8188CUS chipset which is used for Edimax EW-7811Uh.sudo apt-get install bridge-utils hostapd
Replace the hostapd that is installed with the package.wget http://dl.dropbox.com/u/1663660/hostapd/hostapd.zipunzip hostapd.zip
If eth0 and wlan0 need to be bridged, edit the interfaces file.sudo mv /usr/sbin/hostapd /usr/sbin/hostapd.original sudo mv hostapd /usr/sbin/hostapd.edimax sudo ln -sf /usr/sbin/hostapd.edimax /usr/sbin/hostapd sudo chown root.root /usr/sbin/hostapd sudo chmod 755 /usr/sbin/hostapd
sudo nano /etc/network/interfaces
Modify the file as below. (after the part related to wlan0)
Create hostapd.conf fileauto br0 iface br0 inet dhcp bridge_ports eth0 wlan0
Add the following lines.sudo nano /etc/hostapd/hostapd.conf
Run hostapd and see if network is detected by Android phone.interface=wlan0 driver=rtl871xdrv bridge=br0 ssid=[NETWORK NAME] channel=6 wmm_enabled=0 wpa=1 wpa_passphrase=[PASSWORD] wpa_key_mgmt=WPA-PSK wpa_pairwise=TKIP rsn_pairwise=CCMP auth_algs=1 macaddr_acl=0
Modify hostpad file if you want to run hostapd at the startup.sudo hostapd -dd /etc/hostapd/hostapd.conf
Uncomment "DAEMON_CONF" in the file and add the path to the file.sudo nano /etc/default/hostapd
Reboot the system and see if hostapd is automatically run.DAEMON_CONF="/etc/hostapd/hostapd.conf"
sudo shutdown -r now
- dnsmasq settings
hostapd is to make it RPi as access point.
Now, we install dnsmasq to automatically assign the IP address to the clients.
Install dnsmasq.sudo apt-get install dnsmasq
This will automatically start the dnsmasq, so stop it.sudo service dnsmasq stop
Create the new configuration file.
Edit the file as below.sudomv/etc/dnsmasq.conf/etc/dnsmasq.conf.originalsudotouch/etc/dnsmasq.conf
Edit the interfaces file again.interface=wlan0expand-hostsdomain=localdhcp-range=10.0.0.10,10.0.0.20,24hdhcp-option=3,10.0.0.1sudo nano /etc/network/interfaces
Comment out or delete the part modified previously, then modify it as below. (section1)
Reboot the RPi#auto br0 #iface br0 inet dhcp #bridge_ports eth0 wlan0
iface wlan0 inet staticaddress 10.0.0.1network 10.0.0.0netmask 255.255.255.0broadcast 10.0.0.255
sudo shutdown -r now
- Connecting the Android phone to RPi
After rebooting RPi, you will see the network name on your phone.
Connect to the network and make sure the IP is obtained.
Then, launch the SSH apps and try login RPi.
I used "ConnectBot" app.
You can also use "Simple Computer Remote" app to control the RPi once X-server is started.
Raspberry Pi
EW-7781Uh WiFi dongle
PS Vita Portable Charger
Summary:
RPi is now connected to an Android phone directly without WiFi network.
This will allow me to access to RPi at anywhere.
Reference:
http://willhaley.com/blog/raspberry-pi-hotspot-ew7811un-rtl8188cus/
http://ariandy1.wordpress.com/2013/04/07/setting-up-wifi-access-point-with-edimax-ew-7811un-on-raspberry-pi/