Chapter 3

Sensing the World with Python: The World of I2C

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

Before we get into how to sense the world in Python, let’s go through a few of the hardware issues. You can skip all this and still use Python to talk to these devices, of course, but some background is a good thing to have You can always go back over it later when you have some experience with these devices.

The available sensors for the Raspberry Pi and other small computers number in the thousands. From detecting people in front of your computer (PIR) to detecting a myriad of environmental conditions (temperature/humidity/air quality/and so on), there are many inexpensive ways to have your computer monitor the physical world. As always, the major thing you have to know about these sensors is how you can talk to them with a computer, which is commonly through the interface. The interface consists of two things: The hardware interface, which contains pins, types, ...

Get Python All-in-One For Dummies 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.