Page 1 of 1

Problem of interfacing MLX90614 with stm32 bluePill

Posted: Tue Jun 01, 2021 12:39 pm
by Hamza ASSA
Hi to all community,

I have an STM32F103 (blue pill) and i want to connect with a mix90614 temperature sensor in order to develop a project for my internship.
I want to read temperature, from the sensor.
I use I2C protocol for my sensor (B8---SDA , B9---SCL)
I used Adafruit mlx90614 library.
But since now i can not get data from sensor I get only and always 1037.55*C.
The project compiles OK with no errors.
I use Arduino IDE .
Here is my sample code:

Code: Select all

#include <Wire.h>
#include <Adafruit_MLX90614.h>
Adafruit_MLX90614 mlx = Adafruit_MLX90614();
void setup() {
  Serial.begin(9600);
  Serial.println("Adafruit MLX90614 test");  
  mlx.begin();  
}
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);
}
I will be so grateful if you help me .

Re: Problem of interfacing MLX90614 with stm32 bluePill

Posted: Tue Jun 01, 2021 3:28 pm
by mlundin
First try the "Examples/Wire/i2c_scanner" sketch to check the basic i2c communication and that your sensor board is recognised.

Re: Problem of interfacing MLX90614 with stm32 bluePill

Posted: Tue Jun 01, 2021 3:42 pm
by fpiSTM
You need resistor Pull up on each I2C line (usually 4.7K).

Re: Problem of interfacing MLX90614 with stm32 bluePill

Posted: Tue Jun 01, 2021 3:54 pm
by mlundin
It also seems that the BluePill variant uses PB6 and PB7 as default I2C

Re: Problem of interfacing MLX90614 with stm32 bluePill

Posted: Thu Jun 03, 2021 11:18 pm
by Hamza ASSA
mlundin wrote: Tue Jun 01, 2021 3:28 pm First try the "Examples/Wire/i2c_scanner" sketch to check the basic i2c communication and that your sensor board is recognised.
I try with this .. it gives me the adresse of mlx90614 which is 0x5A !!

Re: Problem of interfacing MLX90614 with stm32 bluePill

Posted: Thu Jun 03, 2021 11:22 pm
by Hamza ASSA
mlundin wrote: Tue Jun 01, 2021 3:54 pm It also seems that the BluePill variant uses PB6 and PB7 as default I2C
I changed the pin to SCL -> PB10 and SDA->pB11 and i got this !! false measurment !!

Re: Problem of interfacing MLX90614 with stm32 bluePill

Posted: Fri Jun 04, 2021 5:25 am
by fpiSTM
Which core you used?