Can Arduino Uno send data to Cloud Firestore? - arduino

I need information on how to connect and send data to firestore from an Arduino Board and an ESP2866 module. I've only found tutorials using Firebase realtime, the ones I found using Firestore are using the NodeMCU board.
I have a Vue.js application reading some fields from a Firestore db, which should recieve information from the arduino with some attached sensors. From what I've seen my options are changing to firebase realtime or changing to NodeMCU( not possible ). I some direction to follow, on how to use firestore with arduino or just change the db.

One way to do it is to have an online server, after that it becomes very easy. Send your Arduino data to the server and then write the data to Cloud Firestore.
To find how to write data into Firestore, refer this documentation: https://firebase.google.com/docs/firestore/manage-data/add-data and chose the integration for your server. Firestore supports most of the popular server integrations like Node.js, GO, PHP, Python etc.
As answered by #doublejosh, refer to this documentation: firebase-extended

I had quick success using firebase-arduino for the real-time database rather than Firestore. Since Arduino projects are generally hobby, this should probably work well enough.

Related

Raspberry pi integration with cloud Firestore

I'm trying to make access control using firebase and mobile app. Right now my mobile app are saving user data in cloud Firestore. Can my raspberry pi fetch data from cloud Firestore for verification? how can I make this?
Posting this as a Community Wiki, as this is based on the comments of #jeffkmeng and #Nick.McDermaid:
Your Raspberry PI is just a computer. You can run code on it, in whatever language you'd like and that firebase supports, and that code can access cloud firestore. You could also consider trying out firebase functions, which might also be appropriate for your use case.
Furthermore you can find an example of how connect to Firestore from a Raspberry PI device in this article in Medium.

Communication between Firestore and ESP32

I am doing a project to identify people via RFID in ESP32. When performing the identification, the ESP must consult the data referring to the identified RFID TAG and display the related data on a display (name, city, date of birth).
However, I am not able to understand how I carry out this communication between ESP and Firestore. Can anyone help me?
Thanks!
The intended method of talking to the Google Cloud from an ESP32 is through the IoT Core. Note that this will not get you a direct connection to the Firestore - you'd have to write some cloud side code to translate MQTT messages into database queries and responses. This shouldn't be very difficult, though.
Otherwise you can send HTTPS queries directly to the Firebase REST API. Read the Google documentation for that.
If you are using ESP-IDF framework for your development you can use this ESP-IDF component to communicate with Firestore (this component uses Firestore REST API via HTTPS):
https://github.com/kaizoku-oh/firestore.git
Here is also an example using RFID and Firestore components that you can change according to your needs:
https://github.com/kaizoku-oh/firestore-rfid-node.git

Is it possible to upload data to Cloud Firestore via Powershell with user Authentication?

I can't see much online as to whether it's possible to upload data to Cloud Firestore via Windows Powershell, I know you are able to upload data to the Realtime Database fairly easily, but is this possible for Cloud Firestore?
I need to be able to authenticate a user for upload to follow the database rules and upload rather than using the service account key?
Thanks for any answers or advice you may be able to provide me with.
If you are asking if there is a similar mechanism as the Firebase CLI for reading and writing data to Firestore as there is with Realtime Database, the answer is no, there is no provided tool for that. It currently only provides a mechanism to delete data.
You are certainly free to write your own program using the JavaScript client libraries, which have limited support for Firebase Auth and Firestore on nodejs. You can then invoke your program on the command line. You could also use the REST APIs for both products to write something in any language you want.

How to listen to changes in Firestore with ESP8266?

How do i listen to data changes in Firebase Cloud Firestore with ESP8266? So far i have managed to connect ESP8266 with firestore to read and post data to Firestore using the REST API, but instead of constantly reading data from Firestore, I want to listen to an event when the data changes in Firestore.
In short, I want to have a stream open where i am listening for changes in Firestore.
This can be done with Firebase Real-time database, but i haven't found examples for Firestore.
Here is an example of what i am trying to do, but with real-time database: https://github.com/mobizt/Firebase-ESP8266/blob/master/examples/Stream/Stream.ino
I was asking around on some forums, and i found out that sadly this is not possible :(
The Cloud Firestore supports the REST API unless stream like feature are not available due to poor performance and Firebase team decided to remove this feature.
The only possible method that suitable for no Firebase SDK installation is the RPC (gRPC) which is not currently available in embedded device.
The other problem is database secret can't use in the Cloud Firestore, the auth or custom token is required and need the SSL/TLS library for key encryption and signing. This can be done in ESP32 with mbed TLS which can't do this in ESP8266 with BearSSL.
Then Cloud Firestore with realtime feature (using gRPC) is not possible in ESP8266.
From a issue on github#Firebase-ESP8266: https://github.com/mobizt/Firebase-ESP8266/issues/126
The workaround can be using a webserver and/or Firebase Functions, which sadly was the thing I was trying to avoid.

How do you make an Arduino receive data through firebase?

I've worked with firebase and arduino's before but never together. I need to know how to make an arduino uno receive data through firebase, however I do not need it to send data. I have no idea how to do this, or if it is even possible. I've looked at various articles of an arduino sending data to firebase, but never receiving data.
If you thinking to connect Arduino with Firebase you will need a backend. You can use Firebase Admin SDK to create a backend.
This is a sample code for a backend.
For more Information refer the Documentation
Most likely your Arduino saves data to the Firebase Database through the REST API. If that is the case, it can also listen for data through the REST API.
There are several libraries that wrap this REST API to make is easier to use with Arduino. Instead of recommending one of those (which is off-topic on Stack Overflow), I recommend you try them and see what works best for you.

Resources