Python Programming with Raspberry Pi
eBook - ePub

Python Programming with Raspberry Pi

Sai Yamanoor, Srihari Yamanoor

Partager le livre
  1. 312 pages
  2. English
  3. ePUB (adapté aux mobiles)
  4. Disponible sur iOS et Android
eBook - ePub

Python Programming with Raspberry Pi

Sai Yamanoor, Srihari Yamanoor

DĂ©tails du livre
Aperçu du livre
Table des matiĂšres
Citations

À propos de ce livre

Become a master of Python programming using the small yet powerful Raspberry Pi ZeroAbout This Book‱ This is the first book on the market that teaches Python programming with Raspberry Pi Zero‱ Develop exciting applications such as a mobile robot and home automation controller using Python‱ This step-by-step guide helps you make the most out of Raspberry Pi Zero using Python programmingWho This Book Is ForThis book is aimed at hobbyists and programmers who want to learn Python programming and develop applications using the Pi Zero. They should have basic familiarity with electronics.What You Will Learn‱ Configure Raspberry Pi using Python‱ Control loops to blink an LED using simple arithmetic operations‱ Understand how interface sensors, actuators, and LED displays work‱ Get to grips with every aspect of Python programming using practical examples‱ Explore machine vision, data visualization, and scientific computations‱ Build a mobile robot using the Raspberry Pi as the controller‱ Build a voice-activated home automation controllerIn DetailRaspberry Pi Zero is a super-small and super-affordable product from Raspberry Pi that is packed with a plethora of features and has grabbed the notice of programmers, especially those who use Python.This step-by-step guide will get you developing practical applications in Python using a Raspberry Pi Zero. It will become a valuable resource as you learn the essential details of interfacing sensors and actuators to a Raspberry Pi, as well as acquiring and displaying data.You will get started by writing a Python program that blinks an LED at 1-second intervals. Then you will learn to write simple logic to execute tasks based upon sensor data (for example, to control a motor) and retrieve data from the web (such as to check e-mails to provide a visual alert). Finally, you will learn to build a home automation system with Python where different appliances are controlled using the Raspberry Pi.The examples discussed in each chapter of this book culminate in a project that help improve the quality of people's lives.Style and approachThis will be a learning, step-by-step guide to teach Python programming using the famous Raspberry Pi Zero. The book is packed with practical examples at every step along with tips and tricks for the Raspberry Pi fans

Foire aux questions

Comment puis-je résilier mon abonnement ?
Il vous suffit de vous rendre dans la section compte dans paramĂštres et de cliquer sur « RĂ©silier l’abonnement ». C’est aussi simple que cela ! Une fois que vous aurez rĂ©siliĂ© votre abonnement, il restera actif pour le reste de la pĂ©riode pour laquelle vous avez payĂ©. DĂ©couvrez-en plus ici.
Puis-je / comment puis-je télécharger des livres ?
Pour le moment, tous nos livres en format ePub adaptĂ©s aux mobiles peuvent ĂȘtre tĂ©lĂ©chargĂ©s via l’application. La plupart de nos PDF sont Ă©galement disponibles en tĂ©lĂ©chargement et les autres seront tĂ©lĂ©chargeables trĂšs prochainement. DĂ©couvrez-en plus ici.
Quelle est la différence entre les formules tarifaires ?
Les deux abonnements vous donnent un accĂšs complet Ă  la bibliothĂšque et Ă  toutes les fonctionnalitĂ©s de Perlego. Les seules diffĂ©rences sont les tarifs ainsi que la pĂ©riode d’abonnement : avec l’abonnement annuel, vous Ă©conomiserez environ 30 % par rapport Ă  12 mois d’abonnement mensuel.
Qu’est-ce que Perlego ?
Nous sommes un service d’abonnement Ă  des ouvrages universitaires en ligne, oĂč vous pouvez accĂ©der Ă  toute une bibliothĂšque pour un prix infĂ©rieur Ă  celui d’un seul livre par mois. Avec plus d’un million de livres sur plus de 1 000 sujets, nous avons ce qu’il vous faut ! DĂ©couvrez-en plus ici.
Prenez-vous en charge la synthÚse vocale ?
Recherchez le symbole Écouter sur votre prochain livre pour voir si vous pouvez l’écouter. L’outil Écouter lit le texte Ă  haute voix pour vous, en surlignant le passage qui est en cours de lecture. Vous pouvez le mettre sur pause, l’accĂ©lĂ©rer ou le ralentir. DĂ©couvrez-en plus ici.
Est-ce que Python Programming with Raspberry Pi est un PDF/ePUB en ligne ?
Oui, vous pouvez accĂ©der Ă  Python Programming with Raspberry Pi par Sai Yamanoor, Srihari Yamanoor en format PDF et/ou ePUB ainsi qu’à d’autres livres populaires dans Informatique et MatĂ©riel. Nous disposons de plus d’un million d’ouvrages Ă  dĂ©couvrir dans notre catalogue.

Informations

Année
2017
ISBN
9781786469151
Édition
1
Sous-sujet
Matériel

Lets Build a Robot!

In this chapter, we built an indoor robot (using the Raspberry Pi Zero as the controller) and documented our experience in a step-by-step guide. We wanted to demonstrate the awesomeness of the combination of Python programming language and the Raspberry Pi Zero's peripherals. We have also included suggestions to build an outdoor robot as well as suggestions for additional accessories for your robot. At the end of this chapter, we have included additional learning resources to build your own robot. Let's get started!
In this chapter, we are going to access the Raspberry Pi Zero via remote login (SSH) and remotely transferred files from the Raspberry Pi Zero. If you are not familiar with the command-line interface, we recommend proceeding to Chapter 11, Tips and Tricks, to set up your local desktop environment.
A Raspberry Pi Zero powered robot
Since we will be making use of a camera for our robot, Raspberry Pi Zero v1.3 or higher is needed for this chapter. Your Raspberry Pi Zero's board version is available on the back. Refer to the following picture:
Identifying your Raspberry Pi Zero's version

Components of the robot

Let's discuss the components of the robot using the labeled picture as an aid (shown in the following figure):
Components of the robot
The following is an explanation for the components of the robot:
  • The Raspberry Pi Zero controls the movement of the robot using a motor driver circuit (stacked on top of the Raspberry Pi Zero)
  • The motors of the robot are connected to the motor driver circuit
  • A USB battery pack is used to power the Raspberry Pi Zero. A separate AA battery pack is used to drive the motors
  • The robot is also equipped with a camera module that helps with driving the robot
We have included a suggested list of components where we chose the cheapest source available for the component. You are welcome to substitute with your own components. For example, you can use a webcam instead of using the Raspberry Pi camera module:
Component Source Quantity Price (in USD)
Chassis https://www.adafruit.com/products/2943 1 9.95
Chassis top plate https://www.adafruit.com/products/2944 1 4.95
A set of M2.5 rows, spacers, and nuts
http://a.co/dpdmb1B
1 11.99
DC motors in servo body https://www.adafruit.com/products/2941 2 3.50
Wheel https://www.adafruit.com/products/2744 2 2.50
Castor wheel https://www.adafruit.com/products/2942 1 1.95
Raspberry Pi Zero https://www.adafruit.com/products/3400 1 5.00
A Raspberry Pi Zero camera module
http://a.co/07iFhxC
1 24.99
A Raspberry Pi Zero camera adapter https://www.adafruit.com/products/3157 1 5.95
A motor driver circuitry for Raspberry Pi Zero https://www.adafruit.com/products/2348 1 22.50
USB battery pack http://a.co/9vQLx2t 1 5.09
AA battery pack (4 batteries) http://a.co/hVPxfzD 1 5.18
AA batteries NA 4 N.A.
Raspberry Pi camera module mount https://www.adafruit.com/products/1434 1 4.95
In the interest of saving time, we chose off-the-shelf accessories to build robot. We specifically chose Adafruit for the ease of purchase and shipping. If you are interested in building a robot that needs to suit outdoor conditions, we recommend a chassis similar to http://www.robotshop.com/en/iron-man-3-4wd-all-terrain-chassis-arduino.html.
As makers, we recommend making your own chassis and control circuitry (especially the motor drive). You can make use of software such as Autodesk Fusion (the link is available in the resources section) to design the chassis.

Setting up remote login

To control the robot remotely, we need to set up remote login access, that is, enable the SSH access. Secure Shell (SSH), and it is a protocol that enables remote access of a computer. The SSH access is disabled by default on the Raspbian operating system for security reasons. In this section, we will enable the SSH access to the Raspberry Pi Zero and change the Raspberry Pi Zero's default password.
If you are not familiar with the SSH access, we have provided a quick tutorial in Chapter 11, Tips and Tricks. We would like to keep the focus on buildin...

Table des matiĂšres