Thursday, May 8, 2014

Enabling SSH and WiFi dongle on Raspberry Pi

This was done from a fresh RPi, therefore the first thing we do is updating all the applications, then upgrading. Following step we enable the SSH and then we install the application that manage the wifi conection. Finally we enable the wifi con conect automatically once power has come up, therefore enabling an SSH conection after a remote reboot.

1. Follow this video tutorials for SSH

  • apt-get update
  • apt-get upgrade
  • reboot
  • sudo raspi-config
select from menu : "expand filesystem" then "Advanced Options" and then "SSH" --> Enabled --> "Finish"


  • reboot
  • sudo ip addr show
Now you should be able to SSH to you RPi using the IP address shown in the line that starts with "inet 192.168.X.Y   ....."


On your computer do:

  • ssh pi@192.168.X.Y  (Y is your wired address)
  • type password for "pi" user (Note the default is "raspberry")
2. Now we want to plug out Wifi Dongle and have it wirelessly connected, following this tutorial do:

  • sudo apt-get install wicd-curses
  • sudo wicd-curses
Select your wifi network, if it doesn't show then hit the key "P" (preferences)
and type "wlan0" in the field  "wireless interface" hit F10 to save

Select your Wifi network, hit the right arrow to configure:
check static IP
type the IP address following the same skim as your router gateway: i.e:
IP: 192.168.X.Z      (Z is going to be your static wireless address- pick any number)
Mask: 255.255.255.0
Gateway: 192.168.X.R   (R is the ip address of your router)
at the bottom on key type your wifi password
hit F10 to save

After some seconds it will connect, you can unplug the wired cable and verify a remote SSH to the new wireless IP address
  • ssh pi@192.168.X.Z
  • type password

3. Now to allow the wifi conection to come up automatically after a remote reboot do:
  • sudo nano /etc/network/interfaces
Change it to this:

auto lo
iface lo inet loopback 
#Remove the wired network because it
#slows down boot if it's not connected.
#auto eth0
#iface eth0 inet dhcp 
allow-hotplug wlan0
auto wlan0
iface wlan0 inet static
address 192.168.1.20 #(IP address of RaspyFi)
netmask 255.255.255.0
gateway 192.168.1.2 #(IP of router)
wpa-ssid MyWirelessNetwork
wpa-psk MyPassword
4. You are all done, SSH to your wirelessly connected RPi and reboot to test the feature of auto connection after booting.

5. To disable the power saving feature of the wifi module we follow this page

The problem seems to be that the adapter has power management features enabled by default. This can be checked by running the command:
cat /sys/module/8192cu/parameters/rtw_power_mgnt
A value of 0 means disabled, 1 means min. power management, 2 means max. power management. To disable this, you need to create a new file:
sudo nano /etc/modprobe.d/8192cu.conf
and add the following:
# Disable power management
options 8192cu rtw_power_mgnt=0
Once you save the file and reboot your RPi, the WiFi should stay on indefinitely.

No comments:

Post a Comment