Git Product home page Git Product logo

python-mcp342x's Introduction

MCP342x

A Python module to support Microchip MCP342x analogue to digital converters. The devices use the I2C bus. For the low level I2C protocol this module depends on SMBus.

Supported devices

  • MCP3422: 2 channel, 12, 14, 16, or 18 bit
  • MCP3423: 2 channel, 12, 14, 16, or 18 bit
  • MCP3424: 4 channel, 12, 14, 16, or 18 bit
  • MCP3426: 2 channel, 12, 14, or 16 bit
  • MCP3427: 2 channel, 12, 14, or 16 bit
  • MCP3428: 4 channel, 12, 14, or 16 bit

The MCP3422 and MCP3426 use I2C address 0x68, all other devices can be configured to use any address in the range 0x68 - 0x6F (inclusive).

python-mcp342x's People

Contributors

jrm224 avatar stevemarple avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

python-mcp342x's Issues

I can not run the setup.py file in my rasbian python terminal

When i tried run 'sudo python MCP342x install' in my cd mcp342x terminal window it gave me an error. it said to me : 'compilation terminated. error: Setup script exited with error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1 '. besides this error it has also problems with finding a package called 'libffi'.

How can i solve these problems?

when running the example, an error occurs

when running on a pi3b ith latest (today) Rasbian and Thonny python IDE (3.7.3), I get a error result when I start the example

%Run mpc3432.py
Traceback (most recent call last):
File "/home/pi/AirQuality/MCP3424 ADC/mpc3432.py", line 55, in
r = MCP342x.convert_and_read_many(adcs, samples=2)
File "/home/pi/.local/lib/python3.7/site-packages/MCP342x/init.py", line 145, in convert_and_read_many
a.configure()
File "/home/pi/.local/lib/python3.7/site-packages/MCP342x/init.py", line 293, in configure
+ ' gain: ' + str(self.get_gain()))
File "/home/pi/.local/lib/python3.7/site-packages/MCP342x/init.py", line 221, in get_channel
return [g for g, c in MCP342x._channel_to_config.iteritems() if c == self.config & MCP342x._channel_mask][0]
AttributeError: 'dict' object has no attribute 'iteritems'

Problem with the smbus library

I ran into this while installing on the latest jessie image. the smbus dependence is using an out of date version smbus-cffi. In the version I downloaded I changed it to "smbus" and installed with sudo and everything worked great.

Fail to install MCP342X in Raspberry Pi 3B.

I have tried:

wget https://github.com/stevemarple/python-MCP342x/archive/master.zip
unzip master.zip
cd python-MCP342x-master/
sudo python setup.py install

I got this:

==================================
['MCP342x']
==================================
running install
Checking .pth file support in /usr/local/lib/python3.5/dist-packages/
/usr/bin/python3 -E -c pass
TEST PASSED: /usr/local/lib/python3.5/dist-packages/ appears to support .pth files
running bdist_egg
running egg_info
writing dependency_links to MCP342x.egg-info/dependency_links.txt
writing top-level names to MCP342x.egg-info/top_level.txt
writing MCP342x.egg-info/PKG-INFO
writing requirements to MCP342x.egg-info/requires.txt
reading manifest file 'MCP342x.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'MCP342x/examples/convert_read_many.py'
writing manifest file 'MCP342x.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-armv7l/egg
running install_lib
running build_py
creating build/lib
creating build/lib/MCP342x
copying MCP342x/init.py -> build/lib/MCP342x
creating build/bdist.linux-armv7l/egg
creating build/bdist.linux-armv7l/egg/MCP342x
copying build/lib/MCP342x/init.py -> build/bdist.linux-armv7l/egg/MCP342x
byte-compiling build/bdist.linux-armv7l/egg/MCP342x/init.py to init.cpython-35.pyc
creating build/bdist.linux-armv7l/egg/EGG-INFO
copying MCP342x.egg-info/PKG-INFO -> build/bdist.linux-armv7l/egg/EGG-INFO
copying MCP342x.egg-info/SOURCES.txt -> build/bdist.linux-armv7l/egg/EGG-INFO
copying MCP342x.egg-info/dependency_links.txt -> build/bdist.linux-armv7l/egg/EGG-INFO
copying MCP342x.egg-info/requires.txt -> build/bdist.linux-armv7l/egg/EGG-INFO
copying MCP342x.egg-info/top_level.txt -> build/bdist.linux-armv7l/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating 'dist/MCP342x-0.3.4-py3.5.egg' and adding 'build/bdist.linux-armv7l/egg' to it
removing 'build/bdist.linux-armv7l/egg' (and everything under it)
Processing MCP342x-0.3.4-py3.5.egg
Removing /usr/local/lib/python3.5/dist-packages/MCP342x-0.3.4-py3.5.egg
Copying MCP342x-0.3.4-py3.5.egg to /usr/local/lib/python3.5/dist-packages
MCP342x 0.3.4 is already the active version in easy-install.pth

Installed /usr/local/lib/python3.5/dist-packages/MCP342x-0.3.4-py3.5.egg
Processing dependencies for MCP342x==0.3.4
Searching for smbus
Reading https://pypi.python.org/simple/smbus/
Couldn't find index page for 'smbus' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading https://pypi.python.org/simple/
No local packages or download links found for smbus
error: Could not find suitable distribution for Requirement.parse('smbus')

and I have tried this, too:

sudo pip install MCP342x

and I got:

The directory '/home/pi/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/pi/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting MCP342x
Downloading MCP342x-0.3.4.tar.gz
Collecting smbus (from MCP342x)
Could not find a version that satisfies the requirement smbus (from MCP342x) (from versions: )
No matching distribution found for smbus (from MCP342x)
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

It seems that there is something wrong with smbus .

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.