Introduction
This article demonstrates how we can interact with our Google Firebase data using a Raspberry Pi and Node-Red visual programming environment.
Node-Red
Node-Red is a visual programming environment that allows users to create coding by dragging and dropping nodes on the screen. Node-Red has been preinstalled on noobs. It can also be installed on Windows and Linux. You can run Node-Red on your specific system.
Step 1
Install / Upgrade
Since Node-RED is already installed, you can install or upgrade it using the Node-RED upgrade script command mentioned below.
Next, go to Raspbian Start >> Programming >> Node-Red.
Start the Node-Red program.
Step 2
Open Google Firebase Console " https://console.firebase.google.com" and create a new project. Here, our project name is Node-Red.
Enable Email/Password sign-in
- In the Firebase console, open the Auth section.
- On the "Sign in method" tab, enable the Email/password sign-in method.
Create a child path. Here, the child name is D1. Copy the Firebase connection link "https://node-red-xxxxx.firebaseio.com".
The given child value is null or zero.
Step 3
Once Node-Red has started, point a browser at http://Local_IP:1880. This works better with the Chrome or Edge browsers.
Select the "Manage palette" option from the right side of the menu bar.
Then, search for “firebase” and install the node-red-contribs-firebase and node-red-contribs-firebase real-time databases.
We will also send a text comment back to our Firebase database and then let's start dragging and dropping the "Firebase modify" and "inject i/p".
The child path name is the same as of the Firebase database child name, i.e., "D1".
- Text string to Firebase -- a text input node is wired to a firebase modify node.
- Edit the firebase modify node with the correct database address and value to set.
- The string is successfully connected and click the "deploy".
Output
The values are pushed to Google Firebase.
Summary
Finally, we have successfully started interacting with Google Firebase using Raspberry Pi and Node-Red.