FREE E-BOOK Raspberry Pi Embedded Projects

FREE E-BOOK Raspberry Pi Embedded Projects

FREE E-BOOK Raspberry Pi Embedded Projects
FREE E-BOOK Raspberry Pi Embedded Projects

Author(s): Sai Yamanoor, Srihari Yamanoor
Series: Hotshot
Publisher: Packt Publishing, Year: 2015
ISBN: 1849696225,9781849696227

About the Authors

Sai Yamanoor is a mechatronics engineer working for a private start-up school in the San Francisco Bay Area where he builds devices that help students achieve their full potential. He completed his degree in mechanical engineering at Carnegie Mellon University, Pittsburgh, PA, and his undergraduate work in mechatronics at Sri Krishna College of Engineering and Technology, Coimbatore, India. His interests, deeply rooted in DIY and open software and hardware cultures, include developing gadgets and apps that improve quality of life, Internet of Things, crowdfunding, education, and new technologies. In his spare time, he plays with various devices and architectures such as Raspberry Pi, Arduino, Galileo, Android devices, and others. Sai shares his adventures with mechatronics at the aptly named "Mechatronics Craze"

About the Reviewers

Sreedhar Vaddi has 4 years of experience in big data, 4 years in cloud computing, and 15 years in Java. His experience includes work in the fields of big data security, biomedical/ healthcare, mobile security, financial services (wholesale, mortgage, investment, and brokerage), the Web (marketplace, crowdsourcing, and advertising), news and entertainment, property and casualty insurance, software product development, and scientific research. He has hands-on experience as an architect working on enterprise mobile applications, Hadoop, SaaS, PaaS, IaaS, the cloud, rich enterprise applications, n-tier enterprise systems, Enterprise Application Integration (EAI) in web-enabling legacy systems, IBM Mainframe and SAP, and SOA web services with Java2 and JEE. 

He has also worked in all phases of SDLC, namely designing, developing, performance testing, and implementing Web-2.0, Web-UI, server-side, middleware, and mobile applications. He has also worked with Big 5 Consulting and Fortune 100 companies. He has led teams of sizes varying from 2 to 80 across the globe in different time zones, cultures, and dialects. He is an administrator of JEE containers (Geronimo, WebSphere, Weblogic, JBoss, and Tomcat) and CDH. He is also a technical consultant at a stealth mode start-up in animal care in the clinical trials industry. He is a diligent worker and quick learner with excellent problem solving, presentation, and mentoring skills

Table of Contents

Preface 1

Project 1: Hello World 7

A quick introduction to the Raspberry Pi 7
Where can I buy a Raspberry Pi? 9
Mission briefing 16
Hunting and gathering 17
Setting up the GPIO 18
GPIO programming using Python 21
Electrical output of our program 25
Mission accomplished 28
Hotshot challenge 28
Project 2: A Raspberry WebIDE Example 29
Mission briefing 29
Installation, features, and usage of the Occidentalis operating system
from Adafruit 31
Setup of a remote login into the Raspberry Pi 32
Installation of the Raspberry Pi WebIDE 35
Python development on the WebIDE 36
Test and debugging examples using the WebIDE 42
Mission accomplished 47
Hotshot challenge 47

Mission briefing 49

Project 3: The Arduino Raspberry Pi Interface 49

Installing the Arduino IDE 51
Programming the Arduino using the Raspberry Pi 52
Raspberry Pi AlaMode 53
The Weasley weather clock 54
Controlling the stepper using the Arduino 57
Controlling the RGB LED Strip using the Arduino 61
I2C Communication using the Arduino (optional) 64
Serial port communication with the Raspberry Pi 67
Mission accomplished 76
Hotshot challenge 76

Project 4: Christmas Light Sequencer 77

Mission briefing 77
Interface the devices to the Raspberry Pi 79
Setting up the digitally addressable RGB matrix 84
Interface of an audio device 89
Installing the web server 90
Interfacing the web server 92
Mission accomplished 95
Project 5: Internet of Things Example – An E-mail Alert Water Fountain 97
Mission briefing 97
Installation of the Flask framework 101
Controlling RGB LEDs from a web page 103
Setup of the e-mail alerts in the fountain 106
Mission accomplished 108
Hotshot challenge 108

Project 6: Raspberry Pi as a Personal Assistant 109

Mission briefing 109
Setting up the e-mail feed parser 112
Setting up the parser for reminders and events 115
Designing an enclosure design for the personal assistant 117
Setting up the assembly for the dish monitor 119
Setting up sensors for the key alert system 122
Mission accomplished 124
Hotshot challenges 125
References 125

Project 7: Raspberry Pi-based Line Following Robot 127

Mission briefing 127
Assembly of the Pi Plate for the line following robot 129
Sensor selection, interface, and data interpretation 131
Implementation of line following logic based on sensor data 134
Testing the motor driver circuit 136
Preparation of the line following course 140
Designing the chassis for the line following robot 142
A step-by-step assembly of the robot 144
Mission accomplished 146
Hotshot challenge 147

Project 8: Connect Four Desktop Game using Raspberry Pi 149

Mission briefing 149
Hello world example with the pygame 151
Getting started with the Connect Four game (UI and sound effects) 155
Interfacing game inputs using the PiFace module 158
A brief description of the Connect Four Game AI 163
Marquee design and control (optional) 166
Setup of the switches using a cardboard box 167
Mission accomplished 170
Hotshot challenge 170

Project 9: The Raspberry Pi-enabled Pet/Wildlife Monitor 171

Mission briefing 171
Installing and testing the python-twisted framework 173
Setting up and testing Spark Core to interact with appliances 175
Installing and testing the Google Coder project on the Raspberry Pi 179
A brief overview of a bird feeder that triggers a camera 180
Mission accomplished 184
Hotshot challenge 184

Project 10: Raspberry Pi Personal Health Monitor 185

Mission briefing 185
Setting up a web server to record health parameters 186
A simple exercise tool using the Raspberry Pi 189
Setting up an e-mail feed parser to refill a prescription as well as
remind the user about an upcoming doctor's appointment 193
A simple tool that reminds a person to take his/her pills 194
Mission accomplished 195
Hotshot challenge 195

Project 11: Home Automation using Raspberry Pi 197

Mission briefing 197
A simple example that controls 198
limited indoor and outdoor lighting in the evening 198
A customary web server example 202
Turning on a lawn sprinkler only when there is no rain forecast! 204
Mission accomplished 206

Project 12: Using a Raspberry Pi for Science and Education 207

Mission briefing 207
Improving your vocabulary using the Raspberry Pi 208
Raspberry Pi and Khan Academy 209
Building a science fair exhibit using the Raspberry Pi 211
Hotshot challenge 213

Project 13: Tips and Tricks 215

Mission briefing 215
Setting up Raspberry Pi as a development platform 216
Remotely logging in the Raspberry Pi from anywhere on the Internet 222
Problems that might be encountered while using Raspberry Pi 223
Cool add-on hardware sources 223
developed for the Raspberry Pi platform 223
Project ideas that can be implemented over a weekend 224
Useful resources for the Raspberry Pi 224
Mission accomplished 225
Index 227