MakerGram Logo

    MakerGram

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Tags
    • Users
    • Groups

    Uploading data to firebase using NodeMCU

    Arduino
    4
    12
    2954
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A
      Anudeep @rafitc99 last edited by

      Thanks, @rafitc99. But even this didn't solve my problem!!
      I have changed the code in the below format...

      #include <ESP8266WiFi.h>
      #include <FirebaseArduino.h>       
      
      // Set these to run example.
      #define FIREBASE_HOST "syndinnovate-1.firebaseio.com"
      #define FIREBASE_AUTH "AIzaS********************7hKQe4uPbfUKHc"
      #define WIFI_SSID "SSID"
      #define WIFI_PASSWORD "PASS"
      
      void setup() {
        Serial.begin(9600);
        delay(1000);                
        WiFi.begin(WIFI_SSID, WIFI_PASSWORD);                                     //try to connect with wifi
        Serial.print("Connecting to ");
        Serial.print(WIFI_SSID);
        while (WiFi.status() != WL_CONNECTED) {
          Serial.print(".");
          delay(500);
        }
        Serial.println();
        Serial.print("Connected to ");
        Serial.println(WIFI_SSID);
        Serial.print("IP Address is : ");
        Serial.println(WiFi.localIP());                                            //print local IP address
        Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH);                              // connect to firebase                                                               //Start reading dht sensor
      }
      
      void loop() {                                                             //Convert RainSensr data into string
        
        Firebase.pushString("/NEW", "No");   
        delay(1000);//setup path and send readings
        Firebase.pushString("/NEW", "Yes");                                //setup path and send readings
        delay(1000);//setup path and send readings
      }
      
      1 Reply Last reply Reply Quote 0
      • salmanfaris
        salmanfaris @Anudeep last edited by

        @Anudeep Ok , compilation part is clear .did you getting anything on the firebase side ? Any erros ?

        A 2 Replies Last reply Reply Quote 0
        • A
          Anudeep @salmanfaris last edited by

          @salmanfaris Nothing, No errors!!
          Do I need to change anything in Firebase settings or something?

          1 Reply Last reply Reply Quote 0
          • A
            Anudeep @salmanfaris last edited by

            @salmanfaris Thanks for the support!!
            I finally resolved the error. I have taken FIREBASE_AUTH as apiKey instead of Database secrets.

            salmanfaris P 2 Replies Last reply Reply Quote 2
            • salmanfaris
              salmanfaris @Anudeep last edited by

              @Anudeep Great . Glad to know that it is solved , Keep hacking 🤖

              1 Reply Last reply Reply Quote 1
              • P
                Palani @Anudeep last edited by

                @Anudeep Hello Anudeep could you please help me out by elaborating the fix to get rid of that error?
                Thanks in advance.

                A 1 Reply Last reply Reply Quote 0
                • A
                  Anudeep @Palani last edited by

                  Hello @Palani, In the Firebase, there are two types of storage,

                  1. Cloud Firestore (Very recent one & NoSQL database)
                  2. Realtime Database (To which we upload the data using NodeMCU)

                  In the Arduino Code, you can see that there is a variable named FIREBASE_AUTH.

                  This variable should be assigned to the Database secret. This you can find in Project Settings -> Service accounts -> Database Secrets.

                  My mistake is, i have mistakenly assigned thay to Web API key. This is found at Project Settings -> General.

                  The error can also occur when u don't initialise a proper realtime database in Firebase. (This is not my case).

                  P 1 Reply Last reply Reply Quote 0
                  • P
                    Palani @Anudeep last edited by

                    @Anudeep Thanks a lot m8, I actually made a very silly mistake of including the https:// while entering FIREBASE_HOST, where I must have entered the Domain name alone and removed the https:// extension.

                    Thanks again for replying that quick. Cheers.

                    1 Reply Last reply Reply Quote 1
                    • First post
                      Last post

                    Recent Posts

                    • @codelery Awesome. That's great news. Kudos to @rafitc99 . 🙌

                      @codelery Please keep us updated about your project, looking forward to seeing it in action 🤩

                      • read more
                    • C

                      @rafitc99 I changed the buffer and that solved the problem. Thanks a lot for coming to my rescue.

                      • read more
                    • C

                      @salmanfaris I did change the buffer size and everything is working perfectly. Thanks coming to my rescue.

                      • read more
                    • @codelery said in Help needed: Arduino Wireless Notice Board project:

                      I am using the hardware serial (pin 0 and 1 on Arduino Uno)

                      As @rafitc99 mentioned, you need to expand the Serila buffer, in the hardware serial also the Arduino board package implements a 64-byte ring buffer for send and receive on the hardware serial messages. So you need to change that to 256 as per your message length.

                      • read more
                    • C

                      @rafitc99 The thing is that I am not using the SoftwareSerial library in receiving the message from the first microcontroller. I am using the hardware serial (pin 0 and 1 on Arduino Uno)

                      • read more
                    By MakerGram | A XiStart Initiative | Built with ♥ NodeBB
                    Copyright © 2023 MakerGram, All rights reserved.
                    Privacy Policy | Terms & Conditions | Disclaimer | Code of Conduct