Science Experiments with RPii

Welcome to the RPii Project by Sam Cockton.

Introduction to the RPii Project

This project aims to provide a useful and interesting teaching resource for teachers teaching physics and science, while also giving interested students the resources to explore how computers can be used in science. To hold true to the aims of the Raspberry Pi Foundation this project aims to expose the flexibility and power of using computers in science experiments and will hopefully help students realise that computing is very accessible from a young age. This project has produced a library (libRPii) which simplifies writing programs for the Wiimote, and tutorials about how to get started with programming in C. Similar packages (like WiiPhysics) exist which use the Wiimote to plot a graph of the Wiimote’s outputs on Windows machines, however these packages are written in C# and are not accessible to explore with a Raspberry Pi.

This project provides a package which gives students and teachers the resources they need to interface with the Wiimote in the C programming language. By linking the teaching and learning resources with the education syllabus, I hope that the resources provided by this project will provide the classroom with a new way to look at experiment design using computers in such a way that students will be inspired to look into the exciting world of computer science. Learning to write your own computer programs can be frustrating at first, and so part of this project has been to produce a series of tutorials, documents and teaching resources. These resources are designed to take anybody with any level of programming experience (even complete beginners), to a point where they can use the libRPii library to produce applications of their own. In addition, the RPii Motion Logger application, which uses the library, is available to use as soon as you have downloaded and installed the library. This means that even if you havent got the time to learn how to program in C, you can still benefit from the resources that this project has provided, and can start exploring physics straight away.

What is a library of computer code?

A library is simply a collection of code that somebody has written to perform particular tasks. In computing, every operation that we want the computer to execute must be written in a way that the computer understands. Take mathematical operations on a calculator for example (as a calculator is a kind of computer). When we type in 3 × 4 how does the calculator know how to control the electrical signals inside of its processor in order to give an answer which it can interpret? The answer is that somebody else, the person that designed the calculator, wrote some programming code which gives the calculator a series of instructions that if it follows, will give the correct answer. If every time somebody wanted to use a multiplication in a computer program, they had to rewrite the complicated code, then a lot of time would be wasted rewriting what everybody else is also writing. To be efficient, when one programmer finds a way of coding a particular task, they save their work and just copy the same code every time they want to use it again. Often, this work will be useful to other people working on similar topics and so programmers collect all of the code they have written for a particular purpose and make it available to everybody—often by putting it on the Internet. These collections of prewritten code are called libraries—like a library for books, they contain all the information you may need for a particular task. When you download an operating system onto your Raspberry Pi, it comes with hundreds of libraries available to use; so that you can add, multiply, print sentences to the screen or open files without having to write the code to do those tasks yourself. These allow you to make use of somebody else’s contribution to the programming community, so that you can get on with writing the programs that you want to write.

What you need

To start to explore interacting with the Wiimote you need:

  • A Bluetooth dongle (preferably with a Cambridge Silicon Radio chipset).
  • A Raspberry Pi.
  • A Wiimote
  • A screen, keyboard and mouse.

Each experiment will require extra resources, please see each relevant experiment’s documentation.

Documentation sections

Table H.1 – Documentation Sections
Section ID Section Description
GS Getting Started Assuming that you have written an operating system image to an SD card and finished the set-up, this section describes how you can get the RPii resources onto your Raspberry Pi.
C C Tutorial This is a guide to C programming for complete beginners. It introduces all of the key concepts used in the libRPii library, and will get you up to scratch with understanding C code.
Scroll to Top
Read previous post:
Raspberry Pi Quick Start

This is a basic setup guide, written by Isabell Long. Originally designed for under 10s, it covers the basics of...