Learning IoT with Python and Raspberry Pi

Learning IoT with Python and Raspberry Pi

by E.I. Horvath, E.A. Horvath


Members save with free shipping everyday! 
See details


  • Code tested on the Raspberry Pi 3 and the new Raspberry Pi 4

  • Color photographs and circuit diagrams

  • 300+ code listings illustrate Python programming concepts

  • 250+ homework problems ranging from short Python scripts to web site configuration projects
  • Circuit examples

  • Labs on measuring voltage, current, and resistance using a multimeter

  • Send a text message if the light level detected by an LDR circuit falls below a threshold

  • Send an email if motion is detected using a PIR sensor circuit

  • Use an ultrasonic sensor in a proximity alert circuit and make a phone call if an intruder gets too close

  • Use a GPS HAT to get waypoints and store them in a file

  • Use an analog to digital converter to read in data from sensors

  • Control a servo using classes

  • Upload data to the cloud

  • Learn how to access a database using SQL statements

  • Deploy a home monitor system that uses the Raspberry Pi Camera and a PIR sensor circuit. Upload pictures to a web server in the cloud and access the pictures on a web page.

  • Control a robot using a multi-threaded application

Developing applications that operate in the realm of the Internet of Things requires, in addition to the mastery of a programming language, an understanding of networking, an understanding of how to use different platforms, an understanding of basic electronic circuits, and a familiarity with databases. Owing to its built-in WiFi capability and its forty general-purpose input/output pins, the Raspberry Pi computer is the ideal device for teaching students how to write code that controls electronic circuits whether the code is executed from a keyboard attached directly to the Raspberry Pi or executed from a smart phone. One of the most popular programming languages in the world, Python, is installed with the Raspbian operating system. Several Python packages enable the programmer to write code that turns an LED or a buzzer, gets data from a sensor, controls motors, and so on.

At the ends of Chapters 3-8, 11, and 12 are one or more circuit projects that involve assembling the electronic circuit(s) and writing Python code to control the circuit(s). Programming concepts covered in a particular chapter are implemented in the Python script that controls the circuit, thereby further elucidating the programming concepts. A short primer on electronic circuits is included in Appendix A and a list of the components and equipment needed is included in Appendix B. In Chapter 11, the student learns how to write code to control a servo motor that rotates a camera. In Chapter 12, the student learns how to write a multi-threaded application that controls a robot.

Because databases play an important role in many IoT systems, e.g., information obtained from IoT devices might be stored in a database, some basic SQL commands for interacting with a database as well as the Python code that executes SQL commands are explained in Chapter 9. Because certain IoT systems might need to display data gathered from IoT devices to a web site, step-by-step instructions for configuring a virtual web site and for generating dynamic web pages are included in Chapter 10. The home monitor system described in Chapter 10 is composed of a script that takes a picture if motion is detected and uploads the picture to the server, the motion sensor circuit, a database for storing pictures, a script that copies the picture to the database, and the virtual web site which allows Internet access to view the pictures. The home monitor project is designed to get the student to think in terms of a big picture view of an IoT system.

Some basic Linux commands are explained in Chapter 1 so that the student will be able to navigate the file system, edit files, find files, and so on from the Terminal. Linux commands are used to install software and are used in Chapter 10 to set up and test the home monitor system. A Raspberry Pi can be remotely accessed via SSH and via VNC. How to SSH into a Raspberry Pi is explained in Chapter 1, and the steps for using VNC to connect to a Raspberry Pi from a smart phone or a laptop are explained in Chapter 12. A VNC connection enables remote control of the robot.

Although Learning IoT with Python and Raspberry Pi is geared towards the beginning computer science student and the beginning engineering student, other STEM majors will find an understanding of the topics covered in this textbook to be an important part of their education. Since it is assumed that the student has no prior knowledge of the Python programming language, elementary circuits, Linux commands, how to access a database, or networking, this textbook will be accessible to the physics major, for instance, as well as to the computer science major or the computer engineering major.

Product Details

ISBN-13: 9780578549361
Publisher: Learning IoT LLC
Publication date: 09/01/2019
Pages: 760
Sales rank: 213,919
Product dimensions: 8.50(w) x 11.00(h) x 2.07(d)

About the Author

E.I. Horvath holds a B.S. in physics, a B.A. in applied mathematics, an M.S. in computer engineering, and a Ph.D. in computer engineering. Dr. Horvath has been a college professor for more than twenty years and has taught a wide range of classes including programming, network administration, network security, operating systems, database management, and web site administration classes.

E.A. Horvath holds a B.S. in physics, an M.S. in physics, and a Ph.D. in physics. Prior to teaching college physics courses and labs for eight years, Dr. Horvath worked as a software architect, developing an SMS-based application. Dr. Horvath has also developed a series of electromagnetism lectures available online from BocaPhysics.

Customer Reviews