Raspberry Pi library for sensors DHT11, BMP085, DS18B20, WireGate DR9490R and more!

Working with sensors on the Raspberry Pi is real fun. You can try out stuff, expand the Internet of things, make automations and so on.

The problem for me was that there were so many different scripts out there with different functionalities and outputs. I wanted to make on package with unified in and output and there it is. It would have never been possible with the excellent work of Adafruit Industries (DHT, DS18B20 and BMP085 driver) and of course Matt Hawkins from www.raspberrypi-spy.co.uk (Ultrasonic and PIR driver)

Currently supported sensors: DHT11, DHT22, AM2302 (temperature and humidity), DS18B20 (temperature, with kernel driver or Wiregate), HC-SR04 (Ultrasonic distance sensor), BMP085 (Temperature, pressure, altitude), PIR (Motion detection)

DHT11, DHT22, AM2302, DS18B20, WireGate DR9490R, HC-SR04 (Ultrasonic Sensor),  BMP085 (Temperate, Pressure, Altitude), PIR

 

You can get the whole package from here: rpi_sensors

Or get it via Github (make sure to put all into one directory)

git clone https://github.com/syss/rpi_sensors
git clone https://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code/tree/master/Adafruit_BMP085

When you want to use this library you need to install the following packages: python-dev python-smbus owfs-fuse

This can be done by the following command

#update lists and upgrade software first
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install -y python-dev python-smbus owfs-fuse

It is very convenient to load all needed modules on startup. You need to disable the blacklisted modules (default on raspbian image) here:

/etc/modprobe.d/raspi-blacklist.conf

just comment out the blacklist lines with a sharp (#)

# blacklist spi and i2c by default (many users don't need them)

#blacklist spi-bcm2708
#blacklist i2c-bcm2708

then you need to set the modules which should be loaded on startup. You will find them here:

/etc/modules

edit it so it looks like this.

# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.
# Parameters can be specified after the module name.

snd-bcm2835
#Used for BMP085
i2c-dev
i2c-bcm2708
spi_bcm2708
#Used for 1-Wire DS18B20
w1-gpio
w1-therm

If you use the Dallas Wiregate (DR9490R) you can do these easy steps to make it work with this python library. (make sure you have installed the package owfs-fuse). I found the commands from this site

sudo mkdir /media/1-wire
sudo owfs --allow_other -u /media/1-wire

Now you are done and can use the Python library for your projects.

Some examples will follow in the next days.

 

 

 

2 thoughts on “Raspberry Pi library for sensors DHT11, BMP085, DS18B20, WireGate DR9490R and more!”

  1. Hallo,

    kannst du bitte eine Anleitung machen wie man die Bibliothek jetzt benutzt. Danke!

  2. Hi, das klingt alles echt interessant und nützlich. Danke für die Arbeit und dass Du das mit der Welt teilst.

    Ich glaube jeder der das bei Google ffindet freut sich über ein, zwei Beispiele :).

    Gruß

    Leonard

Leave a Reply

Your email address will not be published. Required fields are marked *