Raspberry

Everything you wanna know.

Raspberry

Raspberry Pi:

Everything related to Raspberry Pi is on this page.

I ordered everything I needed form Element14.

Here is the list of things that I ordered. (Oct 2015)

(Update 28-Nov-2018: Working now on Raspberry Pi 3 B+)

Qty Item Cost Per item Total
1 ELEMENT14 KIT-PI2-WHITE-STARTER RASPBERRY PI 2 MODEL B WHITE STARTER KIT $96.00 $96.00
2 SDSDQU-008G-BMUT,FlashMemoryCard,Ultra Series, MicroSDHC, UHS-1, Class 10, 8 GB, Raspberry Pi, Noobs $15.70 $31.40
2 PRO SIGNAL PS11074 LEAD, CAT 5E, 1M, BLACK $2.48 $4.96
2 PRO POWER PSU-RASPBERRY-PI-2A-5V AC/DC Power Supply, USB, 100 V, 240 V, 10 W, 5 V, 2 A $13.50 $27.00
1 ELEMENT14 KIT-PI2-MATHWORKS-STARTER-RPI RPI 2 & MATHWORKS LEARN TO PROGRAM PACK $232.95 $232.95
1 Raspberry Pi Sense HAT with Orientation, Pressure, Humidity and Temperature Sensors $47.98 $47.98
1 Raspberry Pi 7" Touch Screen Display with 10 Finger Capacitive Touch $96.63 $96.63
1 ADAFRUIT INDUSTRIES 922 MINIATURE WIRELESS USB KEYBOARD, RASPBERRY PI $65.78 $65.78
1 ADAFRUIT INDUSTRIES 814 MINIATURE WIFI MODULE, RASPBERRY PI $14.57 $14.57
2 SANDISK PRO SIGNAL PSG00049, Audio/Video Cable Assembly, 3.5mm Stereo Jack Plug, 3.5mm Stereo Jack P $5.75 $11.50
14 $628.77

******************************************************************************************************

You can buy SD cards preloaded with the Operating System (OS) but if you want, you can make your own too. All you need is a 8 GB SD card (micro SD for B+ model).

Make your own Raspbian

First download the software called SDformatter from here,install it and format your 8 GB SD card using this software.

Then download Raspbian from here. This is big and will take a while.

Then download win32diskimager from here.

Insert your SD Card in a card reader and then run Win32DiskImager.exe. It may give an error message on startup, but you can often ignore it. It should find your SD Card drive or if not select it. Select the file '#.img' Raspbian image file you wish to use and then press write. Once it completes you are ready to go, insert your SD card into the Raspberry Pi

******************************************************************************************************

No Wi Fi Module? No External Display? No Problem!

We can use ethernet cable. Actually it is better this way as the update/upgrade process is much faster.

Also do not worry if you do not have access to an external display. We can interact with Pi through computer.

Switch ON your Pi.

First step is to find out the IP address of your raspberry pi on the network.

For this, on your computer command prompt, type, ipconfig and press enter

Note the default gateway address for WiFi (e.g. 10.0.0.118)

enter this in the browser address bar and press enter.

You should now see the IP address of all devices that are connected to this WiFi network.

Note the address of the raspberry (e.g. 10.0.0.16)

Then download a software called Putty from here, install it and launch it... you will have to enter the IP host address.

Also, default login is "pi" and password is raspberry

Need Raspbian GUI display on your computer? No Problem!

....this is in continuation with the last step

Switch ON your Pi.

Then download a software called xming from here, install it and launch the server it will appear in task bar. Right click and see log to check that it is running properly

Launch Putty... you will have to enter not only the IP host address but also "Enable X11 forwarding" under CONNECTION >SSH

Now when shell window opens then at the $ prompt type the command "lxsession"

This will open a Raspbian GUI

Enjoy!

You can close the GUI from the shell window using CTRL+C

******************************************************************************************************

Access your RASPBERRY Pi over the Internet!

This part of the tutorial is based on https://www.raspberrypi.org/documentation/remote-access/access-over-Internet/internetaccess.md

You can connect to your Raspberry Pi over the Internet from another computer or a mobile device.

One method is to set-up port forwarding on your router. To set-up port forwarding you must change the configuration of your router to forward all inbound traffic from the Internet on a specific port to the local IP address of your Raspberry Pi. Most routers have this feature available. However, every router is different so you will need to consult your router's user manual for instructions. The settings can be tricky if your Pi is behind a firewall or more than one router. One disadvantage of port forwarding is that it exposes a network port on your private LAN to the public Internet. This is a known security vulnerability and must be managed carefully.

One secure alternative to port forwarding is the Weaved service. Weaved is software you install on your Raspberry Pi that lets you connect to your Pi from anywhere over the Internet. SSH, VNC, HTTP, SFTP file transfer and any other TCP service running on your Pi can be enabled for secure remote access over the Internet without port forwarding.

On your Pi (using a monitor or via SSH), update your Raspbian package lists:

sudo apt-get update

Install the weavedconnectd package:

sudo apt-get install weavedconnectd

Next run the weavedinstaller. The weavedinstaller will ask you to input your Weaved account user name (email) and password. You can create a Weaved user account here: https://developer.weaved.com/portal/index.php. After you have created an account, go back to the Pi command line window. Enter the command below to run the weavedinstaller on your Pi. Follow the on-screen instructions in the Pi terminal window.

sudo weavedinstaller

Your Weaved account is now a private Internet VPN connection service to your Pi without port forwarding. Access your Pi by logging in to your account at www.weaved.com.

For further assistance you may email support@weaved.com.

Note: lxsession does not run in this case

******************************************************************************************************

Working with preloaded NOOBS

Insert the SD card. Connect to TV through HDMI and switch ON

I had to setup the aspect/resolution of the TV to get the clear view

Note: The Micro SD card that came preloaded with NOOBS (OS) does not work for 7" touch screen straightaway

We will setup the touch screen after we setup the wireless network

Update 28-Nov-2018:

1. Preloaded OS works straight away on Raspberry Pi 3 B+

2. Boots straight into GUI

******************************************************************************************************

Wi Fi setup

If you do not have a Wi Fi dongle then skip to the next step and go to the following step named - 7" Touch Screen

This tutorial is based on:

https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=44044

_______________________________________________________________________________________

$ lsusb

Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 005: ID 0846:9041 Realtek Semiconductor corp. RTL8188CUS 802.11n WLAN Adapter

Last line shows that WiFi dongle is working

_______________________________________________________________________________________

$ lsmod

Module                  Size  Used by
snd_bcm2835            12859  0
snd_pcm                60411  1 snd_bcm2835
snd_seq                44988  0
snd_seq_device          4265  1 snd_seq
snd_timer              16257  2 snd_pcm,snd_seq
snd                    41809  5 snd_bcm2835,snd_timer,snd_pcm,snd_seq,snd_seq_device
8192cu                458649  0
...
and some more lines

Last line shows that WiFi dongle drivers are working

_______________________________________________________________________________________

$ifconfig -a

wlan0 Link encap:Ethernet HWaddr 00:00:aa:11:22:33
      BROADCAST MULTICAST MTU:1500 Metric:1
      RX packets:0 errors:0 dropped:0 overruns:0 frame:0
      TX packets:0 errors:0 dropped:0 overruns:0 carrier0
      collisions:0 txqueuelen:1000
      RX bytes:0 (0.0 B) TX bytes (0.0 B)

The first entry "wlan0"shows that correct firmware is loaded

_______________________________________________________________________________________

$ sudo nano /etc/network/interfaces

auto wlan0

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa-supplicant/wpa_supplicant.conf
iface default inet dhcp

#auto lo

The first line should have "auto wlan0"

Initially, "auto lo" was the first line but has been moved to last line and commented out

Note: some applications (e.g. python) work only when auto lo is present as first line

Most lines will already be present. Make changes accordingly

_______________________________________________________________________________________

$ sudo nano/etc/wpa_supplicant/wpa_supplicant.conf

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
        ssid="network-name"
        psk="network password"
}

The first two lines will already be present. You will have to add the rest

_______________________________________________________________________________________

$ sudo reboot

_______________________________________________________________________________________

$ ifconfig -a

This will now show that wlan0 has another line added to it which shows the inet addr as 10.0.0.someNumber

Also Rx and Tx bytes will also show some numbers greater than 0

This is good news!

_______________________________________________________________________________________

$ startx

This command will start the GUI if you are not in GUI already.

Open browser and open any webpage. It should work!

_______________________________________________________________________________________

******************************************************************************************************

Transfer files between Raspberry Pi and PC

Download the software calledWINSCP from here, install it and run it and enter the IP address of Pi.

If you want to use your phone hotspot and transfer files between PC and raspberry

On raspberry pi command prompt type

hostname -I

which will reveal your Pi's IP address as something like 172.20.10.5

Use this IP address in WinSCP

******************************************************************************************************

7" Touch Screen

$ sudo apt-get update

... lot of lines ...be patient

$ sudo apt-get upgrade

... even more lines ...be more patient

$ reboot

and that is it .... it sets the default display is 7" touch screen

You can also connect the Ethernet cable for faster performance.

******************************************************************************************************

Boot straight to GUI

$ sudo raspi-config

This will open another window where you can setup boot options

hit enter to see the following window

choose second option and save

rebooting will take you straight to GUI now!

******************************************************************************************************

KeyBoard Problem

When The Keyboard keys are not typing what they should be typing


$ sudo nano/etc/default/keyboard XKBMODEL=”pc105” XKBLAYOUT=”us” XKBVARIANT=”” XKBOPTIONS=”” BACKSPACE=”guess”

For example "Shift+3" will type the pound sign when it should be typing a # sign

I have edited second line. Previously it was set to gb.

Will need reboot.

******************************************************************************************************

Back to TV Display

When 7" Touch Screen has been activated after update and upgrade then how to go back to TV Display

Disconnect the ribbon cable connecting the 7" touch screen. Make sure the power supply is given directly to the Raspberry Pi board. Switch on and the display will now be your TV! There is no need to change any files!

******************************************************************************************************

Bluetooth Keyboard with built-in mouse

This is the kind of keyboard mouse combo that is supplied with Pi. Just attach the dongle to the raspberry Pi and actually it detects it straight away. You do not have to reboot also. But it is good to reboot anyway just in case.

Also if the mouse is not working properly then just switch OFF the bluetooth keyboard (there is an ON-OFF button on the keyboard) and then switch it back ON. This will fix the problem.

******************************************************************************************************

Changing between Super User and normal User

To become a super user type the following command

pi@raspberrypi ~ $  sudo su
root@raspberrypi:/home/pi#

To go back to the normal user... type the following command
root@raspberrypi:/home/pi# exit
pi@raspberrypi ~ $  

******************************************************************************************************

Changing brightness of 7" touch screen (in Raspberry Pi 3 B+ model only)

sudo sh -c 'echo "100" > /sys/class/backlight/rpi_backlight/brightness'