GY-63_MS5611/libraries/MAX31850
2023-01-23 15:19:15 +01:00
..
.github 0.1.2 MAX31850 2023-01-23 15:19:15 +01:00
examples 0.1.2 MAX31850 2023-01-23 15:19:15 +01:00
test 0.1.2 MAX31850 2023-01-23 15:19:15 +01:00
.arduino-ci.yml 0.1.1 MAX31850 2022-11-16 20:52:35 +01:00
CHANGELOG.md 0.1.2 MAX31850 2023-01-23 15:19:15 +01:00
keywords.txt 0.1.2 MAX31850 2023-01-23 15:19:15 +01:00
library.json 0.1.2 MAX31850 2023-01-23 15:19:15 +01:00
library.properties 0.1.2 MAX31850 2023-01-23 15:19:15 +01:00
LICENSE 0.1.2 MAX31850 2023-01-23 15:19:15 +01:00
MAX31850.cpp 0.1.2 MAX31850 2023-01-23 15:19:15 +01:00
MAX31850.h 0.1.2 MAX31850 2023-01-23 15:19:15 +01:00
README.md 0.1.2 MAX31850 2023-01-23 15:19:15 +01:00

Arduino CI Arduino-lint JSON check License: MIT GitHub release

MAX31850

Arduino library for the MAX31850 / MAX31851 thermocouple sensor.

Description

WARNING EXPERIMENTAL needs more testing (no hardware yet). (feedback welcome)

his MAX31850 library is not a full featured library for the MAX31850 family.

The MAX31850/1 is a Cold-Junction Compensated, 1-Wire Thermocouple-to-Digital Converter.

The MAX31850/1 supports K-, J-, N-, T-, S-, R-, and E-type thermocouples. (to be tested).

The library supports both the MAX31850 and MAX31851 but is limited to one sensor per pin. The only feature the class supports is the asynchronous reading of the temperature.

This allowed the class to be both minimal in size and non-blocking. In fact the class has no support for a synchronous read in one call. This choice will teach people how to work in a non-blocking way from the start.

Finally this library will probably make it easier to use a MAX31850 with processing boards or IC's with small memory footprint.

The MAX31851 is (for now) functional identical to MAX31850.

Hardware connection

//  PROCESSOR        MAX31850       THERMOCOUPLE
//              +---------------+
//   GND   1    | o           o |   T+
//   DATA  2    | o             |
//   VCC   3    | o           o |   T-
//              |               |
//              |     oooo      |
//              +---------------+
//               4 address pins.

This library supports only one MAX31850 per Arduino/ MCU IO pin.

Pull up resistor

Connect a pull-up resistor 4.7 KOhm between DATA (pin 3) and VCC (pin 2). When the wires are longer this resistor needs to be smaller.

An indicative table for pull up resistors, (E12 series), to get started.

Note: thicker wires require smaller resistors (typically 1 step in E12 series)

Length 5.0 Volt 3.3 Volt
10cm (4") 10K0 6K8
20cm (8") 8K2 4K7
50cm (20") 4K7 3K3
100cm (3'4") 3K3 2K2
200cm (6'8") 2K2 1K0
500cm (16'8") 1K0 *
longer * *

* = no info, smaller

Interface

#include "MAX31850.h"

Constructor

  • explicit MAX31850(OneWire * oneWire) constructor.
  • bool begin(uint8_t retries = 3) initialize the library. Returns true if addresses are found. Nr of retries can be adjusted if needed, default 3.
  • bool getAddress(uint8_t * buffer) get the address if found.

Read the sensor

  • void requestTemperatures(void) Asynchronous request to start conversion.
  • bool isConversionComplete(void) CHeck if requested conversion is done.
  • float read(void) read the data from the sensor. Returns the temperature of the thermoCouple as this is most often needed.
  • float getTempTC(void) returns temperature of the ThermoCouple from cache. One must call read() again to get new measurements.
  • float getTempInternal(void) returns internal temperature from cache. One must call read() again to get new measurements.

Other

  • uint8_t getAddressPins() binary form of the 4 address bits. 0x00..0x0F.
  • uint8_t getErrorCode() get the internal error code. See below.
  • bool setTypeTC(char typeTC) typeTC is one char from E J K N R S T
  • uint8_t getTypeTC() returns the current TC type.

Types of thermocouples

The MAX31850 comes in MAX31850E.. MAX31850T types reflecting the version of TC to use.

Sensor type SC in µV/°C Temp Range in °C Material notes
E_TC 76.373 -270 to +1000 Constantan Chromel
J_TC 57.953 -210 to +1200 Constantan Iron
K_TC 41.276 -270 to +1372 Alumel Chromel most used
N_TC 36.256 -270 to +1300 Nisil Nicrosil
R_TC 10.506 -50 to +1768 Platinum Platinum/Rhodium
S_TC 9.587 +50 to +1768 Platinum Platinum/Rhodium
T_TC 52.18 -270 to +400 Constantan Copper

(MAX31851 idem)

Error codes

name value
MAX31850_OK 0
MAX31850_ERR_SHORT_OPEN 1
MAX31850_ERR_SHORT_GND 2
MAX31850_ERR_SHORT_VDD 4

Future

Must

  • improve documentation
  • get hardware to test (sponsors welcome)
  • test on different platforms

Should

  • investigate different thermocouples
  • test with different platforms
  • has the 31851 special features to implement?

could

  • extend error handling
  • expand to multi sensor per pin.
    • first get one sensor working
  • investigate range checking on type TC
    • need setType() and more.
    • need lower upper range = int16_t will do.
  • add CRC check
      • error code

Wont