Multiple MAX31865+PT1000 Temperature Sensors for ARDUINO
This is for several MAX31865 & PT1000.
I use MAX31865 x 4.
MCU is ATmega128A.
https://github.com/MCUdude/MegaCore
SPI Arduino pin
SCK : 9
MOSI : 10
MISO : 11
Chip Select pin
CS1 : 8
CS2 : 14
CS3 : 31
CS4 : 35
Check this out.
Notice :
1. Use Hardware SPI
2. Use your CS pin
3. max_1, max_2, max_3, max_4
------------------------------------------------
#include "SPI.h"
#include <Adafruit_MAX31865.h> // Adafruit's Header file
// Use software SPI: CS, DI, DO, CLK
// Adafruit_MAX31865 max = Adafruit_MAX31865(8, 10, 11, 9);
// ss, mosi, miso, sck
// use hardware SPI, Write your CS pin
Adafruit_MAX31865 max_1=Adafruit_MAX31865(8);
Adafruit_MAX31865 max_2=Adafruit_MAX31865(14);
Adafruit_MAX31865 max_3=Adafruit_MAX31865(31);
Adafruit_MAX31865 max_4=Adafruit_MAX31865(35);
#define RREF 4300.0 // 4.3Kohm
#define RNOMINAL 1000.0 // PT1000
float operatMax31865_1(void)
{
float temperature_1=max_1.temperature(RNOMINAL,RREF);
return temperature_1;
}
float operatMax31865_2(void)
{
float temperature_2=max_2.temperature(RNOMINAL,RREF);
return temperature_2;
}
float operatMax31865_3(void)
{
float temperature_3=max_3.temperature(RNOMINAL,RREF);
return temperature_3;
}
float operatMax31865_4(void)
{
float temperature_4=max_4.temperature(RNOMINAL,RREF);
return temperature_4;
}
voidsetup()
{
// put your setup code here, to run once:
max_1.begin(MAX31865_2WIRE); // set to 2WIRE or 4WIRE as necessary
max_2.begin(MAX31865_2WIRE); // set to 2WIRE or 4WIRE as necessary
max_3.begin(MAX31865_2WIRE); // set to 2WIRE or 4WIRE as necessary
max_4.begin(MAX31865_2WIRE); // set to 2WIRE or 4WIRE as necessary
Serial.begin(9600);
}
void loop()
{
// put your main code here, to run repeatedly:
Serial.print("PT1000_1: "); Serial.print(operatMax31865_1()); Serial.print("/ ");
Serial.print("PT1000_2: "); Serial.print(operatMax31865_2()); Serial.print("/ ");
Serial.print("PT1000_3: "); Serial.print(operatMax31865_3()); Serial.print("/ ");
Serial.print("PT1000_4: "); Serial.println(operatMax31865_4());
}
PT1000 Temperature Sensor
'프로그래밍 > 프로그래밍_여러가지' 카테고리의 다른 글
아두이노 - PE43712 Attenuator SPI 통신 (0) | 2019.05.24 |
---|---|
아두이노 - ATtiny85 SPI통신 Slave 모드, USI(Universal Serial Interface) (0) | 2019.04.29 |
아두이노 - Pin Change Interrupt (ATtiny85 사용), Arduino (0) | 2019.04.29 |
아두이노 - ATtiny85를 아두이노로 만들기 & AD-USBISP V03.6로 PC와 연결 (0) | 2019.04.09 |
C언어 기초 추천글 모음 - 전자공작 (0) | 2018.01.09 |