Skip to main content

Python package for interfacing Texas Instruments ADS1255 and ADS1256 SPI bus based ADCs with the Raspberry Pi

Project description

PiPyADC

Python module for interfacing Texas Instruments ADS1255 and ADS1256 SPI bus based analog-to-digital converters with the Raspberry Pi.

This is a Python-based implementation using the pigpio Python interface to access the Raspberry Pi hardware through the pigpio system service.

On a Raspberry Pi 3, multi-channel ADC reads require a time overhead in the order of one millisecond per sample which makes this library suitable for low-speed, high resolution data acquisition.

As the ADS125x devices feature a sophisticated, configurable, hardware-based down-sampling filter, there is no penalty in terms of accuracy.

NEW in version 2:

  • Uses the pigpio API instead of the deprecated wiringpi library
  • Using pgpio, the user scripts do not have to be run as root any more
  • Working implementation for multiple ADS125x devices on the same SPI bus
  • Proper configuration of unused chip-select line for the Waveshare example

Since version 2.1:

  • ADS1256 now supports the Python with statement by acting as a Context Manager, allowing for automatic clean-up of SPI device and pigpio resources at exit. (See waveshare_example.py)
  • Many bug-fixes involving initialisation and clean-up and running multiple devices on the same SPI bus

Limitation:

  • Same as for version 1: This does not feature high-speed or low delays

Download: https://github.com/ul-gh/PiPyADC

Documentation of pigpio library: https://abyz.me.uk/rpi/pigpio/python.html
Uses code from: https://github.com/heathsd/PyADS1256

License: GNU LGPLv2.1, see: https://www.gnu.org/licenses/old-licenses/lgpl-2.1-standalone.html

Ulrich Lukas, 2022-08-30

Run example on Raspberry Pi OS:

Install:

# numpy is optional for running the Isoflux hardware examples
sudo apt install python3-pip python3-numpy pigpio python3-pigpio git
pip3 install pipyadc

Enable pigpio system service (started at boot)

sudo systemctl enable pigpiod.service

Activate SPI bus and reboot system

# Using raspi-config or, alternatively, using following command:
sudo sed -E -i s/"(#)(dtparam=spi).*"/"\2=on"/ /boot/config.txt
sudo reboot

Run example:

git clone https://github.com/ul-gh/PiPyADC
cd PiPyADC/examples/waveshare_board
./waveshare_example.py

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

pipyadc-2.1.tar.gz (25.9 kB view details)

Uploaded Source

Built Distribution

pipyadc-2.1-py3-none-any.whl (27.0 kB view details)

Uploaded Python 3

File details

Details for the file pipyadc-2.1.tar.gz.

File metadata

  • Download URL: pipyadc-2.1.tar.gz
  • Upload date:
  • Size: 25.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for pipyadc-2.1.tar.gz
Algorithm Hash digest
SHA256 c4e01722ec99ee81464b1d285cfaa10b59c50156a04cc3771e45b004d7a027d9
MD5 d2de36b561ae6743ec4ad7804607429c
BLAKE2b-256 7748819ce5ddd8bec075c217174a64533221c3983e77a3aa11fcfaf7caedd332

See more details on using hashes here.

File details

Details for the file pipyadc-2.1-py3-none-any.whl.

File metadata

  • Download URL: pipyadc-2.1-py3-none-any.whl
  • Upload date:
  • Size: 27.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for pipyadc-2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 21b9db4ad7545f7abe20ca69490d6bdb5d8e96fa34953eeda04c6b5b6b42808f
MD5 a1c9538d052f140aa19dacb173d49cd1
BLAKE2b-256 3d8310994c78cff172704dafa29413426f1af25c82f0f6e354e6484eecbc90ce

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