Coder Social home page Coder Social logo

nachocarballeda / adafruit_circuitpython_mcp9600 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from adafruit/adafruit_circuitpython_mcp9600

0.0 0.0 0.0 121 KB

CircuitPython driver for the MCP9600 thermocouple I2C amplifier.

License: MIT License

Python 100.00%

adafruit_circuitpython_mcp9600's Introduction

Introduction

Documentation Status Discord Build Status Code Style: Black

This is a CircuitPython driver for the MCP9600 thermocouple I2C amplifier. In addition to the MCP9600 breakout, you will also need a thermocouple, which can be found in the Adafruit store. The MCP9600 supports several thermocouple types for different temperature ranges. The "K" type is the default, with a range of -200C to +1372C.

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.

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 adafruit-circuitpython-mcp9600

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

sudo pip3 install adafruit-circuitpython-mcp9600

To install in a virtual environment in your current project:

mkdir project-name && cd project-name
python3 -m venv .venv
source .venv/bin/activate
pip3 install adafruit-circuitpython-mcp9600

Usage Example

This is a simple example showing the hot junction temperature (the temperature at the tip of the thermocouple). You may need to adjust the I2C frequency if you receive input/output errors.

import board
import busio
from adafruit_bus_device.i2c_device import I2CDevice
from adafruit_mcp9600 import MCP9600

i2c = busio.I2C(board.SCL, board.SDA,frequency=200000)
try:
    # using default I2C register and "K" thermocouple
    device = MCP9600(i2c)
    print("temperature(C):",device.temperature)
except ValueError:
    print("MCP9600 sensor not detected")

This example displays the ambient/room and hot junction temperatures at 1 second intervals. Turn on the Mu editor's plotter option to view the temperatures in a real-time graph.

import board
import busio
import time
from adafruit_bus_device.i2c_device import I2CDevice
from adafruit_mcp9600 import MCP9600

i2c = busio.I2C(board.SCL, board.SDA, frequency=200000)

try:
    device = MCP9600(i2c)
    print("version:", device.version)
    while True:
        print((
            device.ambient_temperature,
            device.temperature
        ))
        time.sleep(1)
except ValueError:
    print("MCP9600 sensor not detected")

Documentation

API documentation for this library can be found on Read the Docs.

For information on building library documentation, please check out this guide.

Contributing

Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.

adafruit_circuitpython_mcp9600's People

Contributors

evaherrada avatar cogliano avatar kattni avatar tekktrik avatar sommersoft avatar ladyada avatar foamyguy avatar dhalbert avatar angerer avatar tannewt avatar caternuson avatar jposada202020 avatar siddacious avatar

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.