Raspberry Pi in the NoIR - Part VI - go wireless
If you don't know what this blog is about, go to Part I to find out.
Reconfigure the Pi network settings:
Unpack the router from the box and connect to power. Make sure your Pi is connected to the internet via an ethernet cable for the moment. This is where it gets a little complicated.
Log in to your Pi and find the supplicant file. Remember to change the IP address to your specific one. You will also need root permissions.
> ssh firstname.lastname@example.org
> sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
This will open the supplicant file in a text editing program called nano. Nano is an easy text editor to start with because it provides user prompts down the bottom. If you are more comfortable with something like VIM feel free to use that.
At the bottom of the supplicant file you will add the following:
Remember: the TP-Link info referred to in the first network commands can be found on your TP-Link info card inside the box. The password is an eight digit number. This is telling the Pi to always try and establish a link with the router before trying the priority 2 network.
Remember: the priority 2 network is any other network you may want to connect to often. Say work or home.
Once you finish typing, exit the Nano editor by pressing CTRL + X. Type "Y" to save settings and hit enter.
Reconfigure the network settings and reboot.
> wpa_cli -i wlan0 reconfigure
> sudo reboot
> sudo shutdown now
Reconnect to the Pi via ssh. Type:
> sudo rfkill unblock wifi
> sudo iwlist wlan0 scan
Now you should see your Pi unit show up in the list of SSIDs.
Connect to the Pi via your wireless router:
Disconnect the Pi from the ethernet cable. Keep the router on and powered. In your laptop wifi settings, select the TP-Link network. It will have the same name as the information on the information card you used to write the code above. Connect to the network and enter the password.
Next, open a web browser and go to the tplinkwifi.net website. It may take a few minutes to connect. Once the webpage loads, you will see a menu on the left side. Select the DHCP Client List tab. Here you will find the router's IP address. You should also see your Pi unit name in the DHCP list with a specified IP address. Note: the IP specified by the router will be different to the IP address you had been using for your Pi previously. Keep note of this IP address - it is how you will ssh into the Pi in the field.
Connect to the Pi through the router using ssh and the new IP address.
> ssh email@example.com
Note: the above IP is made up, you will need to insert your own here. Enter your password when prompted. You should see the Raspberry Pi welcome messages.
Well done! You may now install the scripts to control the Pi lights.