Book Image

Raspberry Pi Embedded Projects Hotshot

Book Image

Raspberry Pi Embedded Projects Hotshot

Overview of this book

Table of Contents (20 chapters)
Raspberry Pi Mechatronics Projects HOTSHOT
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Preface

The Raspberry Pi is a quaint example of technological innovations that come by once every two or three decades and set off a revolution that touches every aspect of human life from scientific exploration to entertainment to education. What is exciting this time around is that there are several such innovations happening simultaneously. They might sound like, and are in a way, buzzwords, but they are in fact real, and are changing our lives in so many ways, so few of which we are consciously aware of. We are speaking of innovations in entrepreneurship, such as crowdsourcing or the emergence of DIY with an almost cult-like following to innovations in technology that are current, such as 3D printing and Internet of Everything, and innovations that are impending such as 4D printing, smart manufacturing, and much more.

The Raspberry Pi has already found several uses as evidenced by hundreds of websites, project examples, and crowdsourcing campaigns. People have used the Pi to build robots, teach programming, restore old gaming consoles, stream videos, collect data, and do many other things. The Pi itself has gone through design iterations and continues to spur competing systems. People have taken advantage of this and have hooked up the Pi to many different ecosystems, expanding its ubiquity and utility.

The purpose of this book is to help those who are excited about the Raspberry Pi and have project ideas in mind, or would simply like to get their hands dirty and practice implementing projects so that they can then use that knowledge for other endeavors. We tried to take a practical approach, introducing the Pi in the first couple of project that you can skip if you are familiar with the Raspberry Pi and have used it before. We then discuss projects of increasing complexity. We have also attempted to diversify the projects to demonstrate various uses for the Pi throughout the book.

What this book covers

Project 1, Hello World, will introduce the Raspberry Pi and remind you of things that you should know as you proceed through the book. We will set up the Raspberry Pi and blink an LED.

Project 2, A Raspberry WebIDE Example, will take you through Python development using a browser. We will use the Adafruit WebIDE and lead you through the development process using Adafruit products as props for the examples.

Project 3, The Arduino Raspberry Pi Interface, is inspired by the Harry Potter series, and in an effort to show our love for this series, we have created a clock similar to the innovative and endearing Weasley clock using the Raspberry Pi and an Arduino. This project, of course, allows the clock to report back weather conditions.

Project 4, Christmas Light Sequencer, discusses holidays as the best time for DIY projects, and if you are ever starved of ideas, holidays are the best time to cook up ideas. We picked a Christmas-themed project to demonstrate controlling appliances connected to a local network using Raspberry Pi.

Project 5, Internet of Things Example – An E-mail Alert Water Fountain, follows the theme of the previous project. We will show you how to control a decorative fountain such that anytime you receive a new e-mail, your fountain's light will flash an alert (this can also be switched to receive Twitter alerts).

Project 6, Raspberry Pi as a Personal Assistant, will show you how you can use the Pi as your personal assistant, reminding you of chores, setting alarms, and doing everything at your command.

Project 7, Raspberry Pi-based Line Following Robot, will take you through the simplest of all robots, the line following bot, with Raspberry Pi at the helm. This project will show you the way for this and other complex robotics projects you wish to implement.

Project 8, Connect Four Desktop Game using Raspberry Pi, follows the instant-classic theme for the Raspberry Pi, which includes games. All manners of gaming applications, including the revival of archaic games to new ones and mods, are being created using the Raspberry Pi. We will implement the game using a push button interface.

Project 9, The Raspberry Pi-enabled Pet/Wildlife Monitor, will walk you through a fun example of a bird feeder monitor that allows you to trigger a photo capture each time the bird approaches the feeder. You can think of extending this to other pets, or say, the feral cats in your colony.

Project 10, Raspberry Pi Personal Health Monitor, is a project where we set up a simple web server to record our personal health parameters, build a simple tool to remind ourselves to remain physically active, and remind ourselves to refill a prescription via e-mail alerts.

Project 11, Home Automation using Raspberry Pi, is a project where we will show you how to control appliances using a twisted network where the appliance is connected to a platform such as an Arduino. The Raspberry Pi acts as a server that controls all such nodes in the network.

Project 12, Using a Raspberry Pi for Science and Education, is a project packed with examples, including a vocabulary learning tool, a web host for Khan Academy, and a windmill generator science exhibit. Have fun learning and teaching!

Project 13, Tips and Tricks, is a project packed with tips and tricks that will help you use the Raspberry Pi!

You can also get the videos, tips and tricks, and many more things related to the projects at http://diywithpi.com/.

What you need for this book

To get started, you will need the Raspberry Pi, a monitor, a keyboard, a power source, and preferably, a laptop or personal computer running on any OS—Windows, Linux, or Apple. Other hardware and software recommendations are made in the individual projects, and you are welcome to replace them with what you see fit. A working knowledge of Python is preferred, but not required.

Who this book is for

This book is primarily aimed at hobbyists and do-it-yourself enthusiasts as well as those looking to implement specific projects using low cost hardware and software centered around the Raspberry Pi. Basic exposure to electronics, programming, and Internet usage is assumed. We have tried to take a pragmatic approach, implementing the projects and showing how you can do this on your own.

Conventions

In this book, you will find several headings appearing frequently. To give clear instructions of how to complete a procedure or task, we use:

Mission briefing

This section explains what you will build, with a screenshot of the completed project.

Why is it awesome?

This section explains why the project is cool, unique, exciting, and interesting. It describes what advantage the project will give you.

Your Hotshot objectives

This section explains the eight major tasks required to complete your project.

  • Task 1

  • Task 2

  • Task 3

  • Task 4

  • Task 5

  • Task 6

  • Task 7

  • Task 8

Mission checklist

This section explains any pre-requisites for the project, such as resources or libraries that need to be downloaded, and so on.

Task 1

This section explains the task that you will perform.

Prepare for lift off

This section explains any preliminary work that you may need to do before beginning work on the task.

Engage thrusters

This section lists the steps required in order to complete the task.

Objective complete – mini debriefing

This section explains how the steps performed in the previous section allows us to complete the task. This section is mandatory.

Classified intel

This section provides some extra information relevant to the task.

You will also find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "We will go through the important features of the pygame module, which is necessary to build our arcade game, including playing sounds and controlling the menu."

A block of code is set as follows:

GPIO.output(25, True) 
while 1:
   GPIO.output(25,False)
   sleep(1)
   GPIO.output(25,True)
   sleep(1)

Any command-line input or output is written as follows:

# cp /usr/src/asterisk-addons/configs/cdr_mysql.conf.sample
     /etc/asterisk/cdr_mysql.conf

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "clicking the Next button moves you to the next screen".

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title via the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Downloading the color images of this book

We also provide you a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from http://www.packtpub.com/sites/default/files/downloads/6227OT_ColoredImages.pdf.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.