Iot Application (Raspberry quick start and internet connection setup)
Getting the web application hardware up and running takes a few steps regarding some internal setup , internet connectivity and SSH. Since raspberry is so popular , we can find many guides, forums, tutorials etc.
First of all, download and flash Raspbian:
- download Raspberrypi official site raspbian from the official raspberry site
- flashing operating system on the card with etcher
I choose raspbian lite since i do not need a graphical interface and other extra features.
Initial start of the Raspberry:
While Raspbian does not get installed per say , it is simply loaded and runned from the card. On the first run your user is pi and the password is raspberry.
You are now restricted to use a screen, and no internet via wireless connection just yet.
Access Raspberry configuration tool via:
I usually tend to do the following setup:
- change password
- expand file system (found under main screen/advanced options)
- enable ssh (found under main screen/interfacing options)
More elaborate description of these configuration options are found on the official page.
Connect to the internet:
Given the fact that i am using a Raspberry 3 which has a 2.4GHz 802.11n wireless, i am going to setup a wireless connection with a static address. Going with a static address and not a dhcp , is a good approach since most of the time i will interface with the Raspberry via ssh. Another thing to have in mind is that this setup also requires to do a bind in the router aswell. The static ip address you assign to the Raspberry needs to get binded with the its mac address. With a simple search over the internet by your router model that becomes trivial. You can find the mac address by typing in the raspberry`s terminal:
As a result you will get something like this, where wlan0 stands for wireless lan , and HWaddr is the mac address.
In addition ,since we are here (router config), you also need to open port 22, which is the default SSH port, for the ip address you want to assign to your raspberry. Again due to the broad diversity of routers is better to search how to do that over the internet , by your router model.
After you dealt with the router part, it’s time to add the connection details in the Raspberry like so:
- first of all ,open the interface configuration file in a text editor
sudo nano /etc/network/interfaces
- then edit the file similarly
# interfaces(5) file used by ifup(8) and ifdown(8)
# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
# Include files from /etc/network/interfaces.d:
iface lo inet loopback
iface eth0 inet manual
iface wlan0 inet static
address 192.168.0.110 -> DESIRED STATIC IP ADDRESS FOR YOUR RASPBERRY
netmask 255.255.255.0 -> COMMON NETMASK ADDRESS (CHECK YOUR ROUTER)
gateway 192.168.0.1 -> YOUR ROUTER NETWORK ADDRESS
wpa-ssid "YOUR WIRELESS SSID NAME"
wpa-psk "YOUR WIRELESS PASSWORD"
iface wlan1 inet manual
- hence the extra comments , you need to delete them in order to work properly
- hit ctrl+x to save
- and reboot your raspberry to get the interface restarted via:
Almost done, by now you should be online and rockin’. Just check again with ifconfig to make sure that you get inbound and outbound traffic (RX an TX in the wlan0 section should indicate a byte counter).
Finally to enjoy the flexibility gained through ssh , and get rid of the extra keyboard and screen that you need for running the pi, just download PUTTY ssh client and:
or use a linux terminal , this is my option since i am running linux on my laptop.
This setup seems a bit tricky for starters , but with basic knowledge regarding routers and a linux terminal becomes trivial.
Do you feel like you have missed something, try getting your bearings in the intro post for this project , since it also contains a so called glossary where you can access what part is especially relevant to you.