Exploring the Raspberry Pi through real-world projects
Pi Are Squared
The single-circuit-board Raspberry Pi computer, only as big as a credit card, makes it easy to gain experience with embedded Linux systems. We'll show you some hands-on examples of how to use the Raspberry Pi in an everyday environment.
British engineer Eben Upton and a team of like-minded hardware hackers started the Raspberry Pi project as a means for providing affordable computer technology for interested young people [1]. The objective was to develop and market a single-board, credit-card-sized computer compatible with the often-narrow budget of the target group (see the "History" box).
History
In 2006, Eben Upton and his team developed the first concepts for the Raspberry Pi based on the Atmel ATmega. The idea of getting young people interested in the mini-computer was already part of the program. In 2009, the members officially established the Raspberry Pi Foundation.
In August 2011, the alpha series of around 50 boards left production. They served primarily as a platform for developers, for debugging and for demonstration purposes. In December 2011, the beta series of 25 boards followed, which were already based on the production layout. The developers eliminated the last flaws. In an online auction in January 2012, 10 boards from this beta series were sold for a total of UK£ 16,336.
On February 29, 2012, at 7:00am Central European Time, the web servers of the foundation and of the two distributors were overloaded within a few minutes by the storm of requests. Many customers waited for hours to submit a pre-order.
If you find yourself reminded of the first home computers, you are not completely off-target: The explicit goal of the founders was to recolonize basements, garages, and classrooms with the spirit of the generation that had grown up with the Atari 400/800, ZX80/81, or VC20/C64.
Almost one year after the Raspberry Pi appeared, it is appropriate to look back over what has happened between the first series of approximately 10,000 pieces and the present status approaching 1,000,000 pieces delivered: How successful has the project been? What capabilities does the hardware offer? What is possible, and what is not (yet) possible? This article explores the Raspberry Pi system through three real-world projects:
- a multimedia, video playback system,
- a wireless access point, and
- an embedded temperature controller unit.
The first project is an example of the Raspberry Pi system serving as a replacement for a standard desktop computer. The latter two examples showcase the Raspberry Pi as an embedded system, which will require a little programming knowledge but, also, will give you a glimpse into the versatility of this mighty little mini-computer. Perhaps all three examples will help you imagine other do-it-yourself projects you could create with your own Raspberry Pi.
Shopping List
Originally, the designers had planned an A and B model, which were to differ mainly in the number of USB ports (one or two), the availability of an Ethernet port, and, of course, price (US$ 25/35). At this time, only model B is available. See Table 1 for a summary of Raspberry Pi components.
Table 1
Raspberry Pi Technical Data
Component | Type |
---|---|
SoC |
Broadcom BCM2835 (system on chip) |
CPU |
ARM1176JZF-S, 700 MHz |
GPU |
Broadcom VideoCore IV (OpenGL ES 2.0, OpenVG, 1080p30, H.264 high-profile encode/decode) |
RAM |
512MB of RAM |
Ports |
|
USB |
2 x USB 2.0 |
Ethernet |
1 x 10/100 Mbps |
SD/MMC |
1 x slot |
Audio |
1 x stereo analog out |
Video |
1 x composite out, 1 x HDMI out |
To get the Raspberry Pi (or RasPi for short) up and running, you need to make a list of the basic components. The Internet has more for tips on advanced operations [2] [3]. Currently, only two global distributors have the board in their catalog [4] [5]. Although delivery times of a few months were not unusual in the spring of 2012, you now generally only have to wait a few weeks.
Besides the board itself, you will need the following components:
- A USB power supply with no less than 700mA. If you want to power additional hardware through USB, you should plan at least 1 amp.
- An SD(HC) card with at least 2GB capacity; however, 4GB would be better. Depending on what you intend to do, that still might not be enough. Because the system is also housed on the SD card, it is advisable to choose a card with a high read and write speed.
- For wireless access, a WLAN adapter in the form of a USB stick would be practical. But in practice, a USB WLAN adapter is often a significant factor in power consumption. If you are considering using a USB adapter, be sure the driver is supported and choose a slim design that does not block the second USB port.
- In view of the low number of USB ports, a wireless keyboard and mouse would be a worthwhile investment that would also save unnecessary load on the limited resources of the USB power adapter.
In addition to these items, you will also need various cables, such as HDMI or Ethernet, depending on the planned use. As far as the HDMI cable is concerned, the shorter the better. You do have the option of increasing the output of the driver, but that also increases power usage. If you plan on listening to music or watching videos, you will also need headphones or speakers.
The third project (an embedded temperature controller) uses an expansion board that requires some additional hardware [6].
Getting Started
A Debian-based Linux distribution known as Raspbian is tailored for duty as an on-board operating system for Raspberry Pi. The Raspberry Pi foundation recommends the Raspbian "Wheezy" [7] release, which is used in this workshop.
Start by downloading the Raspbian "Wheezy" image file, which is a complete system image consisting of a 60MB boot partition and a root filesystem of around 2GB. Unpack the file and move it to an SD card with the following command:
$ sudo dd bs=1M if=2012-08-16-wheezy-raspbian.imgof=SD_card_device_filename
Now, plug the SD card, keyboard, mouse, and monitor into the Raspberry Pi system and boot by connecting the USB power supply. The configuration menu then appears, and if you are not using a standard English keyboard, it would be best first to change the settings under the menu items configure-keyboard and change_locale to the keyboard and language of your choice; otherwise, you will encounter problems as soon as the login is required. The default username is pi; the password is raspberry.
Other useful menu items include change_timezone, to set the correct time zone; ssh to enable safe access to the terminal via network; and expand_rootfs, to change the size of the root filesystem from 2GB to the actual size of the SD card. Finally, you should update the system in the typical Debian manner:
$ sudo apt-get update $ sudo apt-get upgrade
You can start the configuration tool anytime using sudo raspi-config
.
Project 1: Playing Video
Entering startx
will take you to the LXDE graphical desktop, which is optimized for lean systems. Playing an HD video is certainly the ultimate test for the hardware. The usual video players, however, are of no help because the GPU on the board is optimized for decoding audio and video data. Accordingly, you need a player that uses Broadcom's own program library (found under /opt/vc
). Currently, the only one that does that is the pre-installed command-line program omxplayer
[8].
If possible, simply mount the directory containing the files over your network. NFS offers faster access to your video collection, but SSHFS is less complicated. The appropriate packages are installed, as shown in Listing 1. You then start playback with the omxplayer
command.
Listing 1
Setting Up a Video Player
$ sudo apt-get sshfs $ sudo adduser pi fuse $ mkdir myVideos $ sshfs username@host_name:/directory_name myVideos
After a short hiccup in picture and sound, the software played the test HD video in 720p format with a 5.1 Dolby Digital audio track – of course, mixed down to two channels – without any jerkiness. And that's all as far as the spartan Omxplayer is concerned. The program does demonstrate impressive capabilities for decoding audio and video, but nothing more. There are also two more drawbacks: The video library mentioned above is not open source software, and you must purchase licenses for the MPEG-2 and VC-1 formats.
Energy use, on the other hand, is surprisingly low: The average load while rendering the HD video was only 3.8 watts, despite the demanding task of transmitting via the network. The programs Omxplayer, SSH, and SSHFS create the biggest load for the CPU and memory, whereas the player claims the larger share for itself. However, if you want to play HD video with 1080i or 1080p, it is worth connecting the network drive via NFS.
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Juno Tab 3 Launches with Ubuntu 24.04
Anyone looking for a full-blown Linux tablet need look no further. Juno has released the Tab 3.
-
New KDE Slimbook Plasma Available for Preorder
Powered by an AMD Ryzen CPU, the latest KDE Slimbook laptop is powerful enough for local AI tasks.
-
Rhino Linux Announces Latest "Quick Update"
If you prefer your Linux distribution to be of the rolling type, Rhino Linux delivers a beautiful and reliable experience.
-
Plasma Desktop Will Soon Ask for Donations
The next iteration of Plasma has reached the soft feature freeze for the 6.2 version and includes a feature that could be divisive.
-
Linux Market Share Hits New High
For the first time, the Linux market share has reached a new high for desktops, and the trend looks like it will continue.
-
LibreOffice 24.8 Delivers New Features
LibreOffice is often considered the de facto standard office suite for the Linux operating system.
-
Deepin 23 Offers Wayland Support and New AI Tool
Deepin has been considered one of the most beautiful desktop operating systems for a long time and the arrival of version 23 has bolstered that reputation.
-
CachyOS Adds Support for System76's COSMIC Desktop
The August 2024 release of CachyOS includes support for the COSMIC desktop as well as some important bits for video.
-
Linux Foundation Adopts OMI to Foster Ethical LLMs
The Open Model Initiative hopes to create community LLMs that rival proprietary models but avoid restrictive licensing that limits usage.
-
Ubuntu 24.10 to Include the Latest Linux Kernel
Ubuntu users have grown accustomed to their favorite distribution shipping with a kernel that's not quite as up-to-date as other distros but that changes with 24.10.