Connection refused Arduino rev2 wifi to Firebase

Im trying to send data from IR temperature Sensor MLX90614 to firebase database. This is my code. I added the ssl certificate of firebase and updated the firmware. Im doin Arduino since 4 das so im quite a noob but i dont know what im doing wrong.



#include <Adafruit_MLX90614.h>

#include <Wire.h>




/*
  Project: Send Data to Firebase Using Arduino Uno WiFi Rev2
  Board: Arduino Uno WiFi Rev2
   
  External libraries:
  - Arduino_LSM6DS3 by Arduino V1.0.0
  - Firebase Arduino based on WiFiNINA by Mobizt V1.1.4
 */

#include <Arduino_LSM6DS3.h>
#include <Firebase_Arduino_WiFiNINA.h>
Adafruit_MLX90614 mlx = Adafruit_MLX90614();

#define FIREBASE_HOST "console.firebase.google.com/project/ground-temp-sensor/database/ground-temp-sensor-default-rtdb/data/~2F.firebaseio.com"
#define FIREBASE_AUTH "QRGQakZj9i8PciZ4gG3I6ipmptHWUyCP7Yz2IQ19"
#define WIFI_SSID "FRITZ!Box 6490 Cable"
#define WIFI_PASSWORD "xxxxxxx"

FirebaseData firebaseData;

String path = "/MLX90614";
String jsonStr;

void setup()
{
  Serial.begin(9600);
  delay(1000);
  Serial.println();
 

  Serial.print("Initialize IR sensor...");
  if (!mlx.begin()) {
    Serial.println(" failed!");
    while (1);
  }
  

  Serial.print("Connecting to WiFi...");
  int status = WL_IDLE_STATUS;
  while (status != WL_CONNECTED) {
    status = WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
    Serial.print(".");
    delay(300);
  }
  Serial.print(" IP: ");
  Serial.println(WiFi.localIP());
  Serial.println();

  Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH, WIFI_SSID, WIFI_PASSWORD);
  Firebase.reconnectWiFi(true);
}

void loop()
{
  float Umgebungstemperatur, Objekttemperatur;

   //Ausgeben der Umgebungstemperatur in Grad Celsius
  Serial.print("Umgebungstemperatur = "); 
  Serial.print(mlx.readAmbientTempC());
  Serial.print("°C"); 
  Serial.print("\t\t"); 
  //Ausgeben der Tmeperatur eines Objektes in Grad Celsius
  Serial.print("Temperatur des Objektes = "); 
  Serial.print(mlx.readObjectTempC()); 
  Serial.println("°C");
  delay(100); //eine kleine Pause von 750ms

    // Send data to Firebase with specific path
    if (Firebase.setFloat(firebaseData, path + "/1-setFloat/Umgebungstemperatur", Umgebungstemperatur)) {
      Serial.println(firebaseData.dataPath() + " = " + Umgebungstemperatur);
    }
    if (Firebase.setFloat(firebaseData, path + "/1-setFloat/Objekttemperatur", Objekttemperatur)) {
      Serial.println(firebaseData.dataPath() + " = " + Objekttemperatur);
    }
    
   

    // Push data using pushJSON
    jsonStr = "{\"X\":" + String(Umgebungstemperatur,6) + ",\"Y\":" + String(Objekttemperatur,6) + "}";

    if (Firebase.pushJSON(firebaseData, path + "/2-pushJSON", jsonStr)) {
      Serial.println(firebaseData.dataPath() + " = " + firebaseData.pushName());
    }
    else {
      Serial.println("Error: " + firebaseData.errorReason());
    }

    Serial.println();
    delay(2000);
  }

This is my firebase data:

It always says connection refused or connection lost.
16:13:55.366 -> Initialize IR sensor...Connecting to WiFi.... IP: 192.168.178.87
16:13:58.811 ->
16:13:58.811 -> Umgebungstemperatur = 26.29°C Temperatur des Objektes = 25.79°C
16:14:47.809 -> Error: connection refused
16:14:47.809 ->
16:14:49.798 -> Umgebungstemperatur = 26.49°C Temperatur des Objektes = 26.59°C
16:15:04.055 -> Error: connection lost
16:15:04.101 ->

i would be so happy for any helpful comments. Thank you

Versuchen Sie, dies auf mehr als 750 ms zu erhöhen (Sie warten jetzt nur noch 100 ms).

delay(100); //eine kleine Pause von 750ms

English please :wink:

Try increasing this to more than 750ms (you're only waiting 100ms now).

delay(100); //a small break of 750ms

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