본문 바로가기

프로그래밍/프로그래밍_여러가지

아두이노 - Multiple MAX31865+PT1000 Temperature Sensors for ARDUINO

반응형

 

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

 

 

 

 

 

 

 

 

반응형