Skip to content
Alexander Hiam edited this page Oct 16, 2015 · 4 revisions

MAX31855 is a library for PyBBIO to interface with Maxim's MAX31855 cold-junction compensated thermocouple amplifiers. There are different versions of MAX31855 for K-, J-, N-, T-, S-, R-, and E-type thermocouples, and their type is given by the letter following MAX31855 in the part number, e.g. the K-type version is part number MAX31855K.

Check out Adafruit's great tutorial on thermocouples here, as well as their breakout board for the MAX31855K.

The MAX31855 uses SPI to communicate - see the SPI documentation for more info.

There is an example program for the MAX31855 library at [PyBBIO/examples/MAX31855_test.py].(https://github.com/alexanderhiam/PyBBIO/blob/master/examples/MAX31855_test.py)

API:

MAX31855(spi_bus, spi_cs, offset=0)

Creates an instance of the MAX31855 class using the given SPI bus and chip select. Can be passed an optional offset in degrees Celsius to add to the value read.

MAX31855.readTempC()

Reads and returns the 14-bit signed temperature in Celsius if no error is reported. If the amplifier does report an error, an error code is recorded to MAX31855.error and None is returned.

MAX31855.readTempF()

Reads and returns the 14-bit signed temperature in Fahrenheit if no error is reported. If the amplifier does report an error, an error code is recorded to MAX31855.error and None is returned.

MAX31855.readTempInternal()

Reads and returns the amplifier's 12-bit signed internal temperature in Celsius if no error is reported. If the amplifier does report an error, an error code is recorded to MAX31855.error and None is returned.

MAX31855.error

An instance variable which holds the last error code reported or None. The error code will one of:

  • MAX31855.OPEN_CIRCUIT - if no thermocouple is attached
  • MAX31855.SHORT_TO_GND - if either thermocouple pin is shorted to GND
  • MAX31855.SHORT_TO_VCC - if either thermocouple pin is shorted to VCC
Clone this wiki locally