WiFi connection to the internet

From NP Tracker projects
Revision as of 17:41, 2 August 2020 by NPTracker (talk | contribs) (Created page with "Your NPS-ANPR will connect to the NPS servers online to test and notify you of any lookouts, to do this the Raspberry Pi should first be connected to your internet. ==Connecti...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Your NPS-ANPR will connect to the NPS servers online to test and notify you of any lookouts, to do this the Raspberry Pi should first be connected to your internet.

Connecting to your Raspberry Pi (first time)

First step is connecting your Raspberry Pi in order to get to a terminal.
You can do this by connecting your Raspberry Pi to a monitor and keyboard – or connecting via Ethernet cable.

Login to the Raspberry Pi with the default NPS-ANPR user credentials:

   Username: pi
   Password: nptracker

Getting your network information

For the purpose of this guide we will be connecting to a WiFi network with the following information:

   SSID (Network Name): Test Wifi Network
   PSK (Password): SecrectPassWord

Every time you see this network name and password in the guide you need to change them to the network name and password of your local network.

If you need to find the network name of your local network you can run the following command in the Raspberry terminal:

sudo iwlist wlan0 scan

This will list all the networks in your vicinity along with some useful information for each network. To find your network name look for something that look like: ESSID:”Test Wifi Network”.

Configuring your WiFi network

To tell the Raspberry Pi to automatically connect to your WiFi network you need to edit a file called: wpa_supplicant.conf.

To open the file in mcedit type the following command:

sudo mcedit /etc/wpa_supplicant/wpa_supplicant.conf

Scroll to the end of the file and add the following to the file to configure your network:

network={
  ssid="Test Wifi Network"
  psk="SecretPassWord"
}


Remember to replace this with your own network name and password.
Save and close the file by pressing [F2] followed by [F10]. At this point the Raspberry Pi should automatically connect to your network.
You can check your network connection by running the following command:

ifconfig wlan0

If the output looks something like this (with an inet addr) you are connected:

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
       inet 192.168.0.166  netmask 255.255.255.0  broadcast 192.168.0.255
       inet6 fe80::30ee:6d8b:385b:520b  prefixlen 64  scopeid 0x20<link>
       ether dc:a6:32:b4:66:32  txqueuelen 1000  (Ethernet)
       RX packets 191  bytes 25003 (24.4 KiB)
       RX errors 0  dropped 0  overruns 0  frame 0
       TX packets 85  bytes 13815 (13.4 KiB)
       TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Sometimes the Raspberry Pi will not connect automatically and require a reboot to connect.
If it doesn’t connect after waiting 2-3 minutes try to reboot the pi using the following command:

sudo reboot