Coder Social home page Coder Social logo

circuitpython_ina3221's Introduction

Introduction

Documentation Status Discord Build Status

CircuitPython driver for the Texas Instruments' INA3221 3 channels current sensor. Product page at ti.com.

2 version are available:

  • barbudor_ina3221.full includes all constants for low-level register access + API for alarms
  • barbudor_ina3221.lite only basic API and no constants - use less memory

Pick only one depending your needs. On processors with limited amount of memory (SAMD21), the lite version is recommended. You may want to use mpy-cross to precompile the library to an .mpy file for lower memory footprint.

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.

For versions of CircuitPython before v6.0, please use ina3221 library v1.2.0. Version 2.0.0 of the lib as been changed to follow the breaking changes in busdevice.i2c_device.

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 --user barbudor-circuitpython-ina3221

To install system-wide (this may be required in some cases):

sudo pip3 install barbudor-circuitpython-ina3221

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 barbudor-circuitpython-ina3221

Usage Example

see example.

Contributing

Contributions welcomed. My goal is to keep the library simple and as low on memory as possible.

circuitpython_ina3221's People

Contributors

barbudor avatar mcauser avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

roarnyg neaxi ma3oun

circuitpython_ina3221's Issues

Add method to check data ready flag

I added this method to my class that uses your libray using self.ina3221 as the instance of your library. But this could be included in your library.

This aids waiting for available data.

def ina3221_CRF(self): # get conv_ready_flag regvalue = self.ina3221.read(ina.C_REG_MASK_ENABLE) value = (regvalue & ina.C_CONV_READY_FLAG) return (value==1)

Question: how to install on Raspberry Pi

I know the readme says its not available via PyPI. How would I go about installing this library on a Raspberry Pi? Can I download the release zip and use pip3 to install somehow?

I tried the following but it didn't work so must be a bit more involved to install.

$ sudo pip3 install barbudor_ina3221.precompiled.binaries.zip
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Processing ./barbudor_ina3221.precompiled.binaries.zip
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/usr/lib/python3.7/tokenize.py", line 447, in open
        buffer = _builtin_open(filename, 'rb')
    FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-req-build-rn99zd6q/setup.py'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.