Raspberry Pi

From Organic Design wiki
Revision as of 15:42, 15 February 2020 by Nad (talk | contribs) (Pi projects)
RaspberrypiAnim.png

The Raspberry Pi is a credit-card-sized single-board computer developed in the UK by the Raspberry Pi Foundation with the intention of promoting the teaching of basic computer science in schools. The Raspberry Pi is manufactured through licensed manufacturing deals with Element 14/Farnell and RS. Both of these companies sell the Raspberry Pi online.

The Raspberry Pi has a Broadcom BCM2835 system on a chip (SoC), which includes a 700MHz ARM11 processor (The firmware includes a number of "Turbo" modes so that the user can attempt overclocking, up to 1 GHz, without affecting the warranty), VideoCore IV GPU, and was originally shipped with 256 megabytes of RAM, later upgraded to 512MB. It does not include a built-in hard disk or SSD, but uses an SD card for booting and long-term storage. The Foundation's goal is to offer two versions, priced at US$25 and US$35. The Foundation started accepting orders for the higher priced model B on 29 February 2012, and the lower cost model A on 4 February 2013.

RaspberryPi.jpg

The Foundation provides Debian and Arch Linux ARM distributions for download. Also planned are tools for supporting Python as the main programming language, with support for BBC BASIC, C, and Perl. On 17 December 2012 the Raspberry Pi Foundation, in collaboration with IndieCity and Velocix, opened the "Pi Store", as a "one-stop shop for all your Raspberry Pi (software) needs". Using an application included in Raspbian, users can browse through several categories and download what they want. Software can also be uploaded for moderation and release.

How it came about

The original idea in 2006 was a response to the gradual drop in computing skills seen in students applying for computing degrees at Cambridge. Everyone knew how to use Microsoft Word, PowerPoint, Excel, Access; they didn't know much about coding, though, or what actually happened inside the machine.

Those familiar with schools in the 1980s will know they were full of BBC Micro computers, and everyone learnt how to write programs in BASIC. Computer games back then ran on computers that were practically built for coding, and plenty of amateur enthusiasts now work in the computer science industry. Sadly, as computers have become more complicated, school lessons have changed to train students in simple computer usage, without understanding what goes on underneath. The sheer complexity and expense of computers also means that kids aren't encouraged to fiddle with them, and purpose-built games consoles now dominate where Sinclair ZXs, Amstrads and Commodore Amigas once stood.

Thus, the solution: make a cheap but very capable computer that can be used in classrooms, that can be replaced easily if broken, and that lets you play with computer code whether at school or at home. Make it so it plugs into the TV at home, like computers used to do.

Installation with Raspbian

Raspbian is a Debian variant based on the ARM hard-float (armhf)-Debian architecture port but optimised for the ARM instruction set of the Raspberry Pi hardware. Raspbian provides over 35,000 available deb packages pre-compiled for easy installation on a Raspberry Pi computer, specifically tuned for optimal performance on the Raspberry Pi ARM hardware. The Raspbian distribution basically contains the LXDE desktop environment, the Openbox window manager, the Midori web browser, software development tools and example source code for multimedia functions. Raspbian is a project of a small, dedicated team of developers, and is not affiliated with the Raspberry Pi Foundation.

We use the Raspbian Lite which you can download from here. Lite is stripped down version of Raspbian with other software packages bundled as compared to the usual desktop-oriented Raspbian distribution which is best for headless servers.

Simply write the bootable Raspbian image to your SDcard with your favourite disk utility, and then add an empty file called "ssh" to the root directory of the boot partition which will ensure that youu have ssh access after the system is booted. If you also want to give it some default wifi connection details, add them in a file in the same place called wpa_supplicant.conf with the following format:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
network={
	ssid="WiFi_SSID"
	psk="WiFi_Password"
}
  • Note1: The wpa_supplicant.conf file will be copied into the /etc/wpa_supplicant directory, which is where it can be created or modified from after the system is up and running.
  • Note2: If you'd like the file to apply only to a specific network interface (in the case that you have more than one wifi adapter) you can name the file accordingly e.g. wpa_supplicant-wlan1.conf.


Put the card in the Pi and power it up. It will connect to the networks over LAN and/or wifi using DHCP. You can find it's IP with nmap, e.g

nmap -sP 192.168.0.0/24

Here's some example output showing the Pi's information:

Starting Nmap 7.70 ( https://nmap.org ) at 2019-09-17 13:00 -03
Nmap scan report for 192.168.0.1
Host is up (0.0040s latency).
MAC Address: CD:0E:DC:E9:B3:E3 (Cisco Spvtg)
Nmap scan report for 192.168.0.5
Host is up (-0.087s latency).
MAC Address: B8:31:EB:3C:5C:6F (Raspberry Pi Foundation)
Nmap scan report for 192.168.0.14
Host is up.
Nmap done: 256 IP addresses (3 hosts up) scanned in 3.60 seconds

If you want to give it a fixed IP, you can set this up using in your router's DHCP server using the Pi's MAC address. Once you have discovered the Pi's IP you can ssh into it with the default credentials of user name "pi" and password "raspberry". Then you can begin configuring it starting by removing the default password! One very useful thing you may like to do straight away is make your Pi into a wifi hotspot :-)

External drives

Adding external drives to be mounted on boot in the Pi seems to be a bit dodgy sometimes, I've been having problems with transfers of large data freezing after a few minutes and then the drive finally being remounted in read-only. I didn't get the errors from the log unfortunately, but so far I've found nofail,noatime 0 0 seems to give the best results for an external mechanical 2.5" disk (defaults, 0 2 was not good).

This problem was a power supply issue as syslog is showing a lot of under voltage warnings, when using a 1A cellphone charger, I tried a 3.1A "fast charger" from an African on the street which worked a bit better, but still ran nto the same problem. Eventually I found that you need to use an official Raspberry Pi power supply because they have 5.1v output to account for this voltage drop that happens regardless of the current your power supply produces.

PiBackie.jpg
NeedMorePower.jpg

One way of making the system less reliant on the SD card is to have it used only for initial booting and then use the external drive for root partition. This is set in the /boot/cmdline.txt file, see this for more detail.

Useful links

Other SBC options

See also