I am trying to read temperature datas from a MLX90614 sensor connected to a Wio Terminal. I have managed to run the mlxtest from Adafruit MLX90614 library on an Arduino Nano 33 BLE Sense (just had to be careful to connect Vdd to Vin and not V33).
However it doesn't work on my Wio Terminal. I have noticed that there is no Wire library included in this exemple. Isn't it weird? (I also tried to include this library but it didn't fix the problem)
Hello,
I didn't have any problem with other sensor (such as MAX30100 on pin 3/5 but I will try also on 27/28. I couldn't find how to specify it, do you know that ? Thanks in advance!
(I won't be able to try anything next week but I will try the week after)
You can provide the used Wire object in the begin method of the Adafruit_MLX90614 library.
I followed the rather complex numbering in the SAMD51 variant Seeed created for the WIO Terminal and it seems that they call I2C0 Wire1 and I2C1 Wire, so you're probably right with 3/5.
In the pinout on Seeed's wiki page pin 17 is 3V3 but in the diagram in the variant.h file of that board pin 17 is GND. You should check that using a multimeter and maybe change Vdd to pin 1 which is 3V3 in both documents.
I have tested that on Adafruit_MLX90614's example but it didn't work... Which library have you been using?
/***************************************************
This is a library example for the MLX90614 Temp Sensor
Designed specifically to work with the MLX90614 sensors in the
adafruit shop
----> https://www.adafruit.com/products/1747 3V version
----> https://www.adafruit.com/products/1748 5V version
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 mlx = Adafruit_MLX90614();
void setup() {
Serial.begin(9600);
while (!Serial);
mlx.begin(MLX90614_I2CADDR, &Wire1);
Serial.println("Adafruit MLX90614 test");
if (!mlx.begin()) {
Serial.println("Error connecting to MLX sensor. Check wiring.");
while (1);
};
Serial.print("Emissivity = "); Serial.println(mlx.readEmissivity());
Serial.println("================================================");
}
void loop() {
Serial.print("Ambient = "); Serial.print(mlx.readAmbientTempC());
Serial.print("*C\tObject = "); Serial.print(mlx.readObjectTempC()); Serial.println("*C");
Serial.print("Ambient = "); Serial.print(mlx.readAmbientTempF());
Serial.print("*F\tObject = "); Serial.print(mlx.readObjectTempF()); Serial.println("*F");
Serial.println();
delay(500);
}
Here is the source code of the begin function:
bool Adafruit_MLX90614::begin(uint8_t addr, TwoWire *wire) {
_addr = addr; // needed for CRC
if (i2c_dev)
delete i2c_dev;
i2c_dev = new Adafruit_I2CDevice(addr, wire);
return i2c_dev->begin();
}