i2c Temperature Sensors
-
Is it possible to interface temperature sensors via i2c instead of the default method of SPI->MAX31856? I have an odd specific application for this, and am aware of the distance limitations of i2c.
-
To support I2C temperature sensors, you would need to add a new temperature sensor class to the existing collection. But using I2C to connect temperature sensors is IMO a very bad idea, unless it's to measure the temperature of a chip on the Duet itself. It's not just the distance limitation, it's also the very poor noise immunity, lack of error detection, and lack of any protocol for recovering from sync errors.
If the temperature sensor you want to use is only available with an I2C interface, use an attiny or similar small microcontroller to convert it to something more robust - like we did in the version 1 laser filament monitor.
-
Actually I am looking for a way to use a remote temperature sensor. The plan was to use Temp Sensor -> i2c sensor amplifier -> PCA9615 (i2c differential buffer)////cable//// ->PCA9615 -> i2c on Duet2.
I am open to using a small microcontroller to read my sensor and communicate with the duet2, but I am at a loss as to what that communication should be.
-
@todd said in i2c Temperature Sensors:
but I am at a loss as to what that communication should be
emulating the spi chips on the thermocouple or pt100 board wouldn't require any other changes to the rep rap firmware and as such be easier with respect to upgrades
-
@bearer Interesting idea, but from what little I know about emulating SPI hardware slave it is quite an undertaking.
Then there's still have the issue of sending the sensor data over a distance. Maybe I could just continuously transmit it over a rs485 serial link.
-
After some more research, and learning that most i2c errors come from things the differential buffer pair should take care of, im going to give this a try with i2c.
Can anyone point me to what is needed to implement a new temperature sensor class?
-
@todd said in i2c Temperature Sensors:
@bearer Interesting idea, but from what little I know about emulating SPI hardware slave it is quite an undertaking.
Then there's still have the issue of sending the sensor data over a distance. Maybe I could just continuously transmit it over a rs485 serial link.
I can't say I've tried it, but it doesn't look too bad. Adding the link just for refrence even if you're decided on i2c.
https://circuitdigest.com/microcontroller-projects/arduino-spi-communication-tutorial -
@todd if you are going to the effort of adding an additional firmware class to allow for I2C thermistors its probably equivalent, or less to use a attiny44 or similar to do as David suggests.
-
@todd said in i2c Temperature Sensors:
After some more research, and learning that most i2c errors come from things the differential buffer pair should take care of, im going to give this a try with i2c.
Can anyone point me to what is needed to implement a new temperature sensor class?
You will need to derive a new class from class TemperatureSensor. It may make sense to use a class I2CTemperatureSensor (similar to class SPITemperatureSensor but using I2C protocol) and then derive the class for your particular sensor from that.
To use the I2C interface, see the implementation of M260 and M261. I suggest you work with the RRF 2.03 source code (which is in the /dev branch on Github) because there have been significant changes to the I2C interface since version 2.02.
-
@bearer Thanks, ill check out the tutorial. I think I will still go with i2c though.