Tutorial RaspberryPi: models – setup – first boot – configuration in a nutshell

A quick guide to the world’s cheapest and best-known Linux-ARM platform 

Models – Connections – Setup – Installation – Booting – Configuration commands – Linux commands – Tricks 

Introduction 

What is Raspberry Pi

Raspberry Pi was conceived from the idea of creating a low-cost computer. 

In particular, a card that is able to run a linux distribution with the minimum necessary resources, size and consumption.  It is a single-board computer, that is a computer implemented on a single electronic card. Born in the wake of the success of platforms such as Arduino, it wants to expand the concept of “open board” also to the world of computers. 

A success 

It is easy to think that because of the low cost (just 30-35€), the card has received wide acclaim all over the world.

 

 Like the Arduino board in the world of electronics, the Raspberry Pi soon became a point of reference in the computer world, first of all for students and prototypers, for young people, but especially for developing countries. 

With the card and a screen, in fact, you can provide computer literacy even in countries where schools would otherwise not be able to buy desktop computers. 

 

Models and versions 

Different versions/revisions of the board are on the market: from the first models (1A, 1A+, 1B, 1B+), to the most recent ones (2B, 3B, 3B+) and finally to the miniaturized ones (Zero, ZeroW). 

The main differences between the models are the amount of RAM memory and CPU speed.Visit Wikipedia for more technical data. 

 

The real cost 

Many will be thrilled to see that the price of bringing home a new computer is so low.. but be careful: buying a raspberry alone is not usually enough.

In fact, if you don’t have any devices to reuse at home, you should consider the connection of: 

  •  microSD memory card (at least 16Gb for sufficient performance) 
  •  screen 
  •  mouse/keyboard feeder 
  •  ethernet (if wifi with usb adapter) 
  •  heatsink and fan (I will explain later why) 
  •  powered usb hub 
  •  plastic houses 

The first 5 are necessary unless you want to connect via SSH / Remote Desktop protocol, and they will raise the price by no small amount. 

Let’s say that for a new location the total cost is around 120-150€. The price of raspberry only becomes convenient only if used or low-cost components are connected to it. 

In other cases, it is better to opt for a used netbook. In the field of prototyping the board is instead very cheap in relation to its computing power and power consumption. 

The Raspberry Pi are also winning in the IoT or embedded computing field, as they can perform an infinite number of tasks, even only via Ethernet or Wifi connection. They can therefore also be used in confined spaces or in situations of necessary low power consumption (it is even possible to power a raspberry with a single Ethernet cable via PoE and a micro usb adapter). 

Links/shortcuts 

The package 

The device looks like a normal prototyping board. The size is about 9x6cm, the weight is very small. The thickness is given only by the height of the usb doors, because there is no heat vent 

Many types of plastic casings are available for sale both transparent and color for a few euros. 

Very comfortable to avoid that in a prolonged use there is dust deposits and / or to protect it from possible shocks.

 

The memory 

The card provides the minimum necessary to run a Linux distribution. In particular, depending on the version, our raspberry will have with it a RAM memory of 256 / 512Mb or 1 GB.

 

But the main reason is that the operating system is stored and executed by the sd card at the same time as the data, so it is clear that the higher the speed of the sd card, the better the overall performance will be, but we must remember that it is not equipped with any physical memory, i.e. no hdd or ssd. 

In fact, the entire memory management is entrusted to a slot for SD cards (even sdhc) or micro SD depending on the model. Also, for this reason it is recommended to buy for the occasion also a sdhc card at least 16gb class 8-10. 

 Connections 

As for network connections, the latest versions on the market provide both Ethernet and integrated wifi.
The whole card relies on the bandwidth of an ethernet controller shared with two other usb ports. In addition to these ports, as you can see from the picture, there is a microusb input for power supply, an hdmi output, a coaxial (rca video for old analog TVs), an HDMI port and a 3.5* audio jack. 

*Note: each model has specific ports available

 

 

For a basic use the configuration stops here, but in reality, other connections are available, soldered on the board: 

  • I2C connector – GPIO pinout 
  • an input for the camera accessory 
  • an output for a compatible screen 
  • various 5v and 3.3v pins (the chip being an ARM) 

Go to the paragraph “Internal Connections” for more information. 

 

Power supply 

The card, with a basic setting, consumes very little. 

It requires, with s.o. started, only 3.5 – 5 – 8 W of current at 5V, depending on the settings (for a Raspberry ZeroW we are at 0.5 Ah). 

The power supply is through a micro usb port, and it can very well be provided by a very common cell phone usb power supply, as long as it is at 5V and with no less than 1-1.5-2.5 Ah (again depending on the settings and the connected devices). However, especially if an overclock is set, a power supply stabilized at least 2.5 – 3 Ah is recommended. 

 An easy way to have the board always powered and without the problem of power failure (which would cause a restart or even damage) is to use a usb hub (a method personally tested and currently in use). 

Many times the 2-4 USB ports alone are not enough for a more complete use (with wifi and mouse/keyboard the card is already full), so you have to use a multiplier. When choosing the model be careful to take one externally powered, i.e. that does not require power to the card but provides it. 

For example, if you intend to buy a Zero model, it is advisable to buy a Micro USB OTG adapter cable and a hub that may also be equipped with an Ethernet port. 

This is because the controller that manages the two usb is actually in common with the Ethernet port, and is not able to provide power for both peripherals and the hub. 

Connecting instead a model with power supply (at least 2-2.5A), we have the advantage to power all the peripherals we want, and at the same time, to power the raspberry too! 

In this way, leaving a common cell phone charger in the microusb, and connecting the hub we will have a sum of the two powers and we will even be able to overclock. 

First startup 

Installation 

The raspberry is shipped without any memory media. 

In order to start using it, we need to purchase an SD card (see paragraph “memory”). You must then install the operating system (OS) on the card. 

There are several Linux distributions (Ubuntu, Debian, Kde…), however, due to the Raspberry’s ARM processor, you will only be able to run some distributions created ad-hoc. On the manufacturer’s web page (Link), in the download section, you will find the best pre-tested and configured versions. Among these I would like to recommend Raspbian (the most installed and supported, easy to use) or Arch Linux ARM (for the most experienced). 

There is also a distribution similar to the famous (among hackers) Kali Linux, PwnPi (pwnpi.com). 

Once you download the package from the site, you have to unpack it and write it on the SD. 

 

Here is the fastest way to do it: 

 On Windows 

  • Extract the image file with a common un-zipper (e.g. Izarc) 
  • Install Win32DiskImager program (Link) 
  • Open it and load the iso on the sd card (to a possible corruption error give the ok) 

 On Linux-Mac 

  • Extract the image file 
  • Use the ImageWriter tool to write on sd 

 more complete and exhaustive guide can be found in the official Wiki. The OS is now installed on the SD card, we just have to insert it in the slot (taking care not to lock it in writing with the clip on the edge if a standard format) and continue with the configuration. 

 

Configuration and startup 

You can start the raspberry with two methods. 

1.Connecting mouse, screen and keyboard (in this case even without an ethernet connection, for example if we plan to connect it in wifi later). 

2.Connecting only the ethernet network cable (in this case we will need a second computer on the same network from which to make the configuration) 

  Connection with method 1 

If we decide to proceed with the first method, which is the easiest but requires more equipment, we should connect to the raspberry, in addition to the power supply and sd, also a screen and a keyboard/mouse.
As said it is not mandatory network connection in this case in order to perform the first configuration, however in order to perform the updates it is necessary to connect a network cable (with internet access) or have a Wifi available. Once started the raspberry should appear a screen similar to the one below:

 

Don’t worry, with a few commands we should be able to configure it. 

First let’s start by saying that Linux is actually already running, we don’t see the Desktop just because we haven’t started the graphical server (X server) yet. NOTE: in the latest versions of Raspbian the desktop will appear automatically. 

In case we are asked for the user or password, know that for the basic distribution (raspbian wheezy) they are preconfigured as: 

username:  pi 
password:   raspberry 

To start the Graphic Desktop then we have to write (not necessary in the latest versions): 

startx 

Before doing this, however, we could configure the raspberry to avoid doing it with the desktop already started, type: 

sudo raspi-config 

will open the Raspberry configuration panel. 

The Raspberry does not have an internal clock, so each time you start it, you will need to request the time from a server via the internet.
For this reason it is recommended to start the raspberry always connected to a network cable, to avoid having to manually enter the date and time. 

 

  Connecting with method 2 

In this case we will have the raspberry connected only through a network cable (to connect in this way a Raspberry Zero, you need an ethernet-micro usb adapter).  We will not have a screen connected to the HDMI of the card so we will have to access the Raspberry via a network protocol. 

You can do this using two methods, SSH or RDP (VNC).  To enable SSH it is necessary to insert in the root of the SD card containing the Raspberry operating system an empty file without extension called ‘ssh‘. 

SSH is a protocol that allows you to access the card terminal directly from a computer on the network. 

On Linux/Mac simply type the command: ssh pi@<IP address of the raspberry>. 

on Windows you can install the free program called PuttY.

Once connected, you will have the raspberry terminal available to run other commands or updates. 

 

The alternative is to use VNC to access the raspberry desktop ‘remotely’ (and then display it in a window on your computer). In this case you should install the VNC viewer software, and connect to the IP address of the raspberry. 

NOTE: many times the operating system on your raspberry will not have a ‘VNC server’ enabled by default. You will therefore not be able to proceed with this method without first enabling it by command (using SSH): 

sudo raspi-config 

Then search for the VNC entry and enable it. Restart (type ‘halt’ and disconnect/reconnect the power supply microusb) and try to access it again via the VNC Viewer. 

________________________________________ 

Configuration 

The Raspi-config 

The rasp config is a menu that allows us in a few simple steps to configure the basic settings for using the raspberry. 

It must be specified that any type of inappropriate modification could compromise the stability of the system or even corrupt it. 

WARNING: To avoid loss of personal data, make sure you have backed up your files before changing configurations. 

Please note: the settings are saved on the SD card currently running, so if you reinstall the s.o, you will have to redo the configuration from this menu. You can then set different parameters for different distributions on different cards. 

 

Basic procedures for old models (before model 3): 

internet connection via network cable is required 

1.First of all, I recommend to update the panel.  Scroll with the keyboard arrow to the last line: update  Press enter and wait for the update to finish. 

2.Later I recommend expanding the main partition to the entire SD card.  Scroll down and activate the option expand_rootfs.  In this way the storage memory available on linux will not be only 1Gb, but will cover the entire sd card (depending on its size). 

3.Another important thing is to set the keyboard layout.  This is because the original distribution is in English, and the keyboards vary from country to country.  To avoid writing one letter or symbol for another, you need to set the layout of your keyboard via the configure_keyboard menu.  To move through the options use the keyboard arrows, to select press enter, to confirm your choice press TAB, and then go to accept. 

4.To set the time zone, go to change_timezone menu 

 

Memory 

Depending on the version of raspberry you have, you will have a certain amount of RAM memory available. 

Since the raspberry does not have a dedicated video card, it will have to rest on the RAM itself. 

Depending on how you use it, you can set the amount of memory to “dedicate” to the video, through the menu memory_split.For basic (text) use, the original setting is more than fine, but if you need to use 3D graphics programs or watch videos at certain resolutions, it is advisable to allocate more memory. 

Choose the memory to be allocated from the recommended blocks under the input field, but keep in mind that the more memory for the video card, the less memory for the s.o., which can cause a crash in heavy multitasking situations. 

 

Automatic X start 

To avoid having to write “startx” at every boot, a special tool has been created to make the desktop appear. 

Go to the menu on boot_behaviour to enable automatic desktop startup. 

 

Overclock 

 As we know the raspberry processor is not a record, its frequency stops at about 700Mhz. 

The developers themselves then added a tool that allows you to choose the level of overclocking to apply to the processor. 

WARNINGS:

  • keep in mind that overclocking is always a dangerous procedure, and that in the long run it can lead to a reduction in processor life time. Overclocking the raspberry is very simple, just go to the overclock item, we will be faced with a list of possible overclocks. 
  • the higher the frequency, the higher the current demand will be. Apply a more powerful power supply. See paragraph Power supply. 

Many will be tempted to bring the overclock to the maximum, but from personal experience I do not recommend this choice, because with the slightest error could lead to corruption of the sd card, resulting in the necessary reformatting (and data loss). 

Personally I have a Raspberry Pi 1B with overclock set on High at 950 MHz for several months without problems, and I admit that the greater fluidity can be noticed. 

However, to extend the life of the processor, if you don’t have special needs even a Modest or Medium could be fine. 

The processor develops heat during use depending on the load applied and the board is supplied without any kind of heatsink. The manufacturers have announced that with normal use there is no need of heatsink, however if you apply overclock, my advice is to buy a heatsink with a few euros adhesive bottom, to avoid reaching high temperatures during use. To amplify the effect under prolonged use conditions (for example when using the raspberry as a network server), I suggest to mount also a 5v fan (for the connection see the paragraph “Internal connections”):

 

To confirm and save the configuration you just entered, you need to reboot the system.
Use the arrows to the < finish > option and press enter. The system will reboot, and the desktop should appear directly. 

 

Basic procedures for new models (Pi3 or Zero): 

In this case everything is very simplified. 

Once Raspberry is started, the desktop will appear automatically. 

To access all raspberry configurations (raspi-config) just open the raspberry panel from the system tray. 

Inside you will be able to select the amount of memory to entrust to the graphics card, or the CPU overclock. 

It will also be very easy to connect to a WiFi network, directly from Raspbian. 

 

________________________________________ 

Tricks and curiosities 

Linux Commands 

A short list of linux commands that might be useful in the first phase of use 

 

 Install program 

apt-get install < name > 

 Update kernel and drivers 

apt-get update 

 Start a graphical session (X server) 

startx 

 Login (user/password): 

-for pwnpi distro: root/toor 

-for rasbpbian: pi/raspberry 

 Shutdown: 

halt (and then disconnect power)  

[or] 

shutdown -h now 

 Entering raspberry config 

sudo raspi-config 

 Auto boot to desktop

(if not installed) apt-get install lightdm 

(or raspi-config tool) 

 Wlan scan and config 

iwlist wlan0 scan 

iwconfig 

 Wlan on-off device 

ifconfig wlan0 down (or up) 

 Check Linux Kernel version 

uname sweat -r 

 Reinstalling Grub 

sudo apt-get update 

sudo apt-get purge grub grub-pc grub-common 

sudo apt-get install grub-common grub-pc 

 Moving to folder 

cd < new path > 

 Change folder permissions (read and write from anyone) 

I sweat on 

chmod ugo+rwx < dir path/name > 

 Copying files 

cp file_from_copy.xyz directory_of_destination 

 Moving files 

mv < file path/name > < new file path/name > < new file path/name > 

 Deleting files 

rm < file path/name > 

 Delete folder (and internal files in cascade) 

rm -rf < dir path/name > 

 Operating System Release Update 

sweat do-release-upgrade -d 

Internal connections 

The card provides various input/output pins (GPIO). 

Each model has a specific configuration, we recommend a specific search. 

GPIO practical use 

To connect the fan to the +5v, you need a pin adapter and a soldering iron.
Connect the + to the pin at the corner (see diagram) and the – to the GND nearby. 

 Accessories 

A first accessory to be connected directly to the card has been released. 

It is a 5Mpixel camera that can record movies in Full HD at 1080p. Compatible with all models and revisions of the board. The price is very low and ranges from 20 to 30 euros. 

Why associate the Camera Module with Raspberry Pi? 
There are many reasons: one of the most important in prototyping is the fact that Arduino can’t “hold”, without external support, the capture of images and videos. There are several projects related to photography that use Arduino, but they need separate shields and supports. Raspberry Pi and Camera Module, together, are enough. 

Documentation and videos on how to connect it are available on the official website. 

 

 

Thanks for your visit to Spaceclick!

If you liked this tutorial, leave us a Like on Facebook 🙂 

Share on Social Media
Scroll to Top