Difference between revisions of "Raspberry Pi"
m |
(→Installation with Raspbian: arch wiki) |
||
(90 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
+ | [[File:RaspberrypiAnim.png|right]]The [[w:Raspberry Pi|Raspberry Pi]] is a credit-card-sized single-board computer developed in the UK by the [[w:Raspberry Pi Foundation|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 [[w:Element 14 (company)|Element 14]]/[[w:Premier Farnell|Farnell]] and [[w:RS Components|RS]]. Both of these companies sell the Raspberry Pi online. | ||
+ | |||
+ | The Raspberry Pi has a Broadcom BCM2835 [[w:system on a chip|system on a chip]] (SoC), which includes a 700MHz [[w:ARM11|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), [[w:VideoCore|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. | ||
+ | |||
+ | [[File:RaspberryPi.jpg|320px|right]]The Foundation provides Debian and Arch Linux ARM distributions for download. Also planned are tools for supporting [[w:Python (programming language)|Python]] as the main programming language, with support for [[w:BBC BASIC|BBC BASIC]], [[w:C (programming language)|C]], and [[w:Perl|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 [[w:Raspbian|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 == | ||
+ | [http://www.raspbian.org/ Raspbian] is a [[Debian]] variant based on the [[w:ARMhf|ARM hard-float (armhf)]]-[[Debian#Architecture Ports|Debian architecture port]] but optimised for the ARM instruction set of the Raspberry Pi hardware. Raspbian provides over 35,000 available [[w:deb (file format)|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 [[w:LXDE|LXDE]] desktop environment, the [[w:Openbox|Openbox]] window manager, the [[w:Midori (web browser)|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 [https://www.raspberrypi.org/downloads/raspbian/ 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 [https://wiki.archlinux.org/index.php/Wpa_supplicant wpa_supplicant.conf] with the following format: | ||
+ | <source> | ||
+ | ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev | ||
+ | network={ | ||
+ | ssid="WiFi_SSID" | ||
+ | psk="WiFi_Password" | ||
+ | } | ||
+ | </source> | ||
+ | *'''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{{h|-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 | ||
+ | <source lang="bash"> | ||
+ | nmap -sP 192.168.0.0/24 | ||
+ | </source> | ||
+ | |||
+ | Here's some example output showing the Pi's information: | ||
+ | <source> | ||
+ | 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 | ||
+ | </source> | ||
+ | |||
+ | 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. | ||
+ | {{table | ||
+ | |[[File:PiBackie.jpg|200px]] | ||
+ | |[[File: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 [http://banoffeepiserver.com/setup-raspbian-on-a-sata-hard-disk.html this] for more detail. | ||
+ | |||
+ | == Useful links == | ||
+ | *[[Pi projects]] | ||
+ | *[http://elinux.org/User:Nad My page on eLinux.org] | ||
*[http://learn.adafruit.com/downloads/pdf/reading-a-analog-in-and-controlling-audio-volume-with-the-raspberry-pi.pdf Analog Inputs for Raspberry Pi Using the MCP3008] | *[http://learn.adafruit.com/downloads/pdf/reading-a-analog-in-and-controlling-audio-volume-with-the-raspberry-pi.pdf Analog Inputs for Raspberry Pi Using the MCP3008] | ||
− | *[http://www.raspberrypi.org/wp-content/uploads/2012/04/Raspberry-Pi-Schematics-R1.0.pdf | + | *[http://learn.adafruit.com/adafruits-raspberry-pi-lesson-4-gpio-setup/configuring-i2c How to configure I<sup>2</sup>C] |
+ | *[http://www.raspberrypi.org/wp-content/uploads/2012/04/Raspberry-Pi-Schematics-R1.0.pdf RPi schematics] | ||
*[http://elinux.org/RaspberryPiBoard RPi Hub] | *[http://elinux.org/RaspberryPiBoard RPi Hub] | ||
*[http://elinux.org/RPi_Tutorials RPi Tutorials] | *[http://elinux.org/RPi_Tutorials RPi Tutorials] | ||
*[http://log.liminastudio.com/writing/tutorials/tutorial-how-to-use-your-raspberry-pi-like-an-arduino How to use your Raspberry Pi like an Arduino] | *[http://log.liminastudio.com/writing/tutorials/tutorial-how-to-use-your-raspberry-pi-like-an-arduino How to use your Raspberry Pi like an Arduino] | ||
+ | *[http://wiringpi.com Wiring Pi] | ||
+ | *[http://tutorial.cytron.com.my/2012/01/10/measuring-tilt-angle-with-gyro-and-accelerometer/ Measuring Tilt Angle with Gyro and Accelerometer] | ||
+ | *[http://elinux.org/RPI-Wireless-Hotspot How to set up a ad-hoc network with the Raspberry Pi] | ||
+ | *[https://medium.com/concerning-pharo/pharo-pi-9eef257b6a21#.ttz36xqz9 Pharo on the Pi] | ||
+ | *[https://www.youtube.com/watch?v=RoYZxaUZues Testing out e-paper options for the Pi] | ||
+ | |||
+ | == Other SBC options == | ||
+ | *[[Banana Pi]] ''- I also started checking out the Banana Pi'' | ||
+ | *[https://ownyourbits.com/nextcloudpi/#download Other more powerful options for a similar cost] | ||
+ | *[https://hackaday.com/2019/06/21/new-part-day-this-10-rocking-single-board-computer-does-everything-you-want/ Another tiny computer] | ||
+ | *[http://makezine.com/2015/11/28/chip-vs-pi-zero/ CHIP vs Pi Zero] | ||
+ | *[[Arduino with linux]] | ||
+ | |||
+ | == See also == | ||
+ | *[http://www.raspberrypi.org/about Raspberry Pi Foundation] | ||
+ | *[http://www.h2g2.com/approved_entry/A13735596 Introducing the Raspberry Pi] | ||
+ | *[https://www.w3schools.com/nodejs/nodejs_raspberrypi.asp Learn Raspberry Pi at W3Schools] | ||
+ | *[http://www.raspberrypi.org/archives/6561 Quake III bounty: we have a winner!] | ||
+ | *[https://developer.nvidia.com/jetson-tk1 Jetson TK1 Development Kit] | ||
+ | *[https://github.com/EthEmbedded/Raspi-Eth-Install Installing Ethereum on the Raspberry Pi] ''- see also [[Ethereum]]'' | ||
+ | *[https://www.raspberrypi.org/blog/raspberry-pi-zero/ Raspberry Pi Zero: the $5 computer] | ||
+ | *[https://hobbytronics.pk/raspbian-stretch-headless-setup/ Headless Pi] | ||
+ | *[https://ownyourbits.com/2019/02/02/whats-wrong-with-the-raspberry-pi/ Some bad points about the Pi] | ||
+ | *[http://ideaheap.com/2013/07/stopping-sd-card-corruption-on-a-raspberry-pi/ Software solution to harden against spontaneous power loss] | ||
+ | *[http://referencedesigner.com/blog/raspberry-pi-sd-card-power-off-corruption-and-solution/6662/ Hardware solution to harden against spontaneous power loss] | ||
+ | *[https://hackaday.com/2019/07/16/exploring-the-raspberry-pi-4-usb-c-issue-in-depth/ Exploring The Raspberry Pi 4 USB-C Issue In-Depth] | ||
+ | *[http://kamilslab.com/2017/02/15/how-to-backup-the-raspberry-pi-sd-card-using-linux/ Backing up and restoring the SDcard] | ||
+ | [[Category:Hardware]] |
Latest revision as of 15:57, 15 February 2020
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.
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.
Contents
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.
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
- Pi projects
- My page on eLinux.org
- Analog Inputs for Raspberry Pi Using the MCP3008
- How to configure I2C
- RPi schematics
- RPi Hub
- RPi Tutorials
- How to use your Raspberry Pi like an Arduino
- Wiring Pi
- Measuring Tilt Angle with Gyro and Accelerometer
- How to set up a ad-hoc network with the Raspberry Pi
- Pharo on the Pi
- Testing out e-paper options for the Pi
Other SBC options
- Banana Pi - I also started checking out the Banana Pi
- Other more powerful options for a similar cost
- Another tiny computer
- CHIP vs Pi Zero
- Arduino with linux
See also
- Raspberry Pi Foundation
- Introducing the Raspberry Pi
- Learn Raspberry Pi at W3Schools
- Quake III bounty: we have a winner!
- Jetson TK1 Development Kit
- Installing Ethereum on the Raspberry Pi - see also Ethereum
- Raspberry Pi Zero: the $5 computer
- Headless Pi
- Some bad points about the Pi
- Software solution to harden against spontaneous power loss
- Hardware solution to harden against spontaneous power loss
- Exploring The Raspberry Pi 4 USB-C Issue In-Depth
- Backing up and restoring the SDcard