Problem of interfacing MLX90614 with stm32 bluePill

Post here first, or if you can't find a relevant section!
Post Reply
Hamza ASSA
Posts: 4
Joined: Tue Jun 01, 2021 12:15 pm

Problem of interfacing MLX90614 with stm32 bluePill

Post 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 .
mlundin
Posts: 94
Joined: Wed Nov 04, 2020 1:20 pm
Answers: 6
Location: Sweden

Re: Problem of interfacing MLX90614 with stm32 bluePill

Post by mlundin »

First try the "Examples/Wire/i2c_scanner" sketch to check the basic i2c communication and that your sensor board is recognised.
User avatar
fpiSTM
Posts: 1738
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: Problem of interfacing MLX90614 with stm32 bluePill

Post by fpiSTM »

You need resistor Pull up on each I2C line (usually 4.7K).
mlundin
Posts: 94
Joined: Wed Nov 04, 2020 1:20 pm
Answers: 6
Location: Sweden

Re: Problem of interfacing MLX90614 with stm32 bluePill

Post by mlundin »

It also seems that the BluePill variant uses PB6 and PB7 as default I2C
Hamza ASSA
Posts: 4
Joined: Tue Jun 01, 2021 12:15 pm

Re: Problem of interfacing MLX90614 with stm32 bluePill

Post 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 !!
Attachments
adresse.PNG
adresse.PNG (12.09 KiB) Viewed 3144 times
Hamza ASSA
Posts: 4
Joined: Tue Jun 01, 2021 12:15 pm

Re: Problem of interfacing MLX90614 with stm32 bluePill

Post 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 !!
Attachments
kk.PNG
kk.PNG (16.44 KiB) Viewed 3142 times
User avatar
fpiSTM
Posts: 1738
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: Problem of interfacing MLX90614 with stm32 bluePill

Post by fpiSTM »

Which core you used?
Post Reply

Return to “General discussion”