The Raspberry Pi 3 Microcontroller is a very powerful mini computer and one of the most important features is that it incorporates a Wifi chip and can connect to a wireless network. It is the first step to access the potential of the Raspberry Pi and the first step towards the development of a home automation server, a connected object or a robot.
Prérequis : Configure your Raspberry Pi
Equipment
- Screen
- HDMI cable
- Keyboard
- Raspberry PI 3
- Micro SD card
- Mouse
- Micro USB charger B
Connect the Raspberry Pi to WiFi using the desktop
Once the Raspbian OS is installed you can connect the microcontroller to WiFi as on a PC via the desktop. All you need to do is activate Wifi in the task bar at the top right of the screen, select the network name (SSID) and enter the network key (WPA-PSK).
In some cases, it may be interesting to know how to connect WiFi via command lines on the terminal. This is what we will see here.
Connect the Raspberry Pi to WiFi using the terminal
Open the control terminal with the icon at the top left of the screen (or Ctrl + Alt + t). We will modify the configuration file wpa_supplicant.conf using the “sudo nano” function.
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
Once the file is open, edit the following lines at the bottom of the file.
- For a WPA/WPA2 key
network={ ssid="nomDuReseau" psk="cleReseau" key_mgmt=WPA-PSK }
- For a WEP key
network={ ssid="nomDuReseau" psk="cleReseau" key_mgmt=NONE }
- For an open network
network={ ssid="nomDuReseau" }
You can then enter the following command lines to activate the WiFi chip
sudo ifdown wlan0 sudo ifup wlan0
or (it may not work on some version)
sudo ifconfig wlan0 down sudo ifconfig wlan0 up
You can then restart your Raspberry using the command
sudo reboot
Your Raspberry should automatically connect to WiFi the next time you start it.
Next steps
Access your Raspberry PI remotely with Virutal Network Computing (VNC)