Instant download Raspbian OS Programming with the Raspberry Pi: Iot Projects with Wolfram, Mathematica, and Scratch Black. pdf all chapter
Instant download Raspbian OS Programming with the Raspberry Pi: Iot Projects with Wolfram, Mathematica, and Scratch Black. pdf all chapter
com
https://textbookfull.com/product/raspbian-os-programming-
with-the-raspberry-pi-iot-projects-with-wolfram-mathematica-
and-scratch-black/
OR CLICK BUTTON
DOWNLOAD NOW
https://textbookfull.com/product/biota-grow-2c-gather-2c-cook-loucas/
textboxfull.com
https://textbookfull.com/product/hands-on-start-to-wolfram-
mathematica-and-programming-with-the-wolfram-language-cliff-hastings/
textboxfull.com
https://textbookfull.com/product/raspberry-pi-iot-projects-
prototyping-experiments-for-makers-2nd-edition-john-c-shovic/
textboxfull.com
TECHNOLOGY IN AC TION™
Raspbian OS
Programming with
the Raspberry Pi
IoT Projects with Wolfram,
Mathematica, and Scratch
—
Agus Kurniawan
Raspbian OS
Programming with the
Raspberry Pi
IoT Projects with Wolfram,
Mathematica, and Scratch
Agus Kurniawan
Raspbian OS Programming with the Raspberry Pi: IoT Projects with
Wolfram, Mathematica, and Scratch
Agus Kurniawan
Depok, Indonesia
iii
Table of Contents
iv
Table of Contents
v
Table of Contents
vi
Table of Contents
Index�������������������������������������������������������������������������������������������������177
vii
About the Author
Agus Kurniawan is a lecturer, researcher, IT consultant, and an author. He
has 17 years of experience in various software and hardware development
projects, delivering materials in training and workshops, and technical
writing. He has been awarded the Microsoft Most Valuable Professional
(MVP) award 14 years in a row.
His topic interests are software engineering, embedded system,
networking, and security system. He has been working as lecturer and
researcher at the Faculty of Computer Science, Universitas Indonesia.
Currently, he is pursuing a PhD in computer science at the Freie
Universität Berlin, Germany. He can be reached on his blog at
http://blog.aguskurniawan.net and Twitter at @agusk2010.
ix
About the Technical Reviewer
Massimo Nardone has more than 22 years of experiences in security, web/
mobile development, cloud, and IT architecture. His true IT passions are
security and Android.
He has been programming and teaching how to program with Android,
Perl, PHP, Java, VB, Python, C/C++, and MySQL for more than 20 years.
He holds a Master of Science degree in Computing Science from the
University of Salerno, Italy.
He has worked as a Project Manager, Software Engineer, Research
Engineer, Chief Security Architect, Information Security Manager, PCI/
SCADA Auditor, and Senior Lead IT Security/Cloud/SCADA Architect for
many years.
Technical skills include: Security, Android, Cloud, Java, MySQL,
Drupal, Cobol, Perl, web and mobile development, MongoDB, D3, Joomla,
Couchbase, C/C++, WebGL, Python, Pro Rails, Django CMS, Jekyll,
Scratch, etc.
He currently works as Chief Information Security Office (CISO) for
Cargotec Oyj.
xi
Acknowledgments
We would like to thank Apress for all their help in making this book
possible. Specifically, we would like to thank Aaron Black, our acquisitions
editor, and Jessica Vakili, our coordinating editor, for helping us complete
the Raspbian book.
Special thanks to our development editor, James Markham, and
technical reviewers, Chaim Krause and Massimo Nardone, for all of their
suggestions during the editorial review process that helped make this a
great book.
We would also like to thank the Raspberry Pi and Raspbian
communities anywhere in the world for contributing and making learning
Raspberry Pi with Raspbian easy.
Last but not least, a thank you to my wife, Ela and my children, Thariq
and Zahra, for their great support while I completed this book.
xiii
Introduction
Raspberry Pi is a mini computer that you can operate as a normal
computer. The Raspberry Pi board is one of recommended development
boards with IoT platforms. There are many features on the Raspbian OS
and Raspberry Pi boards that you can use to build IoT programs in various
scenarios. Raspberry Pi is designed to enable you to scale its capabilities
through GPIO pins that are suitable for your business and research needs.
Raspbian OS Programming with the Raspberry Pi is a quick reference
to build programs on top of the Raspbian OS on a Raspberry Pi board.
You’ll start by learning Raspbian shells to develop programs. You will go
through a step-by-step guide with project samples to learn the ins and outs
of the Raspbian OS development. You will also learn about the Wolfram
language, Mathematica, and Scratch.
xv
Introduction
xvi
CHAPTER 1
Introduction
to Raspberry Pi
Raspberry Pi is a development board that can be applied to build IoT
applications. Various sensors and actuator devices can be attached to the
board. In this chapter, we explore Raspberry Pi and cover its models.
We also learn how to set up the board for the first time.
The following list of topics is covered in this chapter:
2
Chapter 1 Introduction to Raspberry Pi
1.2 R
eviewing the Raspberry Pi Board
Models
There are several Raspberry Pi models that we can use to perform specific
purposes. The latest model as I am writing this book is Raspberry Pi 3
Model B+. This board consists of Broadcom BCM2837B0, Cortex-A53
(ARMv8) 64-bit SoC @ 1.4GHz, with 1GB LPDDR2 SDRAM. The board
also provides Ethernet, WiFi, and Bluetooth 4.2 (BLE). You can see the
Raspberry Pi 3 Model B+ board in Figure 1-1. For further information
about Raspberry Pi 3 Model B+, see https://www.raspberrypi.org/
products/raspberry-pi-3-model-b-plus/.
If you have concerns about hardware size, Raspberry Pi Foundation
has an even smaller version, which is half the size of a credit card. It is
called the Raspberry Pi Zero. There are two models—Raspberry Pi Zero and
Raspberry Pi Zero Wireless. The first model was released in November 2015.
The last model that has a WiFi module was released in February 2017. Both
models run Broadcom BCM2835 MCU with 512MB RAM. You can see the
Raspberry Pi Zero Wireless board form in Figure 1-2.
3
Chapter 1 Introduction to Raspberry Pi
You also can see and compare several Raspberry Pi models based on
processor, RAM, and network module availability in Table 1-1.
4
Chapter 1 Introduction to Raspberry Pi
Technically, all the Raspberry Pi models that are shown in Table 1-1
are designed for personal makers and hobbyists. There are limited GPIO
pins on each Raspberry Pi model. If you need more GPIO pins on the
board, you can extend it using GPIO extender modules. The Raspberry Pi
Foundation also released the Raspberry Pi model for industry purposes. It
is called the Raspberry Pi Compute Module. Currently, the latest model is
Raspberry Pi Compute Module V3.
Raspberry Pi Compute Module V3 board hosts 120 GPIO pins, an
HDMI port, a USB port, two camera ports, and two display ports. You
can see the board form in Figure 1-3. For further information about the
Raspberry Pi Compute Module V3, visit the official website at http://
socialcompare.com/en/comparison/raspberrypi-models-comparison.
5
Chapter 1 Introduction to Raspberry Pi
If you have experience using Debian and Ubuntu Linux, you should be
familiar with Raspbian OS since this OS is built based on Debian Linux and
optimized on a Raspberry Pi board with ARMv6 CPU.
This book uses Raspbian OS for testing and evaluation. You can
download the Raspbian image file at https://www.raspberrypi.org/
downloads. Currently, Raspbian provides desktop and lite versions. You
can see the download image in Figure 1-4. The Raspbian desktop version is
running Raspbian OS with an installed desktop runtime. The Raspbian lite
version is designed for light usage. It means you will obtain the Terminal
runtime.
6
Chapter 1 Introduction to Raspberry Pi
1.4 S
etting Up Raspbian OS on Raspberry
Pi Boards
The Raspberry Pi models don’t have internal storage unless you’re using
the Raspberry Pi Compute Module. You should attach external storage,
such as an SD card or a microSD card. The new Raspberry Pi board model
uses microSD for external storage.
I recommended that you use a microSD card that’s 16GB. You can
install some libraries, frameworks, and tools for your personal and
business needs. In this section, I’m going to show you how to set up
Raspbian OS on a Raspberry Pi 3 board.
First, download the Raspbian OS image. You can download it at
https://www.raspberrypi.org/downloads. For demo purposes, I chose
the Raspbian Stretch with desktop, as shown in Figure 1-4. To flash the
Raspbian image into the microSD card, you can use Etcher. It’s free and
available for Windows, Mac, and Linux. You can see the Etcher application
in Figure 1-5. Download it from https://etcher.io, based on your
platform, and then install it.
7
Chapter 1 Introduction to Raspberry Pi
The Etcher application is easy to use. You can just select your Raspbian
image and target the drive of the microSD card on your computer. Some
computers don’t have microSD card readers, so you need an SDcard
reader. Then put your microSD card into the reader.
After completing the flashing Raspbian step, you can plug your
keyboard, mouse, and monitor into the Raspberry Pi board.
Details about Raspbian installation on the Raspberry Pi board can be
found in the official guideline manual at https://www.raspberrypi.org/
documentation/installation/installing-images/README.md.
8
Chapter 1 Introduction to Raspberry Pi
Wait several minutes to ensure Raspbian has started. You should get
your Raspbian IP address from your router. Now open the SSH
client application. For Windows, you can use the PuTTY application at
https://www.putty.org. For Linux and Mac, you can use the Terminal.
For instance, the Raspbian IP address is 192.168.1.21 and the username is
pi. Then type this command.
$ ssh pi@192.168.1.21
9
Chapter 1 Introduction to Raspberry Pi
You should be able to access the Raspbian Terminal remotely. You can
see an example of remote SSH in Figure 1-7.
$ sudo raspi-config
10
Chapter 1 Introduction to Raspberry Pi
From the main menu (see Figure 1-8), you can select the Advanced
Options menu. Then, you should see the form that is shown in Figure 1-9.
Select the Expand Filesystem option. After that, you will obtain
confirmation. If you’re done, Raspbian will expand your disk.
11
Chapter 1 Introduction to Raspberry Pi
12
Chapter 1 Introduction to Raspberry Pi
After you select one of the WiFi SSIDs, you probably will be asked for
the SSID pin. Fill in the SSID pin and then your Raspbian will connect to
the network.
13
Chapter 1 Introduction to Raspberry Pi
14
Chapter 1 Introduction to Raspberry Pi
If you click on the Raspberry Pi logo on the top-left, you should see a
main menu, as shown in Figure 1-12. You can see a list of applications and
the managing systems.
For instance, open a browser from the Internet menu. You can surf the
Internet as you do in a normal browser. Raspbian installed Chromium as
its default browser application. You can see this browser in Figure 1-13.
15
Chapter 1 Introduction to Raspberry Pi
16
Another Random Scribd Document
with Unrelated Content
grognèrent bien un peu, sur la quantité ou la qualité des services ;
mais les voisins nous disaient : « faites pas attention, monsieur ;
c’est une vieille habitude qu’il a : il est plus bête que méchant. » Et
l’on riait. A mesure que les estomacs étaient plus satisfaits, les
visages le paraissaient aussi et, au dessert, un petit verre aidant, la
joie fut parfaite.
Parfaite, non : le dessert me sembla maigre et j’en eus du
chagrin pour ces pauvres vieux et vieilles du bon Dieu. Il manquait
une caisse de mandarines. Et je me disais : « Ah ! si ma sœur
Jeanne était là avec la sienne ! Elle n’en garderait guère pour elle :
je la connais. Quel plaisir elle se ferait de faire plaisir à ces braves
gens ! Il y en a peut-être parmi eux qui n’ont jamais vu de mandarine
et qui n’en verront jamais, tandis qu’elle, qu’est-ce que ça peut lui
faire, de manger tous les jours une mandarine pendant un an ? Du
mal. Surtout qu’elle est déjà malade !… Et puis ce n’est qu’un lot, un
pur don du hasard : elle aurait pu fort bien, comme moi, ne rien
gagner du tout… Ah ! si j’avais avec moi la caisse de ma bonne
sœur Jeanne ! »
Heureusement, par prudence, je l’avais prise avec moi, pour le
cas où tu me donnerais, sur place, la permission tacite de la
distribuer en ton nom. Et je l’ai distribuée. Il y en avait trois cents ; ils
étaient trois cents vieux : donc trois cents bénédictions, que je
t’envoie. Ça te guérira, mignonne !
Si pourtant tu tenais à être dédommagée, je m’engage à te les
rembourser en trois cents baisers, échelonnés sur un espace de
quarante ans — est-ce assez long ? — afin qu’il t’en reste quelques-
uns, quand tu seras vieille aussi. Donne tes pauvres joues pâlies et
maigries, pour que j’y mette les deux premiers, et compte bien.
Vous, maman, guérissez-la vite. Je vous embrasse aussi, avec
papa. Ne craignez rien pour votre christ : vous l’aurez.
Votre Popol.
25. A ma mère.
28 février.
Chère maman,
Votre Paul.
26. A Louis.
8 mars.
Paul.
27. Au même.
15 mars.
Traduisez librement.
— Aux Grecs le génie, aux Grecs le beau parler, avec l’unique
passion de la gloire.
— Fort bien. Après les Romains, qui nous ont d’abord transmis
l’idéal grec, tel qu’ils se l’étaient assimilé, toutes les nations
modernes, depuis des siècles, sont allées et vont encore apprendre
à Athènes ou du moins à Rome, son héritière la plus directe, les
secrets de la beauté littéraire comme de la beauté artistique. Il en
sera ainsi longtemps encore, parce que l’idéal grec n’est pas le fruit
du caprice ou du convenu, mais un type parfaitement raisonné et
admirablement conforme à l’immortelle nature.
— Vous, savez, mon Père, que vous prêchez un converti.
— Oui… mais aussi un convalescent, qui ne doit pas être encore
de force à soutenir un sermon trop long. Tenons-nous-en là, s’il vous
plaît.
— En attendant la suite pour bientôt, n’est-ce pas, mon Père ?
— Si vous êtes sage.
— Je le serai, pour cette raison et pour plusieurs autres.
— Nous sommes d’ailleurs arrivés et j’aperçois le Père Ministre,
qui vient à notre rencontre. »
Le Père Ministre est tout bonnement mon Père spirituel, que tu
connais déjà. Sous sa forme ministérielle, les élèves n’ont guère
avec lui de relations directes. C’est pourtant un gros personnage : il
est le second du Père Recteur, pour tout ce qui regarde l’ordre
général de la maison, et j’ai vu le Père Préfet lui-même venir, sa
barrette à la main, lui demander la permission, un jour qu’il était
fatigué, de prolonger le lendemain son sommeil jusqu’à cinq heures.
C’est le Père Ministre qui gouverne la sacristie, la cuisine, les
travaux intérieurs et tous les services domestiques, par le moyen
des Frères coadjuteurs et du personnel salarié. Il a toutes les clefs, y
compris celles de l’office et de la cave.
A ma vue, ses entrailles deux fois paternelles s’émurent de
compassion et, pour me rendre plus vite mes jambes et mes
couleurs, il nous offrit un petit verre de derrière les fagots avec un
excellent biscuit de Reims. Nous prîmes les deux au grand air, sur
une table champêtre, fort joyeusement, et pour terminer la soirée,
pendant que mon professeur disait son bréviaire dans une avenue,
le Père Ministre voulut bien perdre sur moi une partie d’échecs. Il
s’en vengea en nous ramenant au collège dans sa carriole, pour
nous épargner la route à pied.
Bonne journée. Je t’en souhaite beaucoup de semblables, mon
cher Louis, sans grande chance de réalisation : car tes professeurs
ont à promener leurs jeunes héritiers, et le lycée n’a pas de Père
Ministre.
Demain, je rentre en classe. Quel bonheur !
Ton ami,
Paul.
28. Au même.
26 mars.
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
textbookfull.com