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.
sudo apt-get install bridge-utils hostapd
wget http://dl.dropbox.com/u/1663660/hostapd/hostapd.zipunzip hostapd.zip
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)
auto br0 iface br0 inet dhcp bridge_ports eth0 wlan0
sudo nano /etc/hostapd/hostapd.conf
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
sudo hostapd -dd /etc/hostapd/hostapd.conf
sudo nano /etc/default/hostapd
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.sudo
mv
/etc/dnsmasq
.conf
/etc/dnsmasq
.conf.original
sudo
touch
/etc/dnsmasq
.conf
interface=wlan0
expand
-hosts
domain=
local
dhcp-range=10.0.0.10,10.0.0.20,24h
dhcp-option=3,10.0.0.1
sudo nano /etc/network/interfaces
Comment out or delete the part modified previously, then modify it as below. (section1)
#auto br0 #iface br0 inet dhcp #bridge_ports eth0 wlan0
iface wlan0 inet static
address 10.0.0.1
network 10.0.0.0
netmask 255.255.255.0
broadcast 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/