hello everyone
im using ProtoCentral Pulse Express with MAX30102 and MAX32664D and MLX90614 temperature sensor on arduino mega
connecting these two sensors on SDA SCL (20 &21) but can't get any output form them, if i remove one of them the other starts to work just fine
i know that i can use the second SDA SCL ports located above pin 13 but i will be connecting multiple sensors there and i want a solution
is it a hardware fix or software fix ?
you can see the connection in the figure below
Koepel
January 28, 2022, 1:41pm
2
Do you have the 5V version of the MLX90614 ?
The first thing to do is to run a I2C Scanner sketch. Do you know the I2C addresses of the sensors ?
Can you show the code? Basically, this is when initializing the I²C modules. If the modules are connected so far, with their corresponding operating voltage, then that's OK.
If the modules are not found with the Sketch I²C scanner, then add pull-down resistors may need to be used. SDA -> 4.7k OHM -> GND and SCL -> 4.7kOhm -> GND
1 Like
you seem to forgot to connect power and back feeding your sensors
#include <Wire.h>
#include "max32664.h"
#define RESET_PIN 04
#define MFIO_PIN 02
#define RAWDATA_BUFFLEN 250
max32664 MAX32664(RESET_PIN, MFIO_PIN, RAWDATA_BUFFLEN);
void mfioInterruptHndlr(){
//Serial.print("i");
}
void enableInterruptPin(){
//pinMode(mfioPin, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(MAX32664.mfioPin), mfioInterruptHndlr, FALLING);
}
void loadAlgomodeParameters(){
algomodeInitialiser algoParameters;
algoParameters.calibValSys[0] = 120;
algoParameters.calibValSys[1] = 122;
algoParameters.calibValSys[2] = 125;
algoParameters.calibValDia[0] = 80;
algoParameters.calibValDia[1] = 81;
algoParameters.calibValDia[2] = 82;
algoParameters.spo2CalibCoefA = 1.5958422;
algoParameters.spo2CalibCoefB = -34.659664;
algoParameters.spo2CalibCoefC = 112.68987;
MAX32664.loadAlgorithmParameters(&algoParameters);
}
void setup(){
Serial.begin(9600);
Wire.begin();
loadAlgomodeParameters();
int result = MAX32664.hubBegin();
if (result == CMD_SUCCESS){
Serial.print("t4.txt=\"");
Serial.print("Sensorhub begin");
Serial.print("\"");
Serial.write(0xff);
Serial.write(0xff);
Serial.write(0xff);
}else{
//stay here.
while(1){
Serial.print("t4.txt=\"");
Serial.print("make proper connections");
Serial.print("\"");
Serial.write(0xff);
Serial.write(0xff);
Serial.write(0xff);
delay(5000);
}
}
bool ret = MAX32664.startBPTcalibration();
while(!ret){
delay(10000);
Serial.print("t4.txt=\"");
Serial.print("failed calib RESTART");
Serial.print("\"");
Serial.write(0xff);
Serial.write(0xff);
Serial.write(0xff);
//ret = MAX32664.startBPTcalibration();
}
delay(1000);
//Serial.print("start in estimation mode");
ret = MAX32664.configAlgoInEstimationMode();
while(!ret){
//Serial.print("failed est mode");
ret = MAX32664.configAlgoInEstimationMode();
delay(10000);
}
//MAX32664.enableInterruptPin();
Serial.print("t4.txt=\"");
Serial.print("Getting the device ready..");
Serial.print("\"");
Serial.write(0xff);
Serial.write(0xff);
Serial.write(0xff);
delay(1000);
}
void loop(){
uint8_t num_samples = MAX32664.readSamples();
if(num_samples){
//Serial.print("sys = ");
Serial.print("sys.val=");
Serial.print(MAX32664.max32664Output.sys);
Serial.write(0xff);
Serial.write(0xff);
Serial.write(0xff);
//Serial.print(", dia = ");
Serial.print("dia.val=");
Serial.print(MAX32664.max32664Output.dia);
Serial.write(0xff);
Serial.write(0xff);
Serial.write(0xff);
//Serial.print(", hr = ");
Serial.print("hr.val=");
Serial.print(MAX32664.max32664Output.hr);
Serial.write(0xff);
Serial.write(0xff);
Serial.write(0xff);
float sop2f = float(MAX32664.max32664Output.spo2);
//Serial.print(" spo2 = ");
Serial.print("spo2.txt=\"");
Serial.print(sop2f);
Serial.print("\"");
Serial.write(0xff);
Serial.write(0xff);
Serial.write(0xff);
}
delay(100);
}
this code includes nextion display codes so the sensors display the output to it
i didn't include the power connection to make the figure simple
There is nothing simple in not including essential information
Are we supposed to guess the rest?
The I2C scanner, what does it report for devices connected?
Ok, the program code looks okay so far.
I assume that you have a serial monitor on the display, but the measurement result is 0. Is that correct?
Do both sensors work when used individually?
moh2625
January 28, 2022, 1:59pm
13
yes sesnors work and the output is displayed on Nextion display when i disconnect on of them
moh2625
January 28, 2022, 2:00pm
14
yes both of them display the output when i disconnect one of them form SDA SCL
moh2625
January 28, 2022, 2:02pm
15
so by adding these resistors the sensors should work if i connected them in parallel to SDA SCL
Where is the code for MLX90614?
moh2625
January 28, 2022, 2:07pm
17
#include <Wire.h>
#include <Adafruit_MLX90614.h>
#include "max32664.h"
#define RESET_PIN 04
#define MFIO_PIN 02
#define RAWDATA_BUFFLEN 250
max32664 MAX32664(RESET_PIN, MFIO_PIN, RAWDATA_BUFFLEN);
Adafruit_MLX90614 mlx = Adafruit_MLX90614();
void mfioInterruptHndlr(){
//Serial.print("i");
}
void enableInterruptPin(){
//pinMode(mfioPin, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(MAX32664.mfioPin), mfioInterruptHndlr, FALLING);
}
void loadAlgomodeParameters(){
algomodeInitialiser algoParameters;
algoParameters.calibValSys[0] = 120;
algoParameters.calibValSys[1] = 122;
algoParameters.calibValSys[2] = 125;
algoParameters.calibValDia[0] = 80;
algoParameters.calibValDia[1] = 81;
algoParameters.calibValDia[2] = 82;
algoParameters.spo2CalibCoefA = 1.5958422;
algoParameters.spo2CalibCoefB = -34.659664;
algoParameters.spo2CalibCoefC = 112.68987;
MAX32664.loadAlgorithmParameters(&algoParameters);
}
void setup(){
Serial.begin(9600);
mlx.begin();
Wire.begin();
loadAlgomodeParameters();
int result = MAX32664.hubBegin();
if (result == CMD_SUCCESS){
Serial.print("t4.txt=\"");
Serial.print("Sensorhub begin");
Serial.print("\"");
Serial.write(0xff);
Serial.write(0xff);
Serial.write(0xff);
}else{
//stay here.
while(1){
Serial.print("t4.txt=\"");
Serial.print("make proper connections");
Serial.print("\"");
Serial.write(0xff);
Serial.write(0xff);
Serial.write(0xff);
delay(5000);
}
}
bool ret = MAX32664.startBPTcalibration();
while(!ret){
delay(10000);
Serial.print("t4.txt=\"");
Serial.print("failed calib RESTART");
Serial.print("\"");
Serial.write(0xff);
Serial.write(0xff);
Serial.write(0xff);
//ret = MAX32664.startBPTcalibration();
}
delay(1000);
//Serial.print("start in estimation mode");
ret = MAX32664.configAlgoInEstimationMode();
while(!ret){
//Serial.print("failed est mode");
ret = MAX32664.configAlgoInEstimationMode();
delay(10000);
}
//MAX32664.enableInterruptPin();
Serial.print("t4.txt=\"");
Serial.print("Successfully calibrated..");
Serial.print("\"");
Serial.write(0xff);
Serial.write(0xff);
Serial.write(0xff);
delay(1000);
}
void loop(){
uint8_t num_samples = MAX32664.readSamples();
if(num_samples){
//Serial.print("sys = ");
Serial.print("sys.val=");
Serial.print(MAX32664.max32664Output.sys);
Serial.write(0xff);
Serial.write(0xff);
Serial.write(0xff);
//Serial.print(", dia = ");
Serial.print("dia.val=");
Serial.print(MAX32664.max32664Output.dia);
Serial.write(0xff);
Serial.write(0xff);
Serial.write(0xff);
//Serial.print(", hr = ");
Serial.print("hr.val=");
Serial.print(MAX32664.max32664Output.hr);
Serial.write(0xff);
Serial.write(0xff);
Serial.write(0xff);
float sop2f = float(MAX32664.max32664Output.spo2);
//Serial.print(" spo2 = ");
Serial.print("spo2.txt=\"");
Serial.print(sop2f);
Serial.print("\"");
Serial.write(0xff);
Serial.write(0xff);
Serial.write(0xff);
float tempf = float(mlx.readObjectTempC());
Serial.print("temp.txt=\"");
Serial.print(tempf);
Serial.print("\"");
Serial.write(0xff);
Serial.write(0xff);
Serial.write(0xff);
}
delay(100);
}
more simple
#include <Wire.h>
#include <Adafruit_MLX90614.h>
Adafruit_MLX90614 mlx = Adafruit_MLX90614();
void setup() {
Serial.begin(9600);
mlx.begin();
}
void loop() {
Serial.print("Temperature : ");
Serial.print(mlx.readObjectTempC());
Serial.println(" Celsius");
Serial.print("Temperature : ");
Serial.print(mlx.readObjectTempF());
Serial.println(" Fahrenheit");
Serial.println();
delay(500);
}
i just took Celsius output and add it to my code
moh2625:
more simple
I don’t understand, your problem is that sensors work on their own but not when together, why showing code for just one sensor is simple? You know what, I want to wish you good luck
1 Like
Post the code combined code, please.
moh2625
January 28, 2022, 3:00pm
20
sorry it's long code i didn't know i was replying with different code
this code is for ProtoCentral Pulse Express with MAX30102 and MAX32664D and MLX90614 temperature sensor with nextion display
the output of the two sensors display on nextion display
#include <Wire.h>
#include <Adafruit_MLX90614.h>
#include "max32664.h"
#define RESET_PIN 04
#define MFIO_PIN 02
#define RAWDATA_BUFFLEN 250
max32664 MAX32664(RESET_PIN, MFIO_PIN, RAWDATA_BUFFLEN);
Adafruit_MLX90614 mlx = Adafruit_MLX90614();
void mfioInterruptHndlr(){
//Serial.print("i");
}
void enableInterruptPin(){
//pinMode(mfioPin, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(MAX32664.mfioPin), mfioInterruptHndlr, FALLING);
}
void loadAlgomodeParameters(){
algomodeInitialiser algoParameters;
algoParameters.calibValSys[0] = 120;
algoParameters.calibValSys[1] = 122;
algoParameters.calibValSys[2] = 125;
algoParameters.calibValDia[0] = 80;
algoParameters.calibValDia[1] = 81;
algoParameters.calibValDia[2] = 82;
algoParameters.spo2CalibCoefA = 1.5958422;
algoParameters.spo2CalibCoefB = -34.659664;
algoParameters.spo2CalibCoefC = 112.68987;
MAX32664.loadAlgorithmParameters(&algoParameters);
}
void setup(){
Serial.begin(9600);
mlx.begin();
Wire.begin();
loadAlgomodeParameters();
int result = MAX32664.hubBegin();
if (result == CMD_SUCCESS){
Serial.print("t4.txt=\"");
Serial.print("Sensorhub begin");
Serial.print("\"");
Serial.write(0xff);
Serial.write(0xff);
Serial.write(0xff);
}else{
//stay here.
while(1){
Serial.print("t4.txt=\"");
Serial.print("make proper connections");
Serial.print("\"");
Serial.write(0xff);
Serial.write(0xff);
Serial.write(0xff);
delay(5000);
}
}
bool ret = MAX32664.startBPTcalibration();
while(!ret){
delay(10000);
Serial.print("t4.txt=\"");
Serial.print("failed calib RESTART");
Serial.print("\"");
Serial.write(0xff);
Serial.write(0xff);
Serial.write(0xff);
//ret = MAX32664.startBPTcalibration();
}
delay(1000);
//Serial.print("start in estimation mode");
ret = MAX32664.configAlgoInEstimationMode();
while(!ret){
//Serial.print("failed est mode");
ret = MAX32664.configAlgoInEstimationMode();
delay(10000);
}
//MAX32664.enableInterruptPin();
Serial.print("t4.txt=\"");
Serial.print("Successfully calibrated..");
Serial.print("\"");
Serial.write(0xff);
Serial.write(0xff);
Serial.write(0xff);
delay(1000);
}
void loop(){
uint8_t num_samples = MAX32664.readSamples();
if(num_samples){
//Serial.print("sys = ");
Serial.print("sys.val=");
Serial.print(MAX32664.max32664Output.sys);
Serial.write(0xff);
Serial.write(0xff);
Serial.write(0xff);
//Serial.print(", dia = ");
Serial.print("dia.val=");
Serial.print(MAX32664.max32664Output.dia);
Serial.write(0xff);
Serial.write(0xff);
Serial.write(0xff);
//Serial.print(", hr = ");
Serial.print("hr.val=");
Serial.print(MAX32664.max32664Output.hr);
Serial.write(0xff);
Serial.write(0xff);
Serial.write(0xff);
float sop2f = float(MAX32664.max32664Output.spo2);
//Serial.print(" spo2 = ");
Serial.print("spo2.txt=\"");
Serial.print(sop2f);
Serial.print("\"");
Serial.write(0xff);
Serial.write(0xff);
Serial.write(0xff);
float tempf = float(mlx.readObjectTempC());
Serial.print("temp.txt=\"");
Serial.print(tempf);
Serial.print("\"");
Serial.write(0xff);
Serial.write(0xff);
Serial.write(0xff);
}
delay(100);
}