Can the ESP8266-01 send data to thingspeak?

Hello everyone.
I'm trying to send sensor measurements to thingspeak, the sensors are:
max30100 spo2 sensor and mlx90614 temp sensor both connected to Arduino uno and with this combination is the ESP8266-01, but I'm only getting the temp readings and not the spo2 measurements, the thingspeak field for the spo2 and heartrate is empty

#include <SoftwareSerial.h>
#include <LiquidCrystal_I2C.h>
#include <Wire.h>
#include <Adafruit_MLX90614.h>
#include <MAX30100_PulseOximeter.h>

#define RX 2
#define TX 3
#define REPORTING_PERIOD_MS     1000

SoftwareSerial esp8266(RX,TX); 
LiquidCrystal_I2C lcd(0x27, 16, 2);
Adafruit_MLX90614 mlx;
PulseOximeter pox;
String AP = "UFC";       
String PASS = "90009000"; 
String API = "PR1DFZXAKMGWFSW7";   
String HOST = "api.thingspeak.com";
String PORT = "80";
String field = "field1";
String field1 = "field2";
String field2 = "field3";
boolean found = false; 

int countTrueCommand;
int countTimeCommand; 
int valSensortemp = 1;
int valSensorspo = 1;
int valSensorhr = 1; 
int buzzer = 13;

uint32_t tsLastReport = 0;

void(* resetFunc) (void) = 0; 
  
void setup() {
  Serial.begin(9600);
  esp8266.begin(115200);
  sendCommand("AT",5,"OK");
  sendCommand("AT+CWMODE=1",5,"OK");
  sendCommand("AT+CWJAP=\""+ AP +"\",\""+ PASS +"\"",20,"OK");
  lcd.init();
  lcd.backlight();
  pinMode(buzzer , OUTPUT);
  pox.begin();
  mlx.begin();
}

void loop() 
{
   pox.update();
  if (millis() - tsLastReport > REPORTING_PERIOD_MS) 
  {
    lcd.clear();
    lcd.setCursor(0 , 0);
    lcd.print("Temp:    ");
    lcd.print(mlx.readObjectTempC(),1);lcd.print(" C");
    lcd.setCursor(0 , 1);
    lcd.print("Sp02:");lcd.print(pox.getSpO2());lcd.print("%");
    lcd.print("  HR:");lcd.print(pox.getHeartRate(),0);

        if (pox.getSpO2() >= 30 && pox.getSpO2()<=85)   
          {
             delay(100);
              digitalWrite(buzzer , HIGH);
                 delay(7000);
                digitalWrite(buzzer , LOW);
                 resetFunc(); 
           }

    tsLastReport = millis();
  }
 valSensortemp = getSensorDatatemp();
 valSensorspo = getSensorDataspo();
 valSensorhr = getSensorDatahr();
 String getData = "GET /update?api_key="+ API +"&"+ field +"="+String(valSensortemp) +"&"+ field1 +"="+String(valSensorspo)+"&"+ field2 +"="+String(valSensorhr);
 sendCommand("AT+CIPMUX=1",5,"OK");
 sendCommand("AT+CIPSTART=0,\"TCP\",\""+ HOST +"\","+ PORT,15,"OK");
 sendCommand("AT+CIPSEND=0," +String(getData.length()+4),4,">");
 esp8266.println(getData);delay(1500);countTrueCommand++;
 sendCommand("AT+CIPCLOSE=0",5,"OK");
}

 int getSensorDataspo()
 {return (pox.getSpO2());}
     
 int getSensorDatahr()
 {return (pox.getHeartRate(),0);}
      
 int getSensorDatatemp()
 {return (mlx.readObjectTempC(),1);}
    
void sendCommand(String command, int maxTime, char readReplay[]) {
  Serial.print(countTrueCommand);
  Serial.print(". at command => ");
  Serial.print(command);
  Serial.print(" ");
  while(countTimeCommand < (maxTime*1))
  {
    esp8266.println(command);
    if(esp8266.find(readReplay))
    {
      found = true;
      break;
    }
    countTimeCommand++;
  }
  if(found == true)
  {
    Serial.println("OYI");
    countTrueCommand++;
    countTimeCommand = 0;
  }
   if(found == false)
  {
    Serial.println("Fail");
    countTrueCommand = 0;
    countTimeCommand = 0;
  }
    found = false;
 }

I'm thinking that the ESP's bus isn't compatible with the bus speed of the MAX30100
Any thoughts?

@mhamat ,

Your topic was moved to its current location as it is more suitable.

Could you also take a few moments to Learn How To Use The Forum.

It will help you get the best out of the forum in the future.

Thank you

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.