using MAX30102

Hello, I would like to use MAX30102 with Arduino 1010. When bring up serial monitor, nothing displays. I used example - temperature sense which should show "initializing ....," but nothing happens.

I decided to try MEGA2560. I got

Initializing... MAX30105 was not found. Please check wiring/power.

I have power to the MAX30102,

Question: is there a way to check that the MAX30102 is powered.

Thanks

PS: I will than look into why 1010 did no not show anything on Serial monitor

Please post your full sketch.

If possible, you should always post code directly in the forum thread as text using code tags:

  • Do an Auto Format (Tools > Auto Format in the Arduino IDE or Ctrl + B in the Arduino Web Editor) on your code. This will make it easier for you to spot bugs and make it easier for us to read.
  • In the Arduino IDE or Arduino Web Editor, click on the window that contains your sketch code.
  • Press “Ctrl + A”. This will select all the text.
  • Press “Ctrl + C”. This will copy the selected text to the clipboard.
  • In a forum reply here, click the “Reply” button.
  • click on the reply field.
  • Click the </> button on the forum toolbar. This will add the forum’s code tags markup to your reply.
  • Press “Ctrl + V”. This will paste the sketch between the code tags.
  • Move the cursor outside of the code tags before you add any additional text to your reply.
  • Repeat the above process if your sketch has multiple tabs.

This will make it easy for anyone to look at it, which will increase the likelihood of you getting help.

If the sketch is longer than the 9000 characters maximum allowed by the forum, then it’s OK to add it as an attachment. After clicking the “Reply” button, you will see an “Attachments and other settings” link.

When your code requires a library that’s not included with the Arduino IDE please post a link (using the chain links icon on the forum toolbar to make it clickable) to where you downloaded that library from or if you installed it using Library Manger (Sketch > Include Library > Manage Libraries in the Arduino IDE or Libraries > Library Manager in the Arduino Web Editor) then say so and state the full name of the library.

aaorozco:
Question: is there a way to check that the MAX30102 is powered.

You can use a multimeter. If you don’t have that, you could use an LED.

Attached is the code:

/*
MAX3010 Breakout: Read the onboard temperature sensor
By: Nathan Seidle @ SparkFun Electronics
Date: October 20th, 2016
https://github.com/sparkfun/MAX30105_Breakout

This demo outputs the onboard temperature sensor. The temp sensor is accurate to +/-1 C but
has an astonishing precision of 0.0625 C.

Hardware Connections (Breakoutboard to Arduino):
-5V = 5V (3.3V is allowed)
-GND = GND
-SDA = A4 (or SDA)
-SCL = A5 (or SCL)
-INT = Not connected

The MAX30105 Breakout can handle 5V or 3.3V I2C logic. We recommend powering the board with 5V
but it will also run at 3.3V.
*/

#include <Wire.h>

#include “MAX30105.h” //Get it here: http://librarymanager/All#SparkFun_MAX30105
MAX30105 particleSensor;

void setup()
{
Serial.begin(9600);
Serial.println(“Initializing…”);

// Initialize sensor
if (particleSensor.begin(Wire, I2C_SPEED_FAST) == false) //Use default I2C port, 400kHz speed
{
Serial.println("MAX30105 was not found. Please check wiring/power. ");
while (1);
}

//The LEDs are very low power and won’t affect the temp reading much but
//you may want to turn off the LEDs to avoid any local heating
particleSensor.setup(0); //Configure sensor. Turn off LEDs
//particleSensor.setup(); //Configure sensor. Use 25mA for LED drive

particleSensor.enableDIETEMPRDY(); //Enable the temp ready interrupt. This is required.
}

void loop()
{
float temperature = particleSensor.readTemperature();

Serial.print(“temperatureC=”);
Serial.print(temperature, 4);

float temperatureF = particleSensor.readTemperatureF(); //Because I am a bad global citizen

Serial.print(" temperatureF=");
Serial.print(temperatureF, 4);

Serial.println();
}

aaorozco: PS: I will than look into why 1010 did no not show anything on Serial monitor

The boards with native USB capability like your MKR WiFi 1010 work a little differently from the boards that use a dedicated USB chip like you Mega 2560.

The Mega 2560 is automatically reset when you open Serial Monitor, so you will see all the serial output from the very start of the program in Serial Monitor.

The MKR WiFi 1010 is not reset when you open Serial Monitor. So between the time the program is started (after power on, reset, or uploading a sketch) and the time you get the Serial Monitor opened, any serial output is lost. Because of this, you will often see things like this in the setup() function:

Serial.begin(9600);
while(!Serial);  // make native USB boards wait until a serial connection is opened before continuing

When the serial connection is opened to a native USB board, Serial becomes true, and the while loop is exited. On the boards without native USB capabilities, Serial is always true, so this line has no effect.

So this code is very useful, but not always. If you want your program to run when Serial Monitor is not open, you would want to remove that line, otherwise you'll be wondering why nothing is happening.

aaorozco:

  -SDA = A4 (or SDA)

-SCL = A5 (or SCL)

Note that on the Mega, A4 and A5 are not the I2C pins. The I2C pins are 20 and 21, but you might prefer to use the pins marked “SDA” and “SCL”, simply because this is less confusing. It makes no functional difference whether you use 20/21 or SDA/SCL because they are electrically connected.

Note that on the MKR WiFi 1010, A4 and A5 are not the I2C pins. The I2C pins are 11 and 12.

Thanks to all. At this time, looks like it is working.

I'm very glad to see you solved your problem. It would be nice if you would take a minute to post a description of the solution you found. That will help anyone else with the same problem who later finds this thread while searching for information. I'm sure they would be very grateful. Thanks!

To get it working I followed the latest post.

Instead of using pins A4 and A5 (as said in the code) on Arduino 1010, I looked at the board and seen pins that said SDA and SDL. I used them to connect to the MAX30102 accordingly and the serial port started to print information per code used and the the red light on the MAX30102 lit up.

Thanks for the help.

You're welcome. I'm glad to hear it's working now. Enjoy! Per