max31725 help

Hi All

Can anyone help me with the support of the sensor MAX31725 in arduino
Seeking a library and edyne what I found is a piece of code in python

import struct
import logging

from pymlab.sensors import Device

LOGGER = logging.getLogger(name)

class LTS01(Device):
“”"
Example:

… code-block:: python

Python library for LTS01A MLAB module with MAX31725 i2c Local Temperature Sensor

“”"

FAULTS = {
1: [0b00],
2: [0b01],
4: [0b10],
6: [0b11],
}

def init(self, parent = None, address = 0x48, fault_queue = 1, **kwargs):
Device.init(self, parent, address, **kwargs)

register definitions

self.Reg_temp = 0x00
self.Reg_conf = 0x01
self.Reg_Thys = 0x02
self.Reg_Tos = 0x03

config parameters

self.SHUTDOWN = (1 << 0)
self.INTERRUPT_Mode = (1 << 1)
self.COMPARATOR_Mode = (0 << 1)
self.OS_POLARITY_1 = (1 << 2)
self.OS_POLARITY_0 = (0 << 2)

self.FQ_num = (int(self.FAULTS[fault_queue]) << 3)

self.FORMAT_2complement = (0 << 5)
self.FORMAT_extended = (1 << 5)
self.Timeout_on = (0 << 6)
self.Timeout_off = (1 << 6)

def initialize(self):
setup = 0x00
self.bus.write_byte_data(self.address, self.Reg_conf, setup)
LOGGER.debug("LTS sensor initialized. ",)
return self.bus.read_byte_data(self.address,0x01);

def get_temp(self):

self.bus.write_byte(self.address,0x00)

temp = self.bus.read_int16_data(self.address, self.Reg_temp) / 256.0
#temperature calculation register_value * 0.00390625; (Sensor is a big-endian but SMBus is little-endian by default)
return temp

Tomek

#include <Wire.h>

#define DEV_ID 0x90 >> 1 // address i2c device

int8_t firstByte;
int8_t secondByte;
int16_t t;
float temp;

void setup()
{
Serial.begin(9600);
Wire.begin();
Wire.beginTransmission(DEV_ID1); // connect to MAX31725 (#0)
Wire.write(0x01); // Access Config
Wire.write(0x00); // set for continuous conversion
Wire.beginTransmission(DEV_ID1); // restart
Wire.write(0x01); // start conversions
Wire.endTransmission();

Serial.println("Sensors: ");
}

void loop()
{
delay(1000); // give time for measurement

Wire.beginTransmission(DEV_ID);
Wire.write(0x00); // read temperature command
Wire.endTransmission();
delay(5);
Wire.requestFrom(DEV_ID, 2); // request two bytes from MAX31725 (0.5 deg. resolution)
delay(5);
firstByte = Wire.read(); // get first byte
delay(5);
secondByte = Wire.read(); // get second byte

temp = firstByte;
t = firstByte << 8 | secondByte;
temp = t*0.00390625;

Serial.print(“Temp:\t”);
Serial.println(temp);

}

max31725_multi_devicce.ino (3.51 KB)