Professional Documents
Culture Documents
(Download PDF) Raspberry Pi Iot Projects Prototyping Experiments For Makers 2Nd Edition John C Shovic Online Ebook All Chapter PDF
(Download PDF) Raspberry Pi Iot Projects Prototyping Experiments For Makers 2Nd Edition John C Shovic Online Ebook All Chapter PDF
https://textbookfull.com/product/raspbian-os-programming-with-
the-raspberry-pi-iot-projects-with-wolfram-mathematica-and-
scratch-black/
https://textbookfull.com/product/raspbian-os-programming-with-
the-raspberry-pi-iot-projects-with-wolfram-mathematica-and-
scratch-1st-edition-agus-kurniawan/
https://textbookfull.com/product/practical-internet-of-things-
with-javascript-build-standalone-exciting-iot-projects-with-
raspberry-pi-3-and-javascript-1st-edition-arvind-ravulavaru/
https://textbookfull.com/product/linux-for-makers-understanding-
the-operating-system-that-runs-raspberry-pi-and-other-maker-sbcs-
first-edition-newcomb/
Custom Raspberry Pi Interfaces Design and build
hardware interfaces for the Raspberry Pi Gay
https://textbookfull.com/product/custom-raspberry-pi-interfaces-
design-and-build-hardware-interfaces-for-the-raspberry-pi-gay/
https://textbookfull.com/product/raspberry-pi-for-arduino-users-
building-iot-and-network-applications-and-devices-1st-edition-
james-r-strickland/
https://textbookfull.com/product/raspberry-pi-for-dummies-3rd-
edition-sean-mcmanus/
https://textbookfull.com/product/expanding-your-raspberry-pi-
storage-printing-peripherals-and-network-connections-for-your-
raspberry-pi-1st-edition-mark-edward-soper/
https://textbookfull.com/product/learn-electronics-with-
raspberry-pi-physical-computing-with-circuits-sensors-outputs-
and-projects-stewart-watkiss/
TECHNOLOGY IN AC TION™
Raspberry
Pi IoT Projects
Prototyping Experiments for Makers
—
Second Edition
—
John C. Shovic
Raspberry Pi IoT
Projects
Prototyping Experiments
for Makers
Second Edition
John C. Shovic
Raspberry Pi IoT Projects: Prototyping Experiments for Makers
John C. Shovic
Spokane Valley, WA, USA
v
Table of Contents
vi
Table of Contents
vii
Table of Contents
Startup Procedure���������������������������������������������������������������������������������������150
Making BeaconAir Start on Bootup�������������������������������������������������������������151
How It Works in Practice������������������������������������������������������������������������������152
Things to Do������������������������������������������������������������������������������������������������������152
The Classic Distributed System Problems��������������������������������������������������������153
Conclusion��������������������������������������������������������������������������������������������������������155
viii
Table of Contents
Chapter 6: Using IoT for RFID and MQTT and the Raspberry Pi��������207
IoT Characterization of This Project������������������������������������������������������������������208
What Is RFID Technology?���������������������������������������������������������������������������������209
What Is MQTT?��������������������������������������������������������������������������������������������������211
Hardware Used for IoTRFID�������������������������������������������������������������������������������212
Building an MQTT Server on a Raspberry Pi�����������������������������������������������������213
The Software on the Raspberry Pi��������������������������������������������������������������������215
Installing the MQTT “Mosquitto”�����������������������������������������������������������������215
Configuring and Starting the Mosquitto Server�������������������������������������������216
Starting the Mosquitto Server���������������������������������������������������������������������218
Testing the Mosquitto Server�����������������������������������������������������������������������218
Building the IoTRFID������������������������������������������������������������������������������������������219
The Parts Needed����������������������������������������������������������������������������������������219
Installing Arduino Support on the PC or Mac�����������������������������������������������220
The Hardware����������������������������������������������������������������������������������������������221
What Is This Sensor We Are Using?�������������������������������������������������������������222
3D Printed Case�������������������������������������������������������������������������������������������222
The Full Wiring List��������������������������������������������������������������������������������������225
The Software for the IoTRFID Project����������������������������������������������������������������229
The Libraries������������������������������������������������������������������������������������������������230
The Main Software��������������������������������������������������������������������������������������230
Testing the IoTRFID System�������������������������������������������������������������������������236
Setting Up the Mosquitto Debug Window����������������������������������������������������236
Set Up a Subscriber on the Raspberry Pi����������������������������������������������������238
Testing the Entire IoTRFID System���������������������������������������������������������������241
What to Do with the RFID Data on the Server���������������������������������������������������242
Conclusion��������������������������������������������������������������������������������������������������������243
ix
Table of Contents
Index�������������������������������������������������������������������������������������������������273
x
About the Author
Dr. John C. Shovic is currently a Professor of
Computer Science at the University of Idaho
specializing in AI and robotics. He is also
Chief Technical Officer of SwitchDoc Labs, a
company specializing in technical products
for the Maker Movement and the IoT. He was
also Chief Technology Strategist at Stratus
Global Partners with a focus on supplying
expertise in computer security regulatory
and technical areas to health-care providers.
He has worked in the industry for over 30
years and has founded seven companies:
Advanced Hardware Architectures, TriGeo Network Security, Blue Water
Technologies, MiloCreek, InstiComm, SwitchDoc Labs, and bankCDA.
As a founding member of the bankCDA board of directors, he currently
serves as the Chairman of the Technology Committee. He has also served
as a Professor of Computer Science at Eastern Washington University and
Washington State University. Dr. Shovic has given over 80 invited talks and
has published over 70 papers on a variety of topics on Arduinos/Raspberry
Pis, HIPAA, GLB, computer security, computer forensics, robotics, AI, and
embedded systems.
xi
About the Technical Reviewer
Massimo Nardone has more than 22 years
of experience 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.
xiii
Acknowledgments
I would like to acknowledge the hard work of the Apress editorial team in
putting this book together. I would also like to acknowledge the hard work
of the Raspberry Pi Foundation and the Arduino group for putting together
products and communities that help to make the Internet of Things
more accessible to the general public. Hurray for the democratization
of technology! Of course, I have to mention my grandchildren (Lincoln,
Hazel, Makenna and Madelyn) that I am constantly building projects to
entertain and education them.
xv
Introduction
The Internet of Things (IoT) is a complex concept made up of many
computers and many communication paths. Some IoT devices are
connected to the Internet and some are not. Some IoT devices form
swarms that communicate among themselves. Some are designed for a
single purpose, while some are more general-purpose computers. This
book is designed to show you the IoT from the inside out. By building IoT
devices, the reader will understand the basic concepts and will be able to
innovate using the basics to create their own IoT applications.
These included projects will show the reader how to build their own
IoT projects and to expand upon the examples shown. The importance
of computer security in IoT devices is also discussed as well as various
techniques for keeping the IoT safe from unauthorized users or hackers.
The most important takeaway from this book is in building the projects
yourself.
xvii
Chapters at a Glance
In this book, we build examples of all the major parts of simple and
complex IoT devices.
In Chapter 1, the basic concepts of IoT are explained in basic terms,
and you will learn what parts and tools are needed to start prototyping
your own IoT devices.
In Chapter 2, you'll learn how to sense the environment with
electronics and that even the behavior of simple LightSwarm type of
devices can be very unpredictable.
Chapter 3 introduces important concepts about how to build real
systems that can respond to power issues and programming errors by the
use of good system design and watchdogs.
Chapter 4 turns a Raspberry Pi into a battery-powered device that
senses iBeacons and controls the lighting in a house while reporting your
location to a server.
In Chapter 5, you'll do IoT the way the big boys do by connecting to the
IBM Bluemix IoT server and sending your biometric pulse rates for storage
and display.
In Chapter 6, we'll build a small RFID inventory system and use
standard protocols like MQTT to send information to a Raspberry Pi, a
complete IoT product.
Chapter 7 shows the dark side of the IoT, computer security. The way
you protect your IoT device from hackers and network problems is the
most difficult part of IoT device and system design.
Are you totally secure? You will never know. Plan for it.
The reference appendix provides resources for further study and
suggestions for other projects.
xix
CHAPTER 1
Introduction to IoT
Chapter Goal: Understand What the IoT Is and How to Prototype IoT
Devices
Topics Covered in This Chapter:
• What is IoT
The IoT is a name for the vast collection of “things” that are being
networked together in the home and workplace (up to 20 billion by 2022
according to Gardner, a technology consulting firm). That is a very vast
collection. And they may be underestimating it.
We all have large numbers of computers in a modern house. I just did
a walk-through of my house, ignoring my office (which is filled with about
another 100 computers). I found 65 different devices having embedded
computers. I’m sure I missed some of them. Now of those computer-based
devices, I counted 20 of them that have IP addresses, although I know that
I am missing a few (such as the thermostat). So in a real sense, this house
has 20 IoT devices. And it is only 2020 as of the writing of this book. With
over 100 million households in the United States alone, 20 billion IoT
devices somehow don’t seem so many.
Of course, not every IoT device will have all three, but these are the
characteristics of what we will find out there.
Is the IoT valuable? Will it make a difference? Nobody is sure what the
killer application will be, but people are betting huge sums of money that
there will be a killer application. Reading this book and doing the projects
will teach you a lot about the technology and enable you to build your own
IoT applications.
2
Chapter 2 Sensing Your IoT Environment
Ratings are from 1 to 10, 1 being the least suitable for IoT and 10 being
the most suitable for IoT applications.
This gives us a CPLPFC rating of 7.2. This is calculated by averaging all
six values together with equal weighting. This way is great for learning and
experimenting and could be deployed for some applications.
The ESP8266 is an impressive device having a built-in WiFi connection,
a powerful CPU, and quite a bit of RAM and access to the Arduino libraries.
It is inexpensive and will get cheaper as time goes on. It is a powerful
device for prototyping IoT applications requiring medium levels of
functionality.
15
Another random document with
no related content on Scribd:
thereof till the waters are dried up. Though this may appear
marvellous, it is the fact with these people.”
Nos. 1, 2, 3, and 4. “Are four rivers (perhaps canals) belonging to
Maséna.”
“The present Sultan of Maséna is Ahmad Hamad Labo, who rules
over Timbuctoo, Jeri, and Oonbori, and indeed he may be called the
sovereign of the Gharb (West) in Soodan. He is now at war with
Sego.
“From Soccatoo to Benji is one day’s journey through Sisilbi,
which is the metropolis of Ghalooji. This country is level and fertile,
and contains rivers, woods, gardens, and wells. On the east side of it
there are two rocky, rugged mountains; on the right there is a river,
and on the left there are plains and barren deserts. In the environs of
the capital of Benji there are, however, several villages or towns
belonging to the Mohammedans. Between the territory of Benji and
that of Mouri is three days’ and nights’ journey, through barren and
sandy deserts. Mouri contains small mountains, woods, and has two
roads on the left; on one of which there is a deep stream, and on the
other are two lakes, surrounded with flowering and fruitful trees. This
country originally belonged to the Sultan of Kabi, and its inhabitants
are infidels. Its present sultan is named Ghagara, and has a city for
his residence named Lukoo-you, which has a great lake near it. The
chief towns of this country are Dogordoosi, Myzani, Toonsubi, and
Tabada. There are many smaller ones, which need not be mentioned
for brevity’s sake. The lands are mostly stony, sandy, and hilly. There
are a great many deep wells, well supplied with water; but the
country altogether has but few trees, though it abounds with reptiles.
“Next to it, at two days’ journey through dry deserts, with one track
of road only, though woody and hilly, the country of Emanoo lies, the
first town of which is Bakendoosi, which is of a moderate size; and
has, on the east, a lake surrounded with trees; and, on the west, a
well-known great and very tall tree. Between this town and the
metropolis of the sultan, whose name is Aghmarak, is half a day’s
journey. Emanoo is part of the countries of the Tuaricks, and
contains lakes, wells, mountains, hills, and sands. Its people live
upon the dokhun, and possess a great many cattle.
“Next to this, at one day’s journey, is the territory of Taghzar,
which also belongs to the Tuaricks, and contains hills, wells, and
natron lakes, which is called in our language káwa, or salt. East and
west of this country there are mountains well stocked with cattle. The
people are the worst and most ill-disposed of the tribes of Tuarick;
and their chief living is peas and dokhun. Their sultan is named
Hama-ráwadó, and also Hama-zanzamá, which means in our
language Dog.
“On the right of this country the territory of Jerma lies; it is a
narrow vale, between high hills and hillocks of sand; and on the east
it has a lofty mountain; it contains natron and other deep lakes. It is
inhabited by the tribe of Benoo-Hami, who are great warriors,
possessing swift and well-trained horses, and their spears are
extremely long and well-ironed with sharp blades. They are ill-
disposed people, and have no lawful sultan, but their chief is one
chosen out of the tribe. They subsist mostly upon dokhun, and their
country abuts on the great sea or river Cówara.
“On the left of the before-mentioned country (Taghzar) that of
Azwa lies, which is inhabited both by the Tuarick and by Benoo-
Hami. It contains plains, vales, mountains, hills, and sands; and has
deep streams. They possess abundance of cattle, and most of their
living is the dokhun.
“Between Taghzar and the river Cówara is three days’ journey,
through a barren desert, without any human being in it, inhabited
only by wild beasts; and it has a long and deep stream running
through sandy hills. From this stream the people of Taghzar provide
themselves with water when they go to the chase of the giraffe in the
winter season. The distance between their town and this stream is
half a day’s journey, through some woody plains, a few small
mountains, and sandy hills. On the road, however, there is a small
lake, surrounded with shrubs and trees, in which water is found only
in the autumn.
“Near the river there are a great many white hills, without any
trees upon them; but on the banks there are very large tall trees of
tamarinds, under the shade of which travellers rest themselves.
W. “Now the great river Cówara comes, and here is its
representation. This great river is the largest in all the territories of
Houssa; we know not of its source, nor of any one who has seen it. It
rushes and precipitates itself through the country from left to right,
and contains many islands inhabited by fishermen, herdsmen,
husbandmen, and settlers. As to the variety of its animals, birds, and
fish, it is only known to the Lord Creator; it has rocks and mountains,
which break and shatter to pieces all vessels that are driven against
them; and its great roaring and noise, with the agitation of its waves,
astonish the hearer and terrify the beholder; and, at the same time,
exhibit the wonderful power of the Omnipotent Creator.
X. “Is an undescribed branch of the river.
Y. “The writing of this copy ended on Thursday afternoon, the 5th
of Rajab, 1242, of Hegira—(January 31, 1827, A.D.), in the city of
Soccatoo, residence of the Prince of the Faithful Sultan Mohammed
Bello, by his special command to me, Mohammed, son of Ahmad
Masané—(i.e. native of Maséna)—for Abdálláh the English
Christian.”
A. V. SALAMÉ.
No. II.
FOOTNOTES:
7. Itinerary.
“From Sira to Boogho is a distance of twenty days; thence to
Mooshkoom-Foosh, to Sary, to Sarwa, to Indam or Indag, to Warshá,
to Booshrá, to the mountain called Kaghoom, to Mount Kinghá, to
Mount Dooziyat, to Mount Aboo-Talfan, to Mount Aboo-Zarafat; then
to Rooga, to Dygo, to Kájá, to Katoonú; then to the mountain of
Nubia, to the gold mine called Tagly, which has no less than ninety-
nine mountains, the name of each of which begins with F; but three
only of these mountains are known, whose names are as follow:
Fazooglú, Fafaklú, and Foondooflú. In two days from this place, you
will get to the Nile of Sonnar; but from Tagly to Egypt, or Cairo, which
lies northward on the left side of it, is a journey of forty days,
travelling continually by the bank of the Nile; while from Tagly to
Sawaken, which is on the sea coast (the Red Sea), is a distance of
thirty days only.”
FOOTNOTES:
Fowl, Ade′a
Goat, Aoor′ey
Sheep, Agon′ta
Pig, Ale′day
Salt, Ee′yo
Corn, Agbad′doo
Millet, Ok′kablebba
Grass, Co′co
Beads, Le′key
Gold, Sic′ca
Coral, In′yoh
Silver, Patak′ka
Cloth, Atchio
Man, Okon′a
Woman, Obin′a
King, Ob′bah
Horse, Ep′pee
Saddle, Gar′ree
Bridle, Ja′noo
Pepper, Att′ah
Shallots, Allabous′sa
Yams, Ish′oo
Plantains, Ayid′dey
Fire, Jun′ah
Water, Om′mee
Wood, Ig′gie
A pot, Coc′co
A calabash, E′bah
Duck, Pap′ayeh
Soup, Ob′eh
House, Ill′eh
Mug, Tank′ara
Plate, A′wo
Knife, O′beh
Head, Or′ree
Eyes, Oj′oo
Nose, Em′oo
Mouth, En′oo
Teeth, E′hee
Ears, Eff′ee
Chin, Ebb′ee
Neck, Enaff′oo
Shoulders, Edgeookah
Arm, Epk′wa
Elbow, Ebah′wa
Wrist, Onawa′wa
Hand, A′wa
Thumb, Atang′pako
Fingers, Ama′wa
The body, Agwid′demoo′gu
Belly, Inn′oh
Thigh, E′tah
Knee, Okk′oo
Leg, Ajoo′goo
Ankle, Coco′sey
Foot, Atalis′sey
Toes, Amalis′sa
Boots, Sa′labattoo
Sandals, Battoo
Fan, Abab′bey
Cow, Mall′oo
Dog, Aj′ah
Cub, Aloghin′ne
Mouse, Acoo′fu
Tiger, Ek′ka
Hyena, Eco′co
Vulture, Awood′ec
Jacket, Kook′oomah
Trousers, Shock′ootoo
Turkey, Fu′lutu′loo
Elephant, Gen′acoo
Hippopotamus, En′emy
Cotton wool, O′woo
Palm oil, Ep′eh
Cocoa-nut, Ay′ba
Tornado, Oj′uma′ri
A mule, Barak′ka
A jackass, Kettékettéh
A mat, Enn′ee
A bag, Ok′key
A gun, E′bah
A cutlass, Jom′ma
Silk, Ce′dah
Damask Ala′ri
Scarlet cloth, Doh′do
Blue ditto, Iss′ado′doh
Green ditto, Alar′ooya′goo
Yellow ditto,
Tree, E′wajass′kway
Sun, O′noo
Moon, Ajoo′pa
Star, Era′wo
God, Ala′noo
Thunder, Ar′oo
Lightning, Mannumanu
Rain, Odigoo
Wind, Avoo′voo
Cap, Fill′ah
Hat, Atte′ Ebo
Hair, Olloo
Beard, Eg′bee
Skin, All′ah
Nail, Eff′eh
One, Ok′ka
Two, Ma′jee
Three, Mai′ta
Four, Me′ne
Five, Mall′oo
Six, Mai′ffa mai′fa
Seven, Ma′gee
Eight, Ma′jo
Nine, Mai′ssu
Ten, May′wah
Twenty, Ok′ko
Thirty, Agboug
Forty, Ogojee
Fifty, Adett′a
Sixty, Ogotta
Seventy, Ado′nee
Eighty, Ogonee
Ninety, Ado′noo
One hundred, Ogo′noo
Two hundred, Egbe′o
Three ditto, Oa′doo
Four ditto, In′ee
Five ditto, Edag′bett′a
Six ditto, Eg′bett′a
Seven ditto, Edag′be′ne
Eight ditto, Eg′be′ne
Nine ditto, Edegba′noo
One thousand Eggba′noo
Two ditto Ebah
Three ditto Egba′dagoo
Four ditto Egbagie
Five ditto Egbe′dogmoo
Six ditto Egbaa′ta
Seven ditto Edegbaa′nee
Eight ditto, Egba′nee
Nine ditto, Edegbaa′noo
Ten ditto, Ebaa′noo
FELLATAH.
One, Go
Two, Diddie
Three, Tattie
Four, Ni
Five, Jowie
Six, Jowego
Seven, Jowaddie
Eight, Jowatittie
Nine, Jowanie
Ten, Sapo
Eleven, Sapoago
Twelve, Sapodiddie
Thirteen, Sapoatittie
Fourteen, Sapoani
Fifteen, Sapoaji
Sixteen, Sapoajego
Seventeen, Sapoajaddide
Eighteen, Sapoajatittie
Nineteen, Sapoajanie
Twenty, Nogi
Twenty-one, Nogiago
Twenty-two, Nogiadiddie
Twenty-three, Nogiatittie
Twenty-four, Nogiani
Twenty-five, Nogiajowie
Twenty-six, Nogiajego
Twenty-seven, Nogiajadidde
Twenty-eight, Nogiajattitie
Twenty-nine, Nogiajanie
Thirty, Shapandatittie
Thirty-one, -------------- ago
Forty, Dabi
Fifty, Dabisapo
Sixty, Chapandijago
Seventy, Chapandajadidie
Eighty, Chapandagatittee
Ninety, Chapandajani
One hundred, Hemri
One hundred and one, Hemrigo
One hundred and two, Hemrididdie
One hundred and three, Hemritittie
One hundred and four, Hemrini
One hundred and five, Hemrijoie
Two hundred, Kamididdie
Three ditto, Kamitittie
Four ditto, Kamini
Five ditto, Kamijoie
One thousand, Koojuna
Two ditto, Koojunadiddie
Twenty ditto, Koojunaginogi
What is this? Konindadoom
Man, Gorko
Men, Worbaa
Woman, Debo
Women, Reuba
Boy, Beedo
Boys, Beepba
Girl, Surba
Girls, Surbaba
Horse, Putcha
Horses, Putche
Cow, Cows, Nagea.