adam-gligor monologue about stuff, brain dump

Sending data from esp8266 to firebase

Notes on sending data from exp8266 to google firebase …

Intro

Here’s a quick setup for sending data from esp8266 running nodemcu to google firebase.

Step1. Build a firware with TLS/SSL support

When buildig the firmware nodemcu-build tick the tls/ssl support checkbox. Firebase http call require transport layer security.

placeholder

Step 2. Find the database secret

One way to use the firebase http api is to include the database secret in the calls.

The secret key is located in project overview > settings > service accounts > database secrets

placeholder

Step 3. Post some data

There’s a http request that sends data from nodemcu using the http module

 http.post('https://bees-134b7.firebaseio.com/hive1/data.json?auth=<your_secret>',
     'Content-Type: application/json\r\n', 
     '{"humidity":'..dhtHumi..',"temperature":'..dhtTemp..',"weight":'..hxWeight..'}',
     function(code,data)
        print("firebase post status", code)
     end)

Here’s the data showing up in firebase

placeholder

Resources

  • Firebase oficial docs here
  • Firebase http api docs here
  • Nodemcu http module docs here