Skip to main content

A series of convenience functions for Raspbery PI sensors

Project description

Raspberry Pi Sensors

This is a Python 3 package that enables Raspberry Pi to read various sensors .It has been tested on Python 3.5/Raspbian (stretch). Supported devices include:

  • HCSR04 ultrasonic sensor
  • PCA9685 Adafruit 16-channel 12 Bit PWM Driver
  • BMP280 Barometer
  • Triple Axis Magnetometer QMC5883L
  • AS3935 lightning sensor MOD-1016 embedded adventures

REQUIREMENTS

  1. adafruit-circuitpython-servokit

Installation

  1. From source (incl. examples, fritzing and ebooks)
      git clone https://github.com/hanshof/rpiSensors.git
      cd rpiSensors
      python install setup.py
  1. PIP
    pip install raspiSensors
    

HCSR04 ultrasonic sensor

This is the HC-SR04 ultrasonic distance sensor. This economical sensor provides 2cm to 400cm of non-contact measurement functionality with a ranging accuracy that can reach up to 3mm. Each HC-SR04 module includes an ultrasonic transmitter , a receiver and a control circuit.

There are only four pins that you need to worry about on the HC-SR04: VCC (Power), Trig (Trigger), Echo (Receive), and GND (Ground). You will find this sensor very easy to set up and use for your next range-finding project!

Example:

  from raspiSensors import hcsr04 as HCSR04
  ultrasonic = HCSR04(trigger_pin = 21, echo_pin = 20)
  print(ultrasonic.distance())

  returns distance in cm
  

PCA9685 Adafruit 16-channel 12 Bit PWM Driver

Using only two pins, control 16 free-running PWM outputs! You can even chain up 62 breakouts to control up to 992 PWM outputs (which we would really like to see since it would be glorious) It's an i2c-controlled PWM driver with a built in clock. That means that, unlike the TLC5940 family, you do not need to continuously send it signal tying up your microcontroller, its completely free running! It is 5V compliant, which means you can control it from a 3.3V microcontroller and still safely drive up to 6V outputs (this is good for when you want to control white or blue LEDs with 3.4+ forward voltages) 6 address select pins so you can wire up to 62 of these on a single i2c bus, a total of 992 outputs - that's a lot of servos or LEDs Adjustable frequency PWM up to about 1.6 KHz 12-bit resolution for each output - for servos, that means about 4us resolution at 60Hz update rate Configurable push-pull or open-drain output Output enable pin to quickly disable all the outputs

Example:

    from raspiSensors import pca9685 as PCA9685
    servos = PCA9685(channels=16)
    
    servos.kit.servo[0].angle = 90

BMP280 Barometer

This is a Barometer Pressure Sensor module It could measure the pressure and temperature. This program depend on BMP280.py writted by Adafruit.

Triple Axis Magnetometer QMC5883L

Magnetometer QMC5883L is used for measuring the direction and magnitude of the Earth’s magnetic field. It is used for low cost compassing and magnetometry. It measures the Earth’s magnetic field value along the X, Y and Z axes from milli-gauss to 8 gauss. It can be used to find the direction of heading of the device. It uses I2C protocol for communication with microcontroller.

AS3935 lightning sensor MOD-1016 embedded adventures

The MOD1016 is a lightning sensor based on the AMS3935. It allows you to detect storms up to 40km away.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

raspiSensors-2019.3.26.tar.gz (14.0 kB view details)

Uploaded Source

File details

Details for the file raspiSensors-2019.3.26.tar.gz.

File metadata

  • Download URL: raspiSensors-2019.3.26.tar.gz
  • Upload date:
  • Size: 14.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1

File hashes

Hashes for raspiSensors-2019.3.26.tar.gz
Algorithm Hash digest
SHA256 63946ff9ace1186cd40687c598409a7803f20ff04e22e9f3f420a06818ffaf6f
MD5 a583b34513cbdc62ec0068a303f786ae
BLAKE2b-256 8609f9b7672d9d6e802429708cbcd428a16c7e8bd01f4cd85e383d294c3f754c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page