Raspberry Pi IoT with Firebase
What is Firebase?
Firebase is Backend as a Service ( BaaS ) by Google.Firebase gives you many tools to develop high-quality apps, grow your user base, and earn more money. We cover the essentials so you can monetize your business and focus on your users.
In This Project. We are focus on Realtime Database first.

Real Time Database
The Firebase Realtime Database is a cloud-hosted NoSQL database that lets you store and sync data between your users in realtime.Updated data syncs across connected devices in milliseconds, and data remains available if your app goes offline, providing a great user experience regardless of network connectivity.
Firebase Console
Go to Console
Add New Project

Add Project Name

Menu Database

Change Rules
// These rules require authentication
{
"rules": {
".read": "auth != null",
".write": "auth != null"
}
}
Change to this
Warning !!! This is for test first. Anyone can read and write your database without authentication.
// These rules are not require authentication
{
"rules": {
".read": true ,
".write": true
}
}
Your Realtime Database is ready to use.
and show URL Link for your firebase realtime database. ( https://raspberrypi-3d41f.firebaseio.com/ )
Now Make Raspberry Pi sent data to Firebase Realtime Database
Wiring Diagram
Hardware
- Raspberry Pi Board ( we use Raspberry Pi3 board ) + Accessories
- DHT11 Temperature and Humidity Sensor with Resistor 4.7 K Ohm ( or DHTxx )
- I2C OLED Display ( 128 x 64 0.96' SSD1306 chip ) for Option ( Install OLED Library )
Install DHT Python Library
$ git clone https://github.com/adafruit/Adafruit_Python_DHT.git
$ cd Adafruit_Python_DHT
$ sudo apt-get install build-essential python-dev python-openssl
$ sudo python setup.py install
Install Firebase Python Library
$ sudo pip install requests==1.1.0
$ sudo pip install python-firebase
Python Source Code on Github
https://github.com/amphancm/Raspberrypi_Firebase
Code
dht-firebase.py ( without OLED Display)
dht-firebase-oled.py ( need OLED display )
and Minecraftia.ttf is font for OLED.
Reference
https://pypi.python.org/pypi/python-firebase/1.2
My Website
email : info@softpowergroup.net ,amphancm@gmail.com Tel .+6681-6452400
LINE : adunfong
FaceBook : https://www.facebook.com/adun.nantakaew
email: amphancm@gmail.com







