I am using the MLX90614 sensor with my Arduino UNO, and currently the output temperature is measured at 2 decimal places. From my understanding Arduino is a 16 bit interface (correct me if I am wrong), so is there a way to increase the precision to more decimal places, I am fine with the range of the sensor being reduced. Or is that just a hardware limitation of the MLX90614 that it cannot measure more precisely than 2 decimal places
Is it?
Or is it merely printed to that default precision in your unposted code?
This is not an installation issue.
Please ask a moderator to move this topic to a more appropriate forum section
Here is the code I am using
type or p#include <Adafruit_MLX90614.h>
#include<Wire.h>
Adafruit_MLX90614 mlx = Adafruit_MLX90614();
void setup() {
Serial.begin(9600);
mlx.begin();
}
void loop() {
Serial.print("Ambient = "); Serial.print(mlx.readAmbientTempC()); Serial.print("\xC2\xB0");
Serial.print("C, \tObject = "); Serial.print(mlx.readObjectTempC()); Serial.print("\xC2\xB0");
Serial.println("C,");
//Serial.print("Ambient = "); Serial.print(mlx.readAmbientTempF()); Serial.print("\xC2\xB0");
//Serial.print("F\tObject = "); Serial.print(mlx.readObjectTempF()); Serial.print("\xC2\xB0");
//Serial.println("F");
//Serial.println();
delay(500);
}
And the library I am using for the MLX90614 sensor
/***************************************************
This is a library for the MLX90614 Temp Sensor
Designed specifically to work with the MLX90614 sensors in the
adafruit shop
----> https://www.adafruit.com/products/1748
----> https://www.adafruit.com/products/1749
These sensors use I2C to communicate, 2 pins are required to
interface
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
Written by Limor Fried/Ladyada for Adafruit Industries.
BSD license, all text above must be included in any redistribution
****************************************************/
#include "Adafruit_MLX90614.h"
Adafruit_MLX90614::Adafruit_MLX90614(uint8_t i2caddr) { _addr = i2caddr; }
boolean Adafruit_MLX90614::begin(void) {
Wire.begin();
/*
for (uint8_t i=0; i<0x20; i++) {
Serial.print(i); Serial.print(" = ");
Serial.println(read16(i), HEX);
}
*/
return true;
}
//////////////////////////////////////////////////////
double Adafruit_MLX90614::readObjectTempF(void) {
return (readTemp(MLX90614_TOBJ1) * 9 / 5) + 32;
}
double Adafruit_MLX90614::readAmbientTempF(void) {
return (readTemp(MLX90614_TA) * 9 / 5) + 32;
}
double Adafruit_MLX90614::readObjectTempC(void) {
return readTemp(MLX90614_TOBJ1);
}
double Adafruit_MLX90614::readAmbientTempC(void) {
return readTemp(MLX90614_TA);
}
float Adafruit_MLX90614::readTemp(uint8_t reg) {
float temp;
temp = read16(reg);
temp *= .02;
temp -= 273.15000;
return temp;
}
/*********************************************************************/
uint16_t Adafruit_MLX90614::read16(uint8_t a) {
uint16_t ret;
Wire.beginTransmission(_addr); // start transmission to device
Wire.write(a); // sends register address to read from
Wire.endTransmission(false); // end transmission
Wire.requestFrom(_addr, (size_t)3); // send data n-bytes read
ret = Wire.read(); // receive DATA
ret |= Wire.read() << 8; // receive DATA
uint8_t pec = Wire.read();
return ret;
}
I am using the preset Adafruit library for the MLX90614 and just calling the functions for reading the temperature. I know I likely have to change something in the library but I don't see any functions to change the precision. Sorry I am inexperienced with Arduino.
The measurement resolution of the MLX90614 is 0.02 degrees C, and the accuracy is +/- 0.5 degrees C.
So, printing temperatures with two places after the decimal (the default with Serial.print) is sufficient.
You could average several measurements to get more precision, but that does not change the accuracy of the measurement.
So that means if I want to measure more precisely I need a different sensor?
Thank You!
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.