Cover image
Try Now
2017-06-26

python driver for MCP3208

3 years

Works with Finder

3

Github Watches

7

Github Forks

16

Github Stars

.. figure:: https://raw.githubusercontent.com/MomsFriendlyRobotCompany/MCP3208/master/docs/pics/chip.png :width: 300px

MCP3208

.. image:: https://img.shields.io/pypi/l/mcp3208.svg :target: https://github.com/MomsFriendlyRobotCompany/mcp3208 .. image:: https://img.shields.io/pypi/pyversions/mcp3208.svg :target: https://github.com/MomsFriendlyRobotCompany/mcp3208 .. image:: https://img.shields.io/pypi/wheel/mcp3208.svg :target: https://github.com/MomsFriendlyRobotCompany/mcp3208 .. image:: https://img.shields.io/pypi/v/mcp3208.svg :target: https://github.com/MomsFriendlyRobotCompany/mcp3208

This is a python library designed to work with the MCP3208 ADC using SPI on a Raspberry Pi. The MCP3208 is capable of:

  • 12-bit resolution
  • ±1 LSB max DNL
  • ±1 LSB max INL (MCP3204/3208-B)
  • ±2 LSB max INL (MCP3204/3208-C)
  • 4 (MCP3204) or 8 (MCP3208) input channels
  • Analog inputs programmable as single-ended or pseudo-differential pairs
  • On-chip sample and hold
  • SPI serial interface (modes 0,0 and 1,1)
  • Single supply operation: 2.7V-5.5V
  • 100ksps max.sampling rate at VDD = 5V
  • 50ksps max. sampling rate at VDD = 2.7V
  • Low power CMOS technology
    • 500 nA typical standby current, 2 μA max.
    • 400 μA max. active current at 5V
  • Industrial temp range: -40°C to +85°C

For more information, see the datasheet <https://raw.githubusercontent.com/MomsFriendlyRobotCompany/MCP3208/master/docs/mcp3208.pdf>_.

Install

The preferred installation method is::

pip install mcp3208

Usage

.. code-block:: python

from mcp3208 import MCP3208
import time

adc = MCP3208()

while True:
	for i in range(8):
		print('ADC[{}]: {:.2f}'.format(i, adc.read(i)))
	time.sleep(0.5)

SPI Interface

This chip uses SPI to interface with the Raspberry Pi. Basically, the chip returns 12 bits contained in 3 bytes. You are able to read the MCP3208 either LSB or MSB first.

.. figure:: https://raw.githubusercontent.com/MomsFriendlyRobotCompany/MCP3208/master/docs/pics/waveform.png

MIT License

Copyright (c) 2017 Kevin J. Walchko

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

相关推荐

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • Lists Tailwind CSS classes in monospaced font

  • lumpenspace
  • Take an adjectivised noun, and create images making it progressively more adjective!

  • https://appia.in
  • Siri Shortcut Finder – your go-to place for discovering amazing Siri Shortcuts with ease

  • Carlos Ferrin
  • Encuentra películas y series en plataformas de streaming.

  • Yusuf Emre Yeşilyurt
  • I find academic articles and books for research and literature reviews.

  • tomoyoshi hirata
  • Sony α7IIIマニュアルアシスタント

  • apappascs
  • Discover the most comprehensive and up-to-date collection of MCP servers in the market. This repository serves as a centralized hub, offering an extensive catalog of open-source and proprietary MCP servers, complete with features, documentation links, and contributors.

  • ShrimpingIt
  • Micropython I2C-based manipulation of the MCP series GPIO expander, derived from Adafruit_MCP230xx

  • jae-jae
  • MCP server for fetch web page content using Playwright headless browser.

  • ravitemer
  • A powerful Neovim plugin for managing MCP (Model Context Protocol) servers

  • patruff
  • Bridge between Ollama and MCP servers, enabling local LLMs to use Model Context Protocol tools

  • pontusab
  • The Cursor & Windsurf community, find rules and MCPs

  • av
  • Effortlessly run LLM backends, APIs, frontends, and services with one command.

  • WangRongsheng
  • 🧑‍🚀 全世界最好的LLM资料总结(Agent框架、辅助编程、数据处理、模型训练、模型推理、o1 模型、MCP、小语言模型、视觉语言模型) | Summary of the world's best LLM resources.

  • Mintplex-Labs
  • The all-in-one Desktop & Docker AI application with built-in RAG, AI agents, No-code agent builder, MCP compatibility, and more.

  • appcypher
  • Awesome MCP Servers - A curated list of Model Context Protocol servers

    Reviews

    2 (1)
    Avatar
    user_ZtE6skD3
    2025-04-17

    I've been using the MCP3208 for various projects, and it's been incredibly reliable and versatile. As an MCP application enthusiast, this 8-channel 12-bit ADC has streamlined my data acquisition processes remarkably. The integration with my systems was seamless, thanks to the comprehensive documentation provided by BrainSpawnInfosphere. Anyone looking to enhance their analog-to-digital conversion should definitely check it out!