Free Sample
+ Collection

Raspberry Pi Cookbook for Python Programmers

Tim Cox

The Raspberry Pi Cookbook has over 50 tailor-made recipes for programmers to get the most out of Raspberry Pi using Python to unleash its huge potential.
RRP $26.99
RRP $44.99
Print + eBook

Want this title & more?

$16.99 p/month

Subscribe to PacktLib

Enjoy full and instant access to over 2000 books and videos – you’ll find everything you need to stay ahead of the curve and make sure you can always get the job done.

Book Details

ISBN 139781849696623
Paperback402 pages

About This Book

  • Install your first operating system, share files over the network, and run programs remotely
  • Unleash the hidden potential of the Raspberry Pi’s powerful Video Core IV graphics processor with your own hardware accelerated 3D graphics
  • Discover how to create your own electronic circuits to interact with the Raspberry Pi
  • Interface with purpose-built add-ons and adapt off-the-shelf household devices

Who This Book Is For

The aim of this book is to bring you a broad range of Python 3 examples and practical ideas which you can develop to suit your own requirements. By modifying and combining the examples to create your own projects you learn far more effectively with a much greater understanding. Each chapter is designed to become a foundation for further experimentation and discovery of the topic, providing you with the tools and information to jump right in.

Readers are expected to be familiar with programming concepts and Python (where possible Python 3 is used), although beginners should manage with the help of a good Python reference book and background reading. No prior knowledge of the Raspberry Pi or electronics is required; however for the hardware sections you will need some basic electronic components/household tools to build some of the projects.

Table of Contents

Chapter 1: Getting Started with a Raspberry Pi Computer
Connecting the Raspberry Pi
Using NOOBS to set up your Raspberry Pi SD card
Networking and connecting your Raspberry Pi to the Internet via the LAN connector
Configuring your network manually
Networking directly to a laptop or computer
Networking and connecting your Raspberry Pi to the Internet via a USB Wi-Fi dongle
Connecting to the Internet through a proxy server
Connecting remotely to the Raspberry Pi over the network using VNC
Connecting remotely to the Raspberry Pi over the network using SSH (and X11 Forwarding)
Sharing the home folder of the Raspberry Pi with SMB
Keeping the Raspberry Pi up to date
Chapter 2: Starting with Python Strings, Files, and Menus
Working with text and strings
Using files and handling errors
Creating a boot-up menu
Creating a self-defining menu
Chapter 3: Using Python for Automation and Productivity
Using Tkinter to create graphical user interfaces
Creating a graphical application Start menu
Displaying photo information in an application
Organizing your photos automatically
Chapter 4: Creating Games and Graphics
Using IDLE3 to debug your programs
Drawing lines using a mouse on Tkinter Canvas
Creating a bat and ball game
Creating an overhead scrolling game
Chapter 5: Creating 3D Graphics
Starting with 3D coordinates and vertices
Creating and importing 3D models
Creating a 3D world to roam in
Building 3D maps and mazes
Chapter 6: Using Python to Drive Hardware
Controlling an LED
Responding to a button
A controlled shutdown button
The GPIO keypad input
Multiplexed color LEDs
Chapter 7: Sense and Display Real-world Data
Using devices with the IC bus
Reading analog data using an analog-to-digital converter
Logging and plotting data
Extending the Raspberry Pi GPIO with an I/O expander
Sensing and sending data to online services
Chapter 8: Creating Projects with the Raspberry Pi Camera Module
Getting started with the Raspberry Pi camera module
Using the camera with Python
Generating a time-lapse video
Creating a stop frame animation
Making a QR code reader
Chapter 9: Building Robots
Building a Rover-Pi robot with forward driving motors
Using advanced motor control
Building a six-legged Pi-Bug robot
Avoiding objects and obstacles
Getting a sense of direction
Chapter 10: Interfacing with Technology
Automating your home with remote sockets
Using SPI to control an LED matrix
Communicating using a serial interface
Controlling the Raspberry Pi over Bluetooth
Controlling USB devices

What You Will Learn

  • Set up and run Raspberry Pi for the first time
  • Develop desktop applications, and handle images and process files with ease
  • Make use of graphics and user control to develop your own exciting games
  • Create 3D worlds by using the Raspberry Pi's powerful GPU
  • Discover how to create your own electronic circuits to interact with the Raspberry Pi
  • Use the Raspberry Pi Camera to create animations and timelapses
  • Design and build your own Raspberry Pi controlled robots
  • Take control of the real world and interface with physical hardware, combining hardware and software for your own needs

In Detail

The Raspberry Pi foundation has been selling their computers since 2012 with the aim of inspiring programmers and engineers.

Raspberry Pi Cookbook for Python Programmers is a practical guide for getting the most out of this little computer. It will guide you through the many uses of the Raspberry Pi and allow you to showcase the best it has to offer. Discover what the Raspberry Pi has to offer using detailed Python 3 examples that you can adapt and extend; see where your creativity takes you!

"Raspberry Pi Cookbook for Python Programmers" begins by guiding you through setting up the Raspberry Pi, performing tasks using Python 3 and introduces the first steps to interface with electronics. As you work through each chapter you will build up your skills and knowledge and apply them as you progress throughout the book, delving further and further into the unique abilities and features of the Raspberry Pi.

Later, you will learn how to automate tasks by accessing files, build applications using the popular Tkinter library and create games by controlling graphics on screen. You will harness the power of the built-in graphics processor by using Pi3D to generate your own high quality 3D graphics and environments. Connect directly to the Raspberry Pi’s hardware pins to control electronics from switching on LEDs and responding to push buttons right through to driving motors and servos. Learn how to monitor sensors to gather real-life data and use it to control other devices, and view the results over the Internet. Apply what you have learnt by creating your own Pi-Rover or Pi-Hexipod robots. Finally, we will explore using many of the purpose-built add-ons available for the Raspberry Pi, as well as interfacing with common household devices in new ways.

The "Raspberry Pi Cookbook for Python Programmers" will allow you to discover the vast range of abilities this micro-computer has. By following the clear examples you can pick up many new skills and arm yourself with the tools to create your own exciting and interesting projects.


Read More