Skip to main content

Raspberry Pi Hardware Projects 2




Raspberry Pi Hardware Projects 2

Andrew Robinson, Mike Cook

ISBN: 978-1-118-58890-1 October 2013 296 Pages


Raspberry Pi is a UK Non Profit with the goal of creating a new generation of computer programmers. Observing how the UK Tech Industry was kickstarted by the availability in the 1980s of relatively cheap, very programmable computers such as the ZX81, the Commodore and the BBC Micro, the Raspberry Pi Foundation designed a £15/$25 computer which encourages the user to play and to learn. Although intended for schools, it has also been adopted by hackers and geeks, and a whole ecosystem of software and hardware is being built around the Pi. With a million boards now sold, the goal of the Foundation is well underway.

Introduction 1


Computer-Controlled Slot Car Racing 3

Obtaining a Slot Car Racer 4

Hacking Your Slot Car Racer 4

Testing Your Slot Car Racer Hack 6

Getting the Player Input 7

Making the Joystick Buttons 7

Boxing It Up 12

Joystick Testing 16

The Software 18

The Game 20

Over to You 27


Facebook-Enabled Roto-Sketch 29

The Concept 30

Rotary Encoder Types 30

The Encoder Output 31

Posting to Facebook 40

Using Flickr 40

The Final Roto-Sketch Program 44

Creating a Symmetrical Pattern 50

Over to You 56


The Pendulum Pi, a Harmonograph 59

The Concept 61

The Hall Effect 61

Enter the Arduino 63

Putting It Together 64

Smooth Swinging 69

Electronics 71

Programming the Arduino 76

The Final Arduino Code 81

Programming the Pi 89

Using the Pendulum Pi 94

Over to You   96


Getting Your Raspberry Pi Up and Running 97

The Operating System 98

Getting the OS on an SD Card 99

Premade Cards  99

Creating Your Own SD Card 100

Connecting Your Raspberry Pi  104

Connecting a Display 106

Connecting via HDMI 107

Connecting via DVI 107

Connecting via VGA 109

Connecting via Composite  109

Connecting to a Network 110

Booting the Operating System 111

Powering Up!  113

The Boot Process 114

Starting the Graphical Desktop 114

Starting a Terminal under X 115

Troubleshooting 115

Common Problems 115

No Lights Come On 115

Only the Red Light Comes On 116

No Monitor Output 116

Intermittent Problems 116

Power Problems 116

If You Need More Help 117

Let the Fun Begin! 118


Introductory Software Project: The Insult Generator 119

Running Your First Python Program 120

Saving Your Program 123

Generating an Insult 126

Variables 126

Strings 127

Lists 127

Functions 128

Insult Your Friends by Name! 129

Conditional Behaviour 131

Create a Stream of Insults! 131

Making Your Own Functions 131

Creating Loops 132

for Loop 133

while Statement 134

Putting It All Together 135