/ README.rst
README.rst
  1  Introduction
  2  ============
  3  
  4  .. image:: https://readthedocs.org/projects/adafruit-circuitpython-mcp9600/badge/?version=latest
  5      :target: https://circuitpython.readthedocs.io/projects/mcp9600/en/latest/
  6      :alt: Documentation Status
  7  
  8  .. image:: https://img.shields.io/discord/327254708534116352.svg
  9      :target: https://adafru.it/discord
 10      :alt: Discord
 11  
 12  .. image:: https://github.com/adafruit/Adafruit_CircuitPython_MCP9600/workflows/Build%20CI/badge.svg
 13      :target: https://github.com/adafruit/Adafruit_CircuitPython_MCP9600/actions/
 14      :alt: Build Status
 15  
 16  This is a CircuitPython driver for the MCP9600 thermocouple I2C amplifier. 
 17  In addition to the MCP9600 breakout, you will also need a thermocouple, which
 18  can be found in the Adafruit store. 
 19  The MCP9600 supports several thermocouple types for different temperature
 20  ranges. The "K" type is the default, with a range of -200C to +1372C.
 21  
 22  
 23  Dependencies
 24  =============
 25  This driver depends on:
 26  
 27  * `Adafruit CircuitPython <https://github.com/adafruit/circuitpython>`_
 28  
 29  Please ensure all dependencies are available on the CircuitPython filesystem.
 30  This is easily achieved by downloading
 31  `the Adafruit library and driver bundle <https://github.com/adafruit/Adafruit_CircuitPython_Bundle>`_.
 32  
 33  Installing from PyPI
 34  ====================
 35  
 36  On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from
 37  PyPI <https://pypi.org/project/adafruit-circuitpython-mcp9600/>`_. To install for current user:
 38  
 39  .. code-block:: shell
 40  
 41      pip3 install adafruit-circuitpython-mcp9600
 42  
 43  To install system-wide (this may be required in some cases):
 44  
 45  .. code-block:: shell
 46  
 47      sudo pip3 install adafruit-circuitpython-mcp9600
 48      
 49  To install in a virtual environment in your current project:
 50  
 51  .. code-block:: shell
 52  
 53      mkdir project-name && cd project-name
 54      python3 -m venv .env
 55      source .env/bin/activate
 56      pip3 install adafruit-circuitpython-mcp9600
 57      
 58  Usage Example
 59  =============
 60  
 61  This is a simple example showing the hot junction temperature (the
 62  temperature at the tip of the thermocouple). You may need to adjust the 
 63  I2C frequency if you receive input/output errors.
 64  
 65  .. code-block:: shell
 66  
 67      import board
 68      import busio
 69      from adafruit_bus_device.i2c_device import I2CDevice
 70      from adafruit_mcp9600 import MCP9600
 71  
 72      i2c = busio.I2C(board.SCL, board.SDA,frequency=200000)
 73      try:
 74          # using default I2C register and "K" thermocouple
 75          device = MCP9600(i2c)
 76          print("temperature(C):",device.temperature)
 77      except ValueError:
 78          print("MCP9600 sensor not detected")
 79  
 80  This example displays the ambient/room and hot junction temperatures at
 81  1 second intervals. Turn on the Mu editor's plotter option to view the 
 82  temperatures in a real-time graph.
 83  
 84  .. code-block:: shell
 85  
 86      import board
 87      import busio
 88      import time
 89      from adafruit_bus_device.i2c_device import I2CDevice
 90      from adafruit_mcp9600 import MCP9600
 91  
 92      i2c = busio.I2C(board.SCL, board.SDA, frequency=200000)
 93  
 94      try:
 95          device = MCP9600(i2c)
 96          print("version:", device.version)
 97          while True:
 98              print((
 99                  device.ambient_temperature, 
100                  device.temperature 
101              ))
102              time.sleep(1)
103      except ValueError:
104          print("MCP9600 sensor not detected")
105  
106  
107  Contributing
108  ============
109  
110  Contributions are welcome! Please read our `Code of Conduct
111  <https://github.com/adafruit/Adafruit_CircuitPython_MCP9600/blob/master/CODE_OF_CONDUCT.md>`_
112  before contributing to help this project stay welcoming.
113  
114  Documentation
115  =============
116  
117  For information on building library documentation, please check out `this guide <https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/sharing-our-docs-on-readthedocs#sphinx-5-1>`_.