My Raspberry PI

Currently I own 2 Raspberries, RPI2 and RPI3. I’d like to share my set-up with you. You can treat it also as a guide to how to set up your device, connect to a PC, and use similar to mine profiles.

To start, you will need:

  • LAN cable
  • Router with Ethernet
  • Alternatively a PC instead of the router with a free Ethernet port and internet connection.

Format your SD card and download latest Raspbian from the Raspberry PI website. Unzip the file and install the iso file on your SD card. I use rufus software, it is lightweight and free. Connect the LAN cables, then power cables, make sure your SD card is inserted, plug in the power. Your RPI will boot.

Unless you want to go old-school and connect a monitor via HDMI and mouse and keyboard, you will be using a headless (remote access) client. Within a minute your RPI will be up and running. It will also obtain the IP from the router automatically. To check the IP log in to your router (192.168.0.1 or similar – check the box) and look  for devices connected via ethernet. You can also use a mobile and an app called Fing (mobile must be connected to the same router).

See connectivity tutorial video

Once you have the RPI’s IP you can download and open Putty, a Windows SSH client which I use to connect to RPI. You will need to provide your IP, the default port is 22. Also go to SSH options and select X11 forwarding.

[box type=”info”]username: pi

password: raspberry [/box]

Before you will start doing anything

[code language=”bash”] sudo raspi-config
[/code]

This will open the Config file on a RPI. To get more space we need to expand our partition to the entire SD card. Option 1 will do this automatically for you.  As of 2016-05-18 partition is expanded automatically, on set up and this is no longer required. For security, change your password as well. If you wish to add a custom host name – go to advanced options and name your device. You will be asked to reboot your RPI once this is done.

Installation

To make sure your RPI is up to date run:

[code language=”bash”] sudo apt-get update
[/code]

and then:

[code language=”bash”] sudo apt-get upgrade
[/code]

This will update your board, and you will be ready to rock! Before you will install more programs lets download TightVNCserver to make sure you have an access to RPI Desktop as well.

[code language=”bash”] sudo apt-get install tightvncserver
[/code]

Note sudo apt-get install is a command to install software from provided repositories.  Do this then execute the program.

[code language=”bash”] sudo tightvncserver
[/code]

Set your password and you are ready to connect to the remote desktop. We can also enable copy and paste  from PC to RPI using autocutsel:

[code language=”bash”] sudo apt-get install autocutsel
[/code]

Then navigate to the directory using nano (equivalent of a notepad) – bear in mind you have to run tightvncserver at least once before this step.

[code language=”bash”] sudo nano /root/.vnc/xstartup
[/code]

Add a line to the document opened:

[code language=”bash”] autocutsel -fork
[/code]

And click Ctrl+X to close, and save when prompted. Another thing I do with my RPI is to assign custom forwarding port and configure the SSH for use with AutoRemote.  Changing the default port number increases your network security. Open the config file using nano:

[code language=”bash”] sudo nano /etc/ssh/sshd_config
[/code]

And add this line at the end of file

[code language=”bash”] KexAlgorithms diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1
[/code]

You can see a tutorial on Raspberry PI and Phone connectivity here

Your RPI is ready now to install  some other libraries. At this stage you can also remove unused files to increase space available. You could save up over 1GB of files, unless you are interested in keeping the programs below. Nothing stops you from installing these later. This should decrease time of your future updates, and lower the size of your back up file.Untitled-1

[code language=”bash”] sudo apt-get remove –purge libreoffice* wolfram-engine scratch minecraft-pi sonic-pi dillo gpicview penguinspuzzle
[/code]

And then run

[code language=”bash”] sudo apt-get clean
sudo apt-get autoremove
[/code]

After this I’m installing libraries I use so far:

[code language=”bash”]

#sudo apt-get install python-scapy tcpdump arp-scan wakeonlan python-dev python-rpi.gpio socket python-mutagen python3-mutagen
sudo apt-get install python-scapy
sudo apt-get install tcpdump
sudo apt-get install arp-scan
sudo apt-get install wakeonlan
sudo apt-get install python-dev
sudo apt-get install python-rpi.gpio
sudo apt-get install socket
sudo apt-get install python-mutagen python3-mutagen
[/code]

Additional libraries installed for DHT11 Temp&Humidity sensor:

[code language=”bash”] git clone https://github.com/adafruit/Adafruit_Python_DHT.git
cd Adafruit_Python_DHT
sudo apt-get update
sudo apt-get install build-essential python-dev
sudo python setup.py install
[/code]

Once everything is done, simply reboot your RPI:

[code language=”bash”] sudo reboot
[/code]

Raspberry PI 2 & Raspberry PI 3

[tabs] [tab title=”Raspberry PI 2″]

Currently RPI2 is being used to code on, and play with the sensors. It is turned off most of the time, unless I play with it.

[/tab] [tab title=”Raspberry PI 3″]

RPI3 is responsible for waking up my PC from sleep, and running network projects. It is not used for now with any sensors. I will be sharing more information soon!

[/tab][/tabs]