This quick post is on two important things in pi.
Enable wifi and connect to internet
Open the file for network interfaces, and look for a section called wlan0, or add this section-
vi /etc/network/interfaces
auto wlan0
allow–hotplug wlan0
iface wlan0 inet dhcp
wpa–scan–ssid 1
wpa–ap–scan 1
wpa–key–mgmt WPA–PSK
wpa–proto RSN WPA
wpa–pairwise CCMP TKIP
wpa–group CCMP TKIP
wpa–ssid “My Secret SSID”
wpa–psk “My SSID PSK”
The most important entries are wpa–ssid and wpa–psk. Update your network name and password here. The values are case sensitive.
Thats all. You can restart your pi and you should be able to connect to the wifi network.
$> sudo restart $> ping google.com
SSH into the raspberry pi from another box
Get your hostname/ip address from pi –
Use these commands on your raspberry pi console :
$> hostname $> ifconfig
Use this ip address to ssh into the raspberry pi from a different computer. Us the username pi to connect to pi. The default password is raspberry.
$> ssh pi@192.168.1.8
That should be all to ssh into your raspberry pi.
Debugging:
Sometimes you might see this error while ssh’ing into the pi.
ssh: connect to host 192.168.1.8 port 22: Connection refused
This should be due to –
- wrong userid/password
- wrong ip address
- ssh is not enabled on the pi
While the first 2 are straight forward, you might have to make quick changes on your pi for the 3rd cause.
$> sudo raspi-config
This should open a blue config screen and you could go to the advanced settings section, to find SSH connections enable/disable. Enable ssh on pi and exit. That should be all.
Pingback: How to create a raspberry pi powered car, remote controlled via mobile phone – ConfusedCoders