Author Archives: eben

Quake III bounty: we have a winner!

via Raspberry Pi

At the end of February, Broadcom announced the release of full documentation for the VideoCore IV graphics core, and a complete source release of the graphics stack for the BCM21553 cellphone chip. To celebrate, we offered a $10k prize to the first person to port this codebase to the BCM2835 application processor that sits at the heart of the Raspberry Pi, and to get Quake 3 (which already runs on the Pi) running on the newly open ARM driver, rather on the closed-source VPU driver. Our hope was that the ported driver would be a helpful reference for anyone working on a Mesa/Gallium3D driver for VideoCore IV.

Hands up if you spent far too long playing this when you were young.

I’m delighted to say that we have a winner. Simon Hall is a longtime Pi hacker, who also produced the first ARMv6-accelerated copies-and-fills library back in 2012 and wrote the DMA kernel module that we integrate in our Raspbian releases. The prize couldn’t have gone to a more fitting recipient.

So, without further ado, here are Simon’s instructions for getting the driver up and running.


You will need:

  • a Raspberry Pi, preferably a 512MB version, with the latest Raspbian
  • a network connection
  • a monitor capable of displaying 1080p
  • an SD card, at least 8GB (10GB is recommended)

We need plenty of space to build the kernel. Compiling will take around 12 hours, so it is helpful to overclock the Pi for this task. We also require the latest firmware, and the necessary packages we’re going to use to build the code.

Note: We’re going to use gcc 4.7, as the code generated is 10% faster than with 4.6. 4.8 is 10% faster still, but this is not available on Raspbian. If you cross-compile you can get better frame times.

Enter the raspi-config utility with:

sudo raspi-config

Expand the filesystem, set the overclock to at least medium (900 MHz), and reboot. Now perform an update with:

sudo rpi-update

and reboot again. We need to install several packages. Enter the following command to do this:

sudo apt-get -y install gcc make bc screen ncurses-dev g++-4.7 libsdl1.2-dev


Enter the following commands to retrieve the necessary software from GitHub:

git clone --depth=1
git clone
git clone
git clone


This will take around 10 hours with all kernel modules. Pruning the modules to the bare minimum can improve compile times if you wish. Enter the following commands:

cd linux
git apply ~/challenge/kernel/patch.diff
zcat /proc/config.gz > .config
make oldconfig
make menuconfig

Enter “general setup”, select “local version”, enter the string “simon” and then exit to the main menu and save. Now build the kernel with:

make ARCH=arm


Enter the following commands to install the new kernel:

sudo make ARCH=arm modules_install
sudo cp arch/arm/boot/Image /boot/kernel_simon.img
sudo su
echo kernel=kernel_simon.img >> /boot/config.txt
echo gpu_mem=128 >> /boot/config.txt

When the devices comes back up, verify that the new kernel is loaded with the following command:

uname -a

You should see something similar to this:

Linux raspberrypi 3.10.33simon+ #1 PREEMPT Sat Mar 22 09:49:59 UTC 2014 armv6l x


Enter the following commands to build the rest of the software:

cd ~/quake3
git apply ~/challenge/quake/patch.diff
cd ~/dma
cp ~/challenge/kernel/module/dmaer.c .

Next, verify that the module has installed with this command:

tail /var/log/kern.log

You should see something similar to this:

Mar 23 15:22:45 raspberrypi kernel: [ 20.814750] smsc95xx 1-1.1:1.0 eth0:lin1
Mar 23 15:22:45 raspberrypi kernel: [ 21.376702] bcm2835-cpufreq: switching td
Mar 23 15:22:45 raspberrypi kernel: [ 21.376710] bcm2835-cpufreq: switching td
Mar 23 15:22:46 raspberrypi kernel: [ 24.472575] Adding 102396k swap on /var/S
Mar 23 15:25:02 raspberrypi kernel: [ 143.984835] 20c00000 f2c00000 deadbeef
Mar 23 15:25:02 raspberrypi kernel: [ 143.984866] major device number 248
Mar 23 15:25:02 raspberrypi kernel: [ 143.984890] vma list size 12, page list 6
Mar 23 15:25:02 raspberrypi kernel: [ 143.984909] allocated dma channel 4(f208
Mar 23 15:25:02 raspberrypi kernel: [ 143.985242] qpu ENABLED
Mar 23 15:25:02 raspberrypi kernel: [ 143.985264] V3D identify test: V3D versi2

Now enter the following commands:

cd ~/challenge/source
sudo make install


First of all you must ensure that you have the Quake 3 Arena data files on your Pi. You require the ‘point release’ pak files installed. There are various ways to do this but you could either transfer them from another machine with SCP, or copy them across on a USB stick. Copy the files into a folder called ‘baseq3′. This should now contain pak files numbered from 0 to 8 (eg pak1.pk3).

Next, enter the following commands:

sudo mkdir /root/.q3a
sudo mv baseq3/ /root/.q3a/
cd ~/quake3/build/release-linux-arm/
sudo mknod char_dev c 100 0
sudo cp ~/challenge/quake/demo.cfg /root/.q3a/baseq3/


Enter the game folder with the following command:

cd ~/quake3/build/release-linux-arm/

Run the game using this command:

sudo ./ioquake3.arm +exec demo

If you wish to play the game after a reboot, you must run the following commands to re-load the necessary files:

cd ~/dma

If you see multi-second pauses of the game, this is because the system is paging to swap! You can see this by running top at the same time, and watch the swap usage jump during a spike. Close some running programs to alleviate this problem. Running the game without gdb and loading minimal kernel modules will prevent swapping.

A birthday present from Broadcom

via Raspberry Pi

Two years ago today*, the Raspberry Pi Model B went on sale, selling 100,000 units on the first day. Since then, over 2.5 million Raspberry Pis have found homes with hobbyists, children and professional engineers around the world.

Each Pi in this first pallet now has over 1250 friends.

The success of the Pi has allowed us to make substantial financial contributions to a range of open-source projects, including XBMC, libav, PyPy, Pixman, Wayland/Weston, Squeak, Scratch and WebKit, and we are continuing to sponsor projects like these. But it’s always felt like we have a piece of unfinished business.

In common with every other ARM-based SoC, using the VideoCore IV 3d graphics core on the Pi requires a block of closed-source binary driver code (a “blob”) which talks to the hardware. In our case, this blob runs on the VPU vector processor of the BCM2835 (the SOC or System On a Chip at the heart of the Raspberry Pi); our existing open-source graphics drivers are a thin shim running on the ARM11, which talks to that blob via a communication driver in the Linux kernel. The lack of true open-source graphics drivers and documentation is widely acknowledged to be a significant problem for Linux on ARM, as it prevents users from fixing driver bugs, adding features and generally understanding what their hardware is doing.

Earlier today, Broadcom announced the release of full documentation for the VideoCore IV graphics core, and a complete source release of the graphics stack under a 3-clause BSD license. The source release targets the BCM21553 cellphone chip, but it should be reasonably straightforward to port this to the BCM2835, allowing access to the graphics core without using the blob. As an incentive to do this work, we will pay a bounty of $10,000 to the first person to demonstrate to us satisfactorily that they can successfully run Quake III at a playable framerate on Raspberry Pi using these drivers. This competition is open worldwide, and you can find competition rules here which describe what you have to do, and how to enter.

We filmed a demo of a Raspberry Pi alpha board running Quake 3 back in 2011. It feels like it happened a lifetime ago.

This isn’t the end of the road for us: there are still significant parts of the multimedia hardware on BCM2835 which are only accessible via the blob. But we’re incredibly proud that VideoCore IV is the first publicly documented mobile graphics core, and hope this is the first step towards a blob-free future for Raspberry Pi: we’re continuing to work on that, and we hope you’ll come along with us!

* Okay, so sue us**: we launched on February 29.

** Please don’t sue us.

Vernier sensors and the Wolfram Language

via Raspberry Pi

Here’s another guest post from Allison at Wolfram Research. Today we’re looking at how to interface external sensors from Vernier Software & Technology to the Pi using the Wolfram Language.

Even though we only released the Wolfram Language on the Raspberry Pi a few months ago, Bob LeSuer is already a power user. He’s an Associate Professor of Chemistry at Chicago State University and is naturally a big proponent of incorporating technology into his teaching. In his lab classes, he uses instruments from Vernier, a company that creates a wide array of sensors for collecting data, from accelerometers and barometers to CO2 and pH sensors. But what particularly piqued our interest was that Bob came up with the idea to connect these sensors to the Raspberry Pi with the Wolfram Language! So of course we had to share.

Equipment you will need:

First, download the Vernier Software Development Kit for Linux and follow the instructions for unpacking the file. A few additional lines of code will need to be added to get it to run on the Pi.

In, add:


And to, add:


The following C code and MathLink template were used to create the functions getLibVersion, getDeviceInfo, and getSimpleMeasurements, which can be used in Mathematica. Download the two files and compile them with the following command:

mcc -o vernier vernier.c -I/usr/include/GoIO -lGoIO

Make sure the GoIO library is linked and that the /usr/include/GoIO directory is included in the search path.

And now, switching to the Wolfram Language, you can dynamically update the readings from your sensor with the following code:

link = Install["/mnt/documents/Pi/vernier/Vernier"]

Dynamic[{Column[{Row@StringSplit[getDeviceInfo[], ","][[{4, 5}]],
getSimpleMeasurement[]}], Clock[{1, 1}, 2]}]

The code will even continuously update with the appropriate readings as you swap sensors!

Similarly, you can make a plot update in real time, as shown below using a light sensor:

info = StringSplit[getDeviceInfo[], ","]

Dynamic@ListPlot[data, PlotLabel -> info[[4]],
Frame -> {True, True, False, False}, FrameLabel -> "Time (s)",
"Light " <> info[[5]]]

And this is just the start! There are an infinite number of ways now for this data to be analyzed and optimized with the Wolfram Language. You tell us—where would you go from here?

Bob’s web page also has some more great ideas for using the Wolfram Language and the Raspberry Pi for experiments (like building a spectrometer using Lego!).

More on Raspberry Pi in Africa

via Raspberry Pi

One of the biggest (and nicest) surprises for us over the last two years has been the Raspberry Pi project’s popularity outside the UK. Over three quarters of our sales are now to overseas customers, and while the US and mainland Europe are our largest markets (with honorable mentions to Australia, New Zealand and Japan), there’s also been a lot of interest from the developing world.

Robotics with Raspberry Pi at Kids Hacker Camp, iHub Nairobi. “Resistors are like parents”!

We’ve already posted about Frederik and Ernest’s epic Pi-powered journey from the UK to South Africa. Alongside this, over the last six months Graham Schwikkard has been working to get supplies of Raspberry Pis into hackspaces across sub-Saharan Africa.

young people programming in Scratch on a Raspberry Pi, Co-creation Hub, Nigeria

Programming in Scratch on a Raspberry Pi, Co-creation Hub, Nigeria

It’s a testament to the rapid pace of development in countries like Kenya and Nigeria that most of these engagements are commercial rather than charitable. While the first batch of Raspberry Pis sent to each location are free, the end goal is to enable local entrepreneurs to set themselves up as value-added resellers (VARs) and to build profitable businesses around the Pi.

It’s early days yet, but as you can see from these photos and videos we’re finding boundless enthusiasm for our little computer a long way from home.

Another Scratch alpha from Tim Rowledge

via Raspberry Pi

Last month we posted an alpha release of Tim Rowledge’s port of Scratch to a modern Squeak Smalltalk VM. Since then, he’s been beavering away fixing bugs, and we now have a new version for you to play with.

Please check out this forum post and share your feedback.


Modeling Physics with the Wolfram Language

via Raspberry Pi

Here’s another guest post from Allison Taylor at Wolfram Research. Today we’re looking at how to build simple physics models using the Wolfram Language.

If you’ve taken any introductory physics course, you’ve learned about Newtonian mechanics—conservation of energy and momentum, friction, harmonic motion, and so on. Idealized, classical motion can be broken down into a series of simple equations based on position, acceleration, and velocity. To derive these equations requires solving differential equations—something the Wolfram Language does very well with a function called NDSolve[].

For example, to model basic freefall, we just need to determine our initial conditions—acceleration y” is given by gravity, 9.81 m/s²; initial position is 150 m; and initial velocity y’ is 0. From these conditions, NDSolve[] can figure out the motion for a given range.




So, in the above case, if I dropped a ball from a height of 150m, it would take approximately 5 seconds to reach the ground. Simple! But we can take this a step further with a function called WhenEvent[]. If I were to try to model a bouncing ball by hand, for example, I’d have to reevaluate the equations of motion every time the ball reached an “event” or change in conditions. The ball is in freefall from the air to the ground—but I can’t rely on those same values to model the ball bouncing from the ground back into the air.

Using WhenEvent[] inside NDSolve[] lets you specify what happens when y[t]=0, or when the ball hits the ground. For this example, let’s say that when the ball hits the ground, it will reverse direction at 95% of its original speed. Now, every time the ball hits the ground, its velocity magnitude will continue to decrease by 5%. All inside one NDSolve[]—no more additional work for us!

   WhenEvent[y[t]==0,y'[t]->-0.95 y'[t]]},y[t],{t,0,10}];



Having these values automatically computed means we can also easily observe how energy changes over time. Take the values of position and velocity that are calculated and plug them into the classical equations for kinetic and potential energy:

   WhenEvent[y[t]==0,y'[t]->-0.95 y'[t]]},{y[t],y'[t]},{t,0,10}];

kin[v_]:=.5 v^2;

pot[y_]:=9.8 y;




The graph on the left shows the ball’s position, and the graph on the right shows the potential energy in red, kinetic energy in blue, and total energy in brown. Notice that the total energy decreases stepwise with each energy-dissipating bounce.

And further! What if the ball was not bouncing on even ground? What if, instead, the ball was bouncing down a flight of stairs? The same principles are used, with an additional a[t] specifying how many steps of width one the ball must drop down. When the ball reaches the end of the stairs, “RemoveEvent” is used to stop the condition from continuing to be in effect.

steps=NDSolve[{x''[t]==0,y''[t]==-9.8,y[0]==6,y'[0]==0,x[0]==0,x'[0]==1,a[0]==5,    WhenEvent[Mod[x[t],1]==0,If[a[t]>0,a[t]->a[t]-1,"RemoveEvent"]],
   WhenEvent[y[t]==a[t],{{x'[t],y'[t]}->.9 {x'[t],-y'[t]}}]},{x[t],y[t],a[t]},



And again, we can also model the energy alongside it, and have the Wolfram Language punch up the graphics using Reap[] and Sow[] to obtain the coordinates of the ball at each bounce.

   "RemoveEvent"]],WhenEvent[y[t]==a[t],{{x'[t],y'[t]}->.9 {x'[t],-y'[t]},



Event[] inside NDSolve[] can be used to model all sorts of processes—from friction models to signal processing, to even simulating the human heartbeat. It lets you visualize many complex environments in a simple, cohesive way. Try it out!

Ryanteck motor controller now available on Adafruit

via Raspberry Pi

Ryan Walmsley is one of our favourite people. Towards the end of last year he had a successful fundraising effort on Tindie for his RTK-000-001 low-cost motor controller kit. As part of his ongoing campaign of world domination (seriously, how many seventeen-year-olds choose a product namespace with a million possible entries?*), the kit is now available for sale on Adafruit’s website. If you’re in the US, want a low-cost way to drive a couple of DC motors from your Pi, and aren’t afraid of a bit of soldering, this could be the board for you.

Ryanteck motor controller board, fully assembled

* Assuming that number is in decimal. What if it’s hex? Yikes!

Accelerating Fourier transforms using the GPU

via Raspberry Pi

Andrew Holme is well known to regular blog readers, as the creator of the awesome (and fearsomely clever) homemade GPS receiver. Over the last few months he’s been experimenting with writing general purpose code for the VideoCore IV graphics processing unit (GPU) in the BCM2835, the microchip at the heart of the Raspberry Pi, to create an accelerated fast Fourier transform library. Taking the Fourier transform of a function yields its frequency spectrum (i.e. the pure harmonic functions which can be added together to reconstruct the original function). In the following example, shamelessly lifted from Wikipedia, we have a function which oscillates roughly three times per second, and whose Fourier transform unsurprisingly has a peak around 3Hz.

Being able to perform lots of Fourier transforms quickly is useful for all sorts of audio and radio applications including, unsurprisingly, GPS. Ham radio enthusiasts will also find Andrew’s work very useful. In this guest post, Andrew talks about his Fourier transform library for the Pi.

Last October, Eben attended the Radio Society of Great Britain (RSGB) Convention, where radio amateurs told him they wanted a speedy fast Fourier transform (FFT) library to do Software Defined Radio (SDR) projects on the Pi.

GPU_FFT is an FFT library for the Raspberry Pi which exploits the BCM2835 SoC V3D hardware to deliver ten times the performance that is possible on the 700 MHz ARM. Kernels are provided for all power-of-2 FFT lengths from 256 to 131,072 points inclusive.

GPU_FFT uses single-precision floating point for data and twiddle factors, so it does not compete on accuracy with double-precision libraries; however, the relative root-mean-square (rms) error for a 2048-point transform is less than one part per million, which is not bad.

The library runs on dedicated 3D hardware in the BCM2835 SoC, and communication between ARM and GPU adds 100µs of latency which is much longer than the shortest transform takes to compute! To overcome this, batches of transforms can be executed with a single call. Typical per-transform runtimes in microseconds are:

Points    batch=1    batch=10    batch=50    FFTW    Speedup
256 112 22 16 92 5.8x
512 125 37 26 217 8.3x
1024 136 54 45 482 10.7x
2048 180 107 93 952 10.2x
4096 298 256 240 3002 12.5x
8192 689 624 608 5082 8.4x
16384 1274 1167 1131 12005 10.6x
32768 3397 3225 3196 31211 9.8x
65536 6978 6703 6674 82769 12.4x
131072 16734 16110 16171 183731 11.4x

To get GPU_FFT enter the following at the command prompt:

sudo rpi-update && sudo reboot

To build and run the example program:

cd /opt/vc/src/hello_pi/hello_fft
sudo mknod char_dev c 100 0
sudo ./hello_fft.bin

API documentation can be found in the hello_fft folder.

Test Tim’s new Scratch alpha

via Raspberry Pi

Over the last year, we’ve seen big improvements in Scratch performance on the Pi. To date these have resulted from tweaks to the Scratch codebase and the addition of ARMv6-optimized blitting routines to the Squeak Smalltalk VM on which it runs. To give us the next uplift in performance, Tim Rowledge has been busy porting Scratch to a much newer version of Squeak, and he has a very early alpha (i.e. in-progress and therefore buggy) version for you to play with.

Please check out his forum post here and share your feedback.


Buy an 8GB NOOBS SD card for £5

via Raspberry Pi

When we announced our $40 Model B plus SD card bundle back in August, a lot of people asked us whether we could sell the card on its own. It’s taken a little while for us to get around to it, but I’m pleased to say that you can now buy an 8GB NOOBS SD card from the swag store for £4 including VAT, plus £1 UK shipping in the unlikely event you’re not buying other awesome swag.

The NOOBS SD card in all its glory.

This is the same high-speed Class 4 Samsung card that we ship in the bundle, and that we use at Pi Towers on a day-to-day basis. By my reckoning, even if you don’t care about NOOBS, this is currently the cheapest way to get a good-quality 8GB SD card in the UK.

Where do they make balloons?

via Raspberry Pi

Update: First aerial pictures are coming back from CLOUDY now. See below.

Today’s a big day for amateur high-altitude ballooning. Starting with a launch from OxfordshireBerkshire around 1100 UTC, Friends of Pi Dave Akerman and Anthony Stirk will be dropping tracked paper planes SLEET and SNOW over the low countries and Pi-based payload CLOUDY over Poland, before continuing eastwards as WANNAB1. As always, the Pi in CLOUDY will be transmitting slow-scan digital video (SSDV) footage for your viewing pleasure.

All the places Dave and Anthony will be visiting today

Follow along here:

The Earth from (not quite) space, taken from CLOUDY’s Raspberry Pi a few minutes ago.

Today also sees non-Pi flights XABEN 62 and Atlas 6 out of Suffolk, UK and SEBA-6 (Stratosferyczny Eksperymentalny Balon Amatorski – even my Polish is up to that one) out of Gliwice, Silesia, Poland. Judging by the live map SEBA-6 is already aloft, at 7km and climbing. More info on all these flights here. If you want to see more Raspberry Pi High Altitude Ballooning (HAB)…jinks, including Babbage Bear’s record-breaking high jump, check out the other posts under the HAB tag.

NOOBS v1.3.3 available

via Raspberry Pi

If you got a Raspberry Pi for Christmas, check out this post for some suggestions on how to get started.

The eagle-eyed among you may have noticed that the NOOBS minor revision number on the downloads page crept up by one at the end of the day on Christmas Eve. This release incorporates updated versions of Arch, Raspbian and Raspbmc.

Check out the release notes for each distribution for more details. Highlights for Raspbian include:

  • New firmware and 3.10 kernel, with numerous functionality improvements.
  • New hardware-accelerated X driver included and enabled by default.
  • Mathematica and the Wolfram Language installed by default.
  • Updated Scratch image.
  • PyPy 2.2, with incremental garbage collection.
  • Our new V4L2 camera driver, and an updated v4l-utils package.

Thanks to Dom Cobley (for firmware and kernel), Maciej Fijalkowski and Armin Rigo (for PyPy), Tim Rowledge (for Scratch), Vincent Sanders, Luke Diamand, David Stevenson, Tim Gover and Simon Mellor (for V4L2), Alex Newman and the Wolfram Research team (for Mathematica), Siarhei Siamashka and the fbturbo team (for X), Dave Higham (for Arch), Alex Bradbury and Peter Green (for Raspbian) and Sam Nazarko (for Raspbmc).

This release was coordinated by Andrew Scheller, who will be handling NOOBS releasing from now on.

If you have any problems with NOOBS by all means ask here, we’ll try to help, but it’s probably better to head over to the forums.

Web browser beta

via Raspberry Pi

Update: Several commenters note that installing this beta can break various other elements in the system. It’s probably worth backing up your SD card before trying it out.

One of the goals we’ve been working towards with our friends at Collabora over the last few months is the provision of an up-to-date, HTML5-capable web browser for the Pi. In particular, we aim to support:

  • A good multi-tab experience
  • ARMv6-optimized 2d rendering
  • Accelerated image and HTML5 video decoding

The plan is to provide a port of the confusingly-named Web web browser (formerly Epiphany) in future Raspbian releases. Now, just in time for Christmas, we have a very early beta for you to play with.

Several tabs open with 157MB of resident data

Most of the work that has been done so far, over and above porting Web to Raspbian, revolves around memory footprint optimizations to support a usable number of tabs on the 512MB device without swapping. We haven’t finished the various acceleration tasks yet, so you’ll have to wait until the New Year to see a version which uses OpenMAX pipelines for media decode and has additional Pixman and Cairo assembly language fastpaths.

We inherit Webkit’s HTML5 standards support, including Canvas

If you’d like to have a play with the browser in its current state, you’ll need to add the following line:

deb wheezy web

to /etc/apt/sources.list, and then type:

sudo apt-get update; sudo apt-get upgrade

sudo apt-get install epiphany-browser cgroup-bin libraspberrypi0 libwayland-client0 libwayland-cursor0 libwayland-server0a

Start the browser from the applications menu, “Internet”, “Web”. If you are feeling particularly adventurous, our new kernel supports cgroups which the browser can use to receive notification of impending out of memory (OOM) events, allowing it to preemptively deallocate resources. To enable cgroups, add the following to your kernel command line:


Happy surfing!

Gert plays Santa Claus

via Raspberry Pi

Gert, creator of the Gertboard and Gertduino, and all-round good egg, has really been getting into the Christmas spirit this year. He’s designed the world’s simplest Raspberry Pi add-on board – a 5×5 matrix of LEDs driven directly from the GPIO pins which I’m going to christen the Gertenlights.

The assembled Gertenlights in all their glory

Yesterday he brought 100 parts kits into the Broadcom office and announced a lunchtime “matrix grab”, prompting a good fraction of us to descend on the kitchen to collect our free toys. Going to break out the soldering iron this evening.

The ravening hordes descend on the kitchen. Andrew Holme, of homebrew GPS fame is in profile on the left.