CircuitPython driver library for the Sparkfun AS3935 Lightning Detector
Project description
Introduction
CircuitPython library for Sparkfun Qwiic AS3935 Lightning Detector. This library is ported from SparkFun Qwiic AS3935 Lightning Detector Arduino Library
Dependencies
This driver depends on:
Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading the Adafruit library and driver bundle or individual libraries can be installed using circup.
Raspberry Pi Setup
Adafruit has an excellent tutorial on Installing CircuitPython Libraries on Raspberry Pi.
Quick Start Summary:
Start with the latest version of Raspbian with Wifi configured.
Enable SSH, I2C and SPI.
sudo raspi-config
Update your system to the latest version.
sudo apt-get update
sudo apt-get upgrade
Update the python tools
sudo pip3 install --upgrade setuptools
(If pip3 is not installed, install it and rerun the command)
sudo apt-get install python3-pip
Install the CircuitPython libraries
pip3 install RPI.GPIO
pip3 install adafruit-blinka
Installing from PyPI
On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally from PyPI. To install for current user:
pip3 install sparkfun-circuitpython-qwiicas3935
To install system-wide (this may be required in some cases):
sudo pip3 install sparkfun-circuitpython-qwiicas3935
To install in a virtual environment in your current project:
mkdir project-name && cd project-name
python3 -m venv .env
source .env/bin/activate
pip3 install sparkfun-circuitpython-qwiicas3935
Installing to a Connected CircuitPython Device with Circup
Make sure that you have circup installed in your Python environment. Install it with the following command if necessary:
pip3 install circup
With circup installed and your CircuitPython device connected use the following command to install:
circup install qwiicas3935
Or the following command to update an existing version:
circup update
Usage Example
Qwiic AS3935 Lightning Detector Hookup Guide - The Arduino examples in the Hookup Guide are available for Python with this library
CircuitPython on a Raspberry Pi - Basic information on how to install CircuitPython on a Raspberry Pi.
Code Example:
# import the CircuitPython board and busio libraries
import board
import sparkfun_qwiicas3935
# Create bus object using the board's I2C port
i2c = board.I2C()
as3935 = QwiicAS3935_I2C(i2c) # default address is 0x03
# OR create a library object using the board's SPI port
# spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
# cs = digitalio.DigitalInOut(board.CE0)
# cs.direction = digitalio.Direction.OUTPUT
# as3935 = QwiicAS3935_SPI(spi, cs)
Upgrading
On supported GNU/Linux systems like the Raspberry Pi, you can upgrade the driver to the latest published version.
To upgrade for current user:
pip3 install --upgrade sparkfun-circuitpython-qwiicjoystick
To upgrade system-wide (this may be required in some cases):
sudo pip3 install --upgrade sparkfun-circuitpython-qwiicjoystick
Contributing
Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.
Documentation
For information on building library documentation, please check out this guide.
Building locally
Zip release files
To build this library locally you’ll need to install the circuitpython-build-tools package.
python3 -m venv .env
source .env/bin/activate
pip install circuitpython-build-tools
Once installed, make sure you are in the virtual environment:
source .env/bin/activate
Then run the build:
circuitpython-build-bundles --filename_prefix sparkfun-circuitpython-qwiicas3935 --library_location .
Sphinx documentation
Sphinx is used to build the documentation based on rst files and comments in the code. First, install dependencies (feel free to reuse the virtual environment from above):
python3 -m venv .env
source .env/bin/activate
pip install Sphinx sphinx-rtd-theme
Now, once you have the virtual environment activated:
cd docs
sphinx-build -E -W -b html . _build/html
This will output the documentation to docs/_build/html. Open the index.html in your browser to view them. It will also (due to -W) error out on any warning like Travis will. This is a good way to locally verify it will pass.
License Information
This product is open source!
Please review the LICENSE.md file for license information.
Please use, reuse, and modify these files as you see fit.
Please maintain the attributions to SparkFun Electronics and Adafruit and release any derivative under the same license.
Distributed as-is; no warranty is given.
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
File details
Details for the file sparkfun-circuitpython-qwiicas3935-1.0.7.tar.gz
.
File metadata
- Download URL: sparkfun-circuitpython-qwiicas3935-1.0.7.tar.gz
- Upload date:
- Size: 41.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f7b16a3fa981e387a07c5340a2477bc99f7bf7f70364ada8c9835981f5a8901f |
|
MD5 | 99264fb8cae52093c239c6303197eda6 |
|
BLAKE2b-256 | 0a6741b5cc29c694cdfa45ac1ca56ba5b5139c4aea1d55a6c38c2df28ab56584 |