Table of Contents

Introduction

Chapter 1: Test Your Reactions

Welcome to the Embedded World!

Good Practice

Obtaining Components

An Interface Board

PiFace Digital

Setting up PiFace Digital

Installing PiFace Digital Software

Connecting PiFace Digital

Using the Emulator

Interfacing with Python

Turning a Light On

Reading a Switch

The Reaction Timer

Meet PiFace Digital’s Connectors

Connecting a Switch and an LED

Playing with the Reaction Timer

What Will You Interface?

Chapter 2: The Twittering Toy

Hacking the Toy

Building the Chicken

Wiring

Making It Talk

Using Espeak in Python

Testing the Espeak module

Making It Move

Creating Classes

Creating Objects

Testing As You Go

Connecting to Twitter

Building and Installing Python Modules

Talking to Twitter

Putting It All Together

Wrapping Up

More Ideas

Chapter 3: Disco Lights

Defining Your Sequence

Getting the Code to Do More

A Small Detour into Theory

Designing the Sequencer

Implementing the Sequencer

The Lights

Using Longer Strip Lights

Making the Lights Move

Designing the Circuit

Building the Circuit

Running the Circuit

Over to You

Appendix A: Getting Your Raspberry Pi Up and Running

Getting the OS on an SD Card

Connecting a Display

Connecting to a Network

Booting the Operating System

Powering Up!

Common Problems

If You Need More Help

Appendix B: Introductory Software Project: The Insult Generator

Variables

Strings

Lists

Functions

Conditional Behaviour

Making Your Own Functions

Creating Loops

More Raspberry Pi Resources

Some of the people who helped bring this book to market include the following:

Editorial and Production

VP Consumer and Technology Publishing Director

Michelle Leete

Associate Director–Book Content Management

Martin Tribe

Associate Publisher

Chris Webb

Executive Commissioning Editor

Craig Smith

Assistant Editor

Ellie Scott

Project Editors

Dana Lesh, Kathryn Duggan

Copy Editors

Dana Lesh, Kathryn Duggan

Technical Editor

Genevieve Smith-Nunes

Editorial Manager

Jodi Jensen

Senior Project Editor

Sara Shlaer

Editorial Assistant

Leslie Saxman

Marketing

Associate Marketing Director

Louise Breinholt

Marketing Manager

Lorna Mein

Senior Marketing Executive

Kate Parrett

Composition Services

Compositors

Carrie A. Cesavice, Jennifer Goldsmith

Proofreaders

Melissa Cossell, Dwight Ramsey

Introduction

You’ve got a Raspberry Pi – now what? This book has the answer; it’s packed full of fun Raspberry Pi projects to inspire you. From getting your Pi generating comedy insults, testing your reactions and building a talking animatronic toy that tweets to building your own disco light show, prepare to be entertained and amazed by your credit card–sized computer.

One word of warning: After you start you might never stop! Electronics and coding can be addictive; who knows what you might go on to make with the skills you learn from this book.

Appendix A, “Getting Your Raspberry Pi Up and Running”, is a beginner’s guide to your first steps with the Raspberry Pi. If you’ve never coded before, Appendix B, “Introductory Software Project: The Insult Generator”, will get you started programming in Python. Chapter 1, “Test Your Reactions”, will get you wiring up simple ­computer-controlled circuits. Chapter 2, “The Twittering Toy”, will show you how to make your code talk to Twitter and get you hacking household items. Chapter 3, “Disco Lights”, shows you how to control LED strips and make them dance in time to the music. Along the way you will pick up the skills you need to develop your own ideas to make projects work exactly how you want them to.

Building and making is incredibly rewarding and satisfying. We want to get more people of the world to become producers of technology rather than consumers. The projects in this book are starting points – step by step, they’re easy to follow so you can get results quickly. But then the real satisfaction can come, that which comes from making the project your own. At the end of each chapter there are ideas and suggestions to extend the project, together with background information to point you in the right direction. The real addictive fun begins when you see your own ideas become reality.

Welcome to the world of digital making.