Getting 220C for the MAX30205 Temperature Sensor

Hi Everyone,

I hope you’re doing well. I am using the MAX30205 Breakout Board Temperature Sensor. When using the following code and associated wiring setup in the code with my Arduino Uno, I keep getting a value of 220 C in the serial monitor at room temperature (220 C). My serial monitor output is also below. Please help, I want to figure out why this sensor is giving 220C output, while still changing in response to temperature changes. I have also soldered the board to the header pins.

Thank you!

/**************************************************************************************

This is example for ClosedCube MAX30205 Human Body Temperature Sensor Breakout

Initial Date: 11-Jan-2017

Hardware connections for Arduino Uno:

VDD to 3.3V DC

SCL to A5

SDA to A4

GND to common ground

Written by AA for ClosedCube

MIT License

**************************************************************************************/

#include <Wire.h>

#include "ClosedCube_MAX30205.h"

ClosedCube_MAX30205 max30205;

void setup()

{

Serial.begin(9600);

Serial.println("ClosedCube MAX30205 Arduino Demo");

max30205.begin(0x48);

}

void loop()

{

Serial.print("T=");

Serial.print(max30205.readTemperature());

Serial.println("C");

delay(300);

}

What is the true temperature of your room? 21.6c?

Do you have this:

VDD to 3.3V DC

Please, format your code and paste it into a <code> block...

Is the address of the sensor 0x48?
Please verify this with an I2C scanner ==> google

Do you have a link to the library used?

The first thing I would do is turn everything off, then read the data sheet: https://www.analog.com/en/products/MAX30205.html The front of the data sheet will tell you it works with a 2.7V to 3.3V Supply Voltage.

Hopefully you have another, the odds are high you destroyed the unit you have. If you have not destroyed and it works assume it will fail as it was damaged by over voltage. The UNO is a 5V processor. You may have damaged the UNO also but maybe you are lucky,.

Which one.

I see on Google images that most boards don't have I2C level shifting parts fitted.
So you also need to add a level shift board to your setup.
Or switch to a more modern 3.3volt-logic Arduino or ESP32.
Leo..

/**************************************************************************************

This is example for ClosedCube MAX30205 Human Body Temperature Sensor Breakout

Initial Date: 11-Jan-2017

Hardware connections for Arduino Uno:

VDD to 3.3V DC

SCL to A5

SDA to A4

GND to common ground

Written by AA for ClosedCube

MIT License

**************************************************************************************/

#include <Wire.h>

#include "ClosedCube_MAX30205.h"

ClosedCube_MAX30205 max30205;

void setup()

{

Serial.begin(9600);

Serial.println("ClosedCube MAX30205 Arduino Demo");

max30205.begin(0x48);

}

void loop()

{

Serial.print("T=");

Serial.print(max30205.readTemperature());

Serial.println("C");

delay(300);

}

I did connect the sensor to 3.3V, and my room temp was 21.6 C - 22 C.

I used the above breakout board, which I got from Amazon.

Hi,

I connected my board to 3.3V, and tried multiples of the same board at 3.3V, and they all gave me 220C output, so I don’t think the board is destroyed.

The address of the sensor is 0x48, and I have verified it with a I2C sensor. I do have an image of the library I used (ClosedCube_MAX30205.h).

Best to post a weblink, not an image withoout parts.

This link shows that the module does not have 5volt level shifting.

That narrows it down to at least five different boards.
Leo..

Try this code and see if it helps:

uint8_t msb, lsb;
Wire.beginTransmission(addr);
Wire.write(0x00);                 // temperature register
Wire.endTransmission(false);
Wire.requestFrom(addr, (uint8_t)2);

msb = Wire.read();
lsb = Wire.read();

int16_t raw = (int16_t)((msb << 8) | lsb);
float tempC = raw / 256.0;

You could have the upper and lower bytes swapped or possibly reading the wrong register. This uses only the wire library.

https://www.amazon.com/MAX30205-Temperature-Humidity-Communicating-Interface/dp/B0D53XKSFB/ref=sr_1_1_sspa?dib=eyJ2IjoiMSJ9.Pm2p-EjWnyvQENmHgSt5dzcuJydAbFvKlH7L63FzRS13HVZcL4MvpTeXlQxFqmugAaeDNPkVRGcAy190Ijj9IO-MO2oYAYs2BlZcjb4x7cD6-ZrnrxvhyNlphQMQffoXvIW0iJ_B6xpp16C3bkx2f3_BqDjtI2Y2sjTO-337fxWFpwCKhz1WS0cGjGJZc8Z_0QpN8wxEVNnTL4cWRaSxm37r9FWYjqa9Wxo7KQcSdp0.G4YX9NXJYt_-n5kRgKxp-oOsg8YJ1morx5bu1YN72ng&dib_tag=se&keywords=max30205+temperature+sensor&qid=1771553008&sr=8-1-spons&sp_csd=d2lkZ2V0TmFtZT1zcF9hdGY&psc=1

This is the specific board I used

That is the board I saw. Your link to it is useless for finding your problem as there is no technical data. That is typical of most market place sellers. They sell cheap because of no support overhead. What happened when you tried my code?

I did try the code, however, it didn’t work for me. It would not compile and gave the following errors.

C:\Users\HamnaHasan\AppData\Local\Temp\.arduinoIDE-unsaved2026119-8500-11u8ewv.dktmj\sketch_feb19a\sketch_feb19a.ino:4:1: error: 'Wire' does not name a type Wire.beginTransmission(addr); ^~~~ C:\Users\HamnaHasan\AppData\Local\Temp\.arduinoIDE-unsaved2026119-8500-11u8ewv.dktmj\sketch_feb19a\sketch_feb19a.ino:5:1: error: 'Wire' does not name a type Wire.write(0x00); // temperature register ^~~~ C:\Users\HamnaHasan\AppData\Local\Temp\.arduinoIDE-unsaved2026119-8500-11u8ewv.dktmj\sketch_feb19a\sketch_feb19a.ino:6:1: error: 'Wire' does not name a type Wire.endTransmission(false); ^~~~ C:\Users\HamnaHasan\AppData\Local\Temp\.arduinoIDE-unsaved2026119-8500-11u8ewv.dktmj\sketch_feb19a\sketch_feb19a.ino:7:1: error: 'Wire' does not name a type Wire.requestFrom(addr, (uint8_t)2); ^~~~ C:\Users\HamnaHasan\AppData\Local\Temp\.arduinoIDE-unsaved2026119-8500-11u8ewv.dktmj\sketch_feb19a\sketch_feb19a.ino:9:1: error: 'msb' does not name a type msb = Wire.read(); ^~~ C:\Users\HamnaHasan\AppData\Local\Temp\.arduinoIDE-unsaved2026119-8500-11u8ewv.dktmj\sketch_feb19a\sketch_feb19a.ino:10:1: error: 'lsb' does not name a type lsb = Wire.read(); ^~~ exit status 1 Compilation error: 'Wire' does not name a type

So, I tried the following code:

#include <Wire.h>

uint8_t addr = 0x48;   // <-- make sure this matches your device address
uint8_t msb, lsb;

void setup() {
  Serial.begin(9600);
  Wire.begin();        // <-- required
}

void loop() {
  Wire.beginTransmission(addr);
  Wire.write(0x00);                 // temperature register
  Wire.endTransmission(false);
  Wire.requestFrom(addr, (uint8_t)2);

  msb = Wire.read();
  lsb = Wire.read();

  int16_t raw = (int16_t)((msb << 8) | lsb);
  float tempC = raw / 256.0;

  Serial.println(tempC);
  delay(500);
}

and it gave me this output.

From datasheet page 11

So the read order msb / lsb is according the datasheet

Could you add 4 print statements to see the raw data from the device

  Serial.print("MSB: ");
  Serial.println(msb);
  Serial.print("LSB: ");
  Serial.println(lsb);

I put the code in a sketch and it compiles OK with IDE 1.8.18

#include <Wire.h>

const uint8_t addr = 0x48;   // Adjust if needed

void setup() {
  Serial.begin(115200);
  Wire.begin();
}

void loop() {

  uint8_t msb, lsb;

  Wire.beginTransmission(addr);
  Wire.write(0x00);                 // Temperature register
  Wire.endTransmission(false);      // Repeated start
  Wire.requestFrom(addr, (uint8_t)2);

  if (Wire.available() == 2) {
    msb = Wire.read();
    lsb = Wire.read();

    int16_t raw = (int16_t)((msb << 8) | lsb);
    float tempC = raw / 256.0;

    Serial.print("Temp C: ");
    Serial.println(tempC);
  } else {
    Serial.println("I2C read error");
  }

  delay(1000);
}

The results of the compile: 

Sketch uses 5456 bytes (16%) of program storage space. Maximum is 32256 bytes.
Global variables use 440 bytes (21%) of dynamic memory, leaving 1608 bytes for local variables. Maximum is 2048 bytes.


Thank you so much.

I still get this output.

#include <Wire.h>

const uint8_t addr = 0x48;   // Adjust if needed

void setup() {
  Serial.begin(115200);
  Wire.begin();
}

void loop() {

  uint8_t msb, lsb;

  Wire.beginTransmission(addr);
  Wire.write(0x00);                 // Temperature register
  Wire.endTransmission(false);      // Repeated start
  Wire.requestFrom(addr, (uint8_t)2);

  if (Wire.available() == 2) {
    msb = Wire.read();
    lsb = Wire.read();

    int16_t raw = (int16_t)((msb << 8) | lsb);
    float tempC = raw / 256.0;
  Serial.print("MSB: ");
  Serial.println(msb);
  Serial.print("LSB: ");
  Serial.println(lsb);
    Serial.print("Temp C: ");
    Serial.println(tempC);
  } else {
    Serial.println("I2C read error");
  }

  delay(1000);
}

I also tried this code with the 4 print statements: I get this output..

@hamnahasan101

What is (roughly) the temperature you expected to see?

I wanted to see 22 C