{"id":13893791,"url":"https://github.com/RobTillaart/MAX6675","last_synced_at":"2025-07-17T08:30:48.201Z","repository":{"id":41981405,"uuid":"447221837","full_name":"RobTillaart/MAX6675","owner":"RobTillaart","description":"Arduino library for MAX6675 chip for K type thermocouple","archived":false,"fork":false,"pushed_at":"2025-03-18T15:54:45.000Z","size":366,"stargazers_count":24,"open_issues_count":0,"forks_count":6,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-31T23:15:22.355Z","etag":null,"topics":["arduino","max6675","temperature","thermocouple"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RobTillaart.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"RobTillaart","custom":"https://www.paypal.me/robtillaart"}},"created_at":"2022-01-12T13:08:04.000Z","updated_at":"2025-04-30T14:38:47.000Z","dependencies_parsed_at":"2025-05-31T12:13:20.889Z","dependency_job_id":"60421a1b-70f4-4df8-a842-3f59e1b8b7a7","html_url":"https://github.com/RobTillaart/MAX6675","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/RobTillaart/MAX6675","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobTillaart%2FMAX6675","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobTillaart%2FMAX6675/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobTillaart%2FMAX6675/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobTillaart%2FMAX6675/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RobTillaart","download_url":"https://codeload.github.com/RobTillaart/MAX6675/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobTillaart%2FMAX6675/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265585273,"owners_count":23792712,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arduino","max6675","temperature","thermocouple"],"created_at":"2024-08-06T18:01:17.250Z","updated_at":"2025-07-17T08:30:48.194Z","avatar_url":"https://github.com/RobTillaart.png","language":"C++","funding_links":["https://github.com/sponsors/RobTillaart","https://www.paypal.me/robtillaart"],"categories":["C++"],"sub_categories":[],"readme":"\n[![Arduino CI](https://github.com/RobTillaart/MAX6675/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci)\n[![Arduino-lint](https://github.com/RobTillaart/MAX6675/actions/workflows/arduino-lint.yml/badge.svg)](https://github.com/RobTillaart/MAX6675/actions/workflows/arduino-lint.yml)\n[![JSON check](https://github.com/RobTillaart/MAX6675/actions/workflows/jsoncheck.yml/badge.svg)](https://github.com/RobTillaart/MAX6675/actions/workflows/jsoncheck.yml)\n[![GitHub issues](https://img.shields.io/github/issues/RobTillaart/MAX6675.svg)](https://github.com/RobTillaart/MAX6675/issues)\n\n[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/RobTillaart/MAX6675/blob/master/LICENSE)\n[![GitHub release](https://img.shields.io/github/release/RobTillaart/MAX6675.svg?maxAge=3600)](https://github.com/RobTillaart/MAX6675/releases)\n[![PlatformIO Registry](https://badges.registry.platformio.org/packages/robtillaart/library/MAX6675.svg)](https://registry.platformio.org/libraries/robtillaart/MAX6675)\n\n\n# MAX6675\n\nMax6675 is an Arduino library for MAX6675 chip with a K type thermocouple. \n\nThe library is based upon (stripped and adapted version of) the https://github.com/RobTillaart/MAX31855_RT library.\n\nCurrently the library is experimental, so use with care.\n\nHardware has finally arrived (April 2022) and I had time to do my first round of tests with an UNO at 16 MHz. \nThe library works and it reads temperatures well, both with HW SPI and SW SPI. \n\n\n## Description\n\nThe MAX6675 is a chip to convert the reading of a K-type thermocouple to a temperature. \nThe MAX6675 only supports positive degrees Celsius.\n\nThe values are read with an precision of **0.25°C.** \nTypical noise seen during usage are **± 0.5°C**, so using a low pass filter on the temperature might be a good idea.\n\nThe working of thermocouples (TC) is based upon Seebeck effect.\nDifferent TC's have a different Seebeck Coefficient (SC) expressed in µV/°C.\nSee http://www.analog.com/library/analogDialogue/archives/44-10/thermocouple.html\n\n\n### Breakout\n\nThe library is tested with a breakout board with following pins:\n\n```\n             +---------------------+\n             |          signal out |  --\u003e  MISO\n             | -       chip select |  \u003c--  SELECT\n    TC here  |               clock |  \u003c--  CLOCK    processor side\n             | +               VCC |  ---  VCC\n             |                 GND |  ---  GND\n             +---------------------+\n```\n\n\n### 0.3.0 Breaking change\n\nVersion 0.3.0 introduced a breaking change to improve handling the SPI dependency.\nThe user has to call **SPI.begin()** or equivalent before calling **AD.begin()**.\nOptionally the user can provide parameters to the **SPI.begin(...)**\n\n\n### 0.2.0 Breaking change\n\nThe version 0.2.0 has breaking changes in the interface. \nThe essence is removal of ESP32 specific code from the library. \nThis makes it possible to support the ESP32-S3 and other processors in the future. \nAlso it makes the library a bit simpler to maintain.\n\nNote the order of the parameters of the software SPI constructor has changed in 0.2.0.\n\n\n### Related\n\n- https://github.com/RobTillaart/MAX6675 \n- https://github.com/RobTillaart/MAX31850\n- https://github.com/RobTillaart/MAX31855_RT\n- https://github.com/RobTillaart/Temperature  conversion to (exotic) temperature scales.\n\n\n## Hardware SPI vs software SPI\n\n\n### Pins\n\nDefault pin connections.\n\n | HW SPI   |  UNO  |  ESP32 VSPI |  ESP32 HSPI | Notes\n |:---------|:-----:|:-----------:|:-----------:|:----------|\n | CLOCK    |  13   |   18        |   14        |\n | MISO     |  12   |   19        |   12        |\n | MOSI     |  11   |   23        |   13        |  *not used...*\n | SELECT   | eg. 4 |    5        |   15        |  *can be others too.*\n\n\n### Performance \n\nPerformance read() function, timing in us.  \n- UNO @ 16 MHz\n- TODO ESP32 @ 240 MHz\n\n| mode   |  clock   | timing UNO | timing ESP32 | Notes\n|:-------|---------:|-----------:|-------------:|:----------|\n| HW SPI |  4000000 |    36      |              | highest supported.\n| HW SPI |  3500000 |    40      |              |\n| HW SPI |  3000000 |    40      |              |\n| HW SPI |  2500000 |    40      |              |\n| HW SPI |  2000000 |    40-44   |              |\n| HW SPI |  1500000 |    48      |              |\n| HW SPI |  1000000 |    48-52   |              |\n| HW SPI |   500000 |    64-68   |              |\n| SW SPI | bit bang |    276     |              |\n\nNote the UNO micros() has a 4 us precision, but it is clear that\n4 Mb is not even twice the speed of 0.5 Mb.  \nTested with **MAX6675_test_HWSPI.ino**\n\n\n## Interface\n\n```cpp\n#include \"MAX6675.h\"\n```\n\n### Constructor\n\n- **MAX6675(uint8_t select, SPIClassRP2040 \\* mySPI)** hardware SPI R2040\n- **MAX6675(uint8_t select, SPIClass \\* mySPI)** hardware SPI other\n- **MAX6675(uint8_t select, uint8_t miso, uint8_t clock)** software SPI\n- **void begin()** initialize internals\n\n\n### Hardware SPI\n\nTo be used only if one needs a specific speed.\n\n- **void setSPIspeed(uint32_t speed)** set SPI transfer rate.\n- **uint32_t getSPIspeed()** returns SPI transfer rate.\n- **void setSWSPIdelay(uint16_t del = 0)** for tuning SW SPI signal quality. \nDel is the time in micros added per bit. Even numbers keep the duty cycle of the clock around 50%.\n- **uint16_t getSWSPIdelay()** get set value in micros.\n\n\n### Measurements\n\n- **uint8_t read()** makes a temperature measurement.\nIt returns the status of the read (0, 4 or 129)\n- **uint8_t getStatus()** returns the last status value of read().\nWill stay the same until a new **read()** call.\n- **float getTemperature()** returns last temperature in Celsius. (will be obsolete in future).\n- **float getCelsius()** returns last temperature in Celsius. (more explicit scale).\nWill stay the same until a new **read()** call.\n- **float getFahrenheit()** wrapper around getCelsius(). Returns last temperature in Fahrenheit.\nWill stay the same until a new **read()** call.\n\n\nTable: values returned from **uint8_t read()** and **uint8_t getStatus()**\n\nNote: this list is a subset of MAX31855 errors.\n\n|  Define                   |  value  |  Description                |  Action        |  Notes  |\n|:--------------------------|:-------:|:----------------------------|:---------------|:--------|\n|  STATUS_OK                |     0   |  OK                         |                |\n|  STATUS_ERROR             |     4   |  Thermocouple short to VCC  |  check wiring  |\n|  STATUS_NOREAD            |   128   |  No read done yet           |  check wiring  |  only before first read()\n|  STATUS_NO_COMMUNICATION  |   129   |  No communication           |  check wiring  |\n\n\nAfter **uint8_t read()** returns **STATUS_OK** you can get the temperature with \n**getCelsius()** or **getFahrenheit()**.\n\nRepeated calls to **getCelsius()** or **getFahrenheit()** will give the same value until a new \nmeasurement is made by calling **read()**.\n\nNote: if the **read()** fails the value of **getCelsius()** can become incorrect. \nSo it is important to check the return value of **read()**.\n\n\n### Offset\n\nThe library supports a fixed offset to calibrate the thermocouple.\nFor this the functions **float getOffset()** and **void setOffset(float offset)** are available.\nThis offset is \"added\" in the **getCelsius()** function.\n\nNote:\n- the offset is a constant in degrees Celsius (for Fahrenheit offset multiply by 1.8)\n- the offset used is a float, so decimals can be used.\nA typical usage is to call **setOffset(273.15)** to get degrees ° Kelvin.\n- the offset can be positive or negative.\n- the offset can cause negative temperatures to pop up at the lower end.\n\n\n### Delta analysis\n\nAs the **tc** object holds its last known temperature it is easy to determine the delta \nwith the last known temperature, e.g. for trend analysis.\n\n```cpp\n  float last = tc.getCelsius();\n  int state  = tc.read();\n  if (state == STATUS_OK)\n  {\n    float new  = tc.getCelsius();\n    float delta = new - last;\n    // process data\n  }\n```\n\n\n### Last time read\n\nThe **tc** object keeps track of the last time **read()** is called in the function **uint32_t lastRead()**.\nThe time is tracked in **millis()**. This makes it easy to read the sensor at certain intervals.\n\n```cpp\nif (millis() - tc.lastRead() \u003e= interval)\n{\n  int state = tc.read();\n  if (state == STATUS_OK)\n  {\n    float new = tc.getCelsius();\n    // process read value.\n  }\n  else\n  {\n    // handle error\n  }\n}\n```\n\n\n### GetRawData \n\nThe function **uint32_t getRawData()** allows you to get all the 32 bits raw data from the board, \nafter the standard **uint8_t tc.read()** call.\n\nExample code can be found in the examples folder.\n\n```cpp\n  int state = thermocouple.read();              \n  uint32_t value = thermocouple.getRawData();  // Read the raw Data value from the module\n```\n\nThis allows one to compact the measurement e.g. for storage or sending over a network.\n\n\n## Pull Up Resistor \n\nTo have proper working of the MAX6675 board, you need to add a pull-up resistor \n(e.g. 4K7 - 1K depending on wire length) between the MISO pin (from constructor call) and the \nVCC (5 Volt). This improves the signal quality and will allow you to detect if there is\nproper communication with the board. Without pull-up one might get random noise that could \nlook like real data.\n\n**Note:** the MISO pin can be different from each board, please refer to your board datasheet.\n\nIf the MAX6675 board is not connected **tc.read()** will return **STATUS_NO_COMMUNICATION**.\n\nYou can verify this by **tc.getRawData()** which will give 16 HIGH bits or 0xFFFF).\n\nYou can use a simple code to detect connection error board:\n\n```cpp\n  uint8_t status = thermocouple.read();\n  if (status == STATUS_NO_COMMUNICATION)\n  {\n    Serial.println(\"NO COMMUNICATION\");\n  }\n```\n\nor\n\n```cpp\n  uint8_t status = thermocouple.read();\n  if (thermocouple.getRawData() == 0xFFFF)\n  {\n    Serial.println(\"NO COMMUNICATION\");\n  }\n```\n\n\n## Operation\n\nSee examples\n\n\n## Future\n\n#### Must\n\n- update and verify documentation (as it is copied from MAX31855 lib)\n\n#### Should\n\n- keep interface in sync with MAX31855 if possible.\n\n#### Could\n\n- create example to distinguish between MAX6675 and MAX31855\n  - https://github.com/RobTillaart/MAX6675/issues/5\n\n#### Wont\n \n\n## Support\n\nIf you appreciate my libraries, you can support the development and maintenance.\nImprove the quality of the libraries by providing issues and Pull Requests, or\ndonate through PayPal or GitHub sponsors.\n\nThank you,\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRobTillaart%2FMAX6675","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FRobTillaart%2FMAX6675","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRobTillaart%2FMAX6675/lists"}