Connection refused error

I'm new to Arduino and started a project. I'm trying to connect Arduino Uno rev 2 to Firebase and I have done everything but it gives me the connection refused error. I have install Arduino_LSM6DS3, Firebase_Arduino_WiFiNINA and WiFINiNA libraries.

/*
  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>
#include <SPI.h>
#include <WiFiNINA.h>

#define FIREBASE_HOST "uno-wifi-r-2-e72c2.firebaseio.com"
#define FIREBASE_AUTH "msXdUVU8EgcTz17MQWqHohEOaXpQOJade0iqX0Ba"
#define WIFI_SSID "****"
#define WIFI_PASSWORD "******"

FirebaseData firebaseData;

String path = "/IMU_LSM6DS3";
String jsonStr;

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

  Serial.print("Initialize IMU sensor...");
  if (!IMU.begin()) {
    Serial.println(" failed!");
    while (1);
  }
  Serial.println(" done");
  Serial.print("Accelerometer sample rate = ");
  Serial.print(IMU.accelerationSampleRate());
  Serial.println(" Hz");

  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 x, y, z;

  // Read IMU acceleration data
  if (IMU.accelerationAvailable()) {
    IMU.readAcceleration(x, y, z);

    // Send data to Firebase with specific path
    if (Firebase.setFloat(firebaseData, path + "/1-setFloat/X", x)) {
      Serial.println(firebaseData.dataPath() + " = " + x);
    }
    if (Firebase.setFloat(firebaseData, path + "/1-setFloat/Y", y)) {
      Serial.println(firebaseData.dataPath() + " = " + y);
    }
    if (Firebase.setFloat(firebaseData, path + "/1-setFloat/Z", z)) {
      Serial.println(firebaseData.dataPath() + " = " + z);
    }

    // Push data using pushJSON
    jsonStr = "{\"X\":" + String(x,6) + ",\"Y\":" + String(y,6) + ",\"Z\":" + String(z,6) + "}";

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

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

image

Tried Google on "Arduino + Firebase"?

So you need to find out what, exactly, would cause that particular error - that would be in the Firebase documentation.

It sounds like the kind of thing that would happen when your Authorisation/Authentication details (username, password, keys, etc) are wrong ...

you mean? google for the solutions? yeah I have tried

I double check but still the same issue

So have you found out what, exactly, would cause that particular error?

not yet

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