This is a simple reference project to lear how to use Firebase Realtime Database. The main porpouse is to show interaction between diffent applications, thanks to Firebase. This sample simulate an IoT enviroment of temperature sensors array, and show it on a dashboard. It's also possible to simulate fake sensor data.
- Create a Firebase project from console.
- Go to Console->Database->Rules and remove auth request writing following data: (WARNING: don't do it for production appplications!)
{
"rules": {
".read": true,
".write": true
}
}
- Find config to link projects to Firebase
- Clone this repo or download.
- Go into single folder to start project
Dashboard ans Emulator are based on create-react-app
Remember to copy your Firebase config on src/index.js (repeat for each program)
cd [dashboard or sensor]
npm install
npm start
Then follow create-react-app instruction and get fun exploring the code
Launching second application you will notice this message:
Something is already running on port 3000. Probably:
say yes (y) to to run each program.
This code is for Arduino IDE and is tailored for WeMos mini Board, using DHT11 Shield.
Before start remember to add Arduino core for ESP8266 WiFi chip into your Arduino IDE config.
Other libraryes could be necessary, install using Arduino Library Manager. Based on firebase-arduino, it need config:
FIREBASE_HOST "<Firebase host setting>"
FIREBASE_AUTH "<database code>"
WIFI_SSID "<WiFi Name>"
WIFI_PASSWORD "<your WiFi password>"
how to find database code :
- Click on the settings/cog wheel icon next to your project name at the top of the new Firebase Console
- Click Project settings
- Click on the Service Account tab
- Click on the Database Secrets link in the inner left-nav
- Hover over the non-displayed secret and click Show
Warning:
this method could change, check issue 224 and issue 265
This project doesn't cover security management and require an unauthorized read and write privileges.
USE ONLY FOR STUDY POURPOSE!
or add auth level.