Book Image

Learning Beaglebone Python Programming

Book Image

Learning Beaglebone Python Programming

Overview of this book

Table of Contents (19 chapters)

Weather station

Until this point, we've only looked at relatively simple program examples, without any real scope to them. Let's take some time to build a more complete program that actually accomplishes a practical task, a weather station.

Let's start with the hardware. We'll use a HTU21D I2C relative humidity sensor (for example,, as well as a BMP183 SPI pressure sensor (for example, Both include internal temperature sensors from which we can retrieve data, so we won't need an additional temperature sensor.

For this circuit, you will need:

  • Breadboard

  • 1x HTU21D breakout board

  • 1x BMP183 breakout board

  • Jumper wires

Wire up the breakout boards as shown:

PyBBIO includes libraries for both sensors, so we'll use it for this program. For starters, let's look at getting the data from the sensors:

from bbio import *
from bbio.libraries.BMP183 import BMP183
from bbio.libraries.HTU21D import HTU21D

bmp = BMP183(SPI0)
htu = HTU21D...