Chapter 3

Sensing the World

IN THIS CHAPTER

Bullet Discovering how to use I2C sensors

Bullet Sensing your environment with a Raspberry Pi

Bullet Collecting and saving data

Bullet Connecting Python to your smartphone

Sensors for the Raspberry Pi and other small computers number in the thousands. From detecting people in front of your computer with a passive infrared (PIR) sensor to detecting a myriad of environmental conditions (temperature, humidity, air quality, and so on), your computer can monitor the physical world in many inexpensive ways. In this chapter, you discover how to program your computer to communicate with these sensors.

To download the code for this chapter, go to www.dummies.com/go/pythonaiofd3e, scroll down to the Downloads link, and click the link for the Book 6 code.

Understanding I2C

For a computer to talk to sensors, it needs an interface. An interface consists of a hardware interface, which contains pins, types, and voltage levels, and a software interface, which is usually called a driver or an application programming interface (API). In this book, the software interface is a Python ...

Get Python All-in-One For Dummies, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.