How firebase acts as a middleman between Raspberry pi and a system dashboard

2,386 views
Skip to first unread message

darren sim

unread,
Nov 7, 2016, 10:27:32 AM11/7/16
to Firebase Google Group
Hi guys ,

Sorry i am new to firebase. Like for a week or so as i am tasked to use it in my little project. I am new to raspberry pi too and new to Sensors or this whole topic called IOT. But i managed to find out alittle about raspberry pi and Kaa. But in this context , it looks like that my raspberrypi has to connect with Kaa . where from the kaa , the firebase supposed to get data from it. Firebase in my case is a real time database it seems. I wonder how does firebase in this case pulls out data from Kaa ? or if it doesnt , can firebase speak directly to my raspberry pi and get data from it?

Jacob Wenger

unread,
Nov 10, 2016, 6:40:46 PM11/10/16
to fireba...@googlegroups.com
Hey Darren,

Typically we suggest people use our Node.js SDK for IoT devices like the Raspberry Pi. Here is a guide for installing Node.js on a Raspberry Pi I found after doing a quick search online. We have a C++ SDK, but I believe it only works with Android and iOS runtimes, not IoT devices like the Raspberry Pi.

Cheers,
Jacob

On Mon, Nov 7, 2016 at 4:57 AM, darren sim <darre...@gmail.com> wrote:
Hi guys ,

Sorry i am new to firebase. Like for a week or so as i am tasked to use it in my little project. I am new to raspberry pi too and new to Sensors or this whole topic called IOT. But i managed to find out alittle about raspberry pi and Kaa. But in this context , it looks like that my raspberrypi has to connect with Kaa . where from the kaa , the firebase supposed to get data from it. Firebase in my case is a real time database it seems. I wonder how does firebase in this case pulls out data from Kaa ? or if it doesnt , can firebase speak directly to my raspberry pi and get data from it?

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/8b553a4d-0a9a-40fa-93e7-89f4c5d92179%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tom Larkworthy

unread,
Nov 10, 2016, 6:55:50 PM11/10/16
to Firebase Google Group
Kaa is a self-hosted server technology. So if you used Kaa, you IoT data would be held in *your* Kaa servers setup by you, on infrastructure you would provision and pay for yourself (e.g. AWS, see http://www.kaaproject.org/getting-started/). Firebase is a backend-as-a-service technology, so your IoT devices would send data to *our* servers and you would not have to manage or provision servers.

Sandor Roka

unread,
Dec 1, 2016, 10:55:13 AM12/1/16
to Firebase Google Group
Hi Jacob,

I plan a small app where users could authenticate themself with password auth, (or maybe on other ways as well), and they could register their iots devices like Rasberry. Pi.
The devices would upload data, share with the owner user and with others as well. 


On the Pi I would use the node.js SDK as you have mentioned.

but what kind of auth do you recommend for the nodejs/RPi iots clients ? 

thanks
Sandor
  




On Friday, 11 November 2016 00:40:46 UTC+1, Jacob Wenger wrote:
Hey Darren,

Typically we suggest people use our Node.js SDK for IoT devices like the Raspberry Pi. Here is a guide for installing Node.js on a Raspberry Pi I found after doing a quick search online. We have a C++ SDK, but I believe it only works with Android and iOS runtimes, not IoT devices like the Raspberry Pi.

Cheers,
Jacob
On Mon, Nov 7, 2016 at 4:57 AM, darren sim <darre...@gmail.com> wrote:
Hi guys ,

Sorry i am new to firebase. Like for a week or so as i am tasked to use it in my little project. I am new to raspberry pi too and new to Sensors or this whole topic called IOT. But i managed to find out alittle about raspberry pi and Kaa. But in this context , it looks like that my raspberrypi has to connect with Kaa . where from the kaa , the firebase supposed to get data from it. Firebase in my case is a real time database it seems. I wonder how does firebase in this case pulls out data from Kaa ? or if it doesnt , can firebase speak directly to my raspberry pi and get data from it?

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.

Jacob Wenger

unread,
Dec 2, 2016, 5:16:56 PM12/2/16
to fireba...@googlegroups.com
@Sandor - How would users register their Raspberry Pis? Would there be a corresponding mobile app or website which they used to sign into their account in order to register devices?

The way this typically works is that there is a mobile app which a users signs into with their username and password. You would use Firebase Authentication on that app to verify the user. Once that user is logged in, there would be some way to register devices (such as a pin number or a physical connection). Once registration is complete, the mobile app would grab its local ID token, send that to a custom server which uses it to create a custom token, and then share that token with the IoT device. The IoT device would then log in using the Node.js SDK's signInWithCustomToken() method. Now, that IoT device is signed in indefinitely with the user's identity.

Without your exact use case, I can only give a generic answer. But if you can share more details about your setup and how you'd like to register devices, we can maybe dive a bit deeper on some of these topics.

Cheers,
Jacob

To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.

To post to this group, send email to fireba...@googlegroups.com.

Sandor Roka

unread,
Dec 4, 2016, 12:28:06 PM12/4/16
to fireba...@googlegroups.com
Hi Jacob,

Thanks for your answer.

To be honest I was hoping I can build my app serverless, but if I understand your answer correctly I have to have a server anyway just for creating and checking the custom tokens. Correct ? 

OK, I see I may use providers like Auth0, but that is external provider, not part of Google Firebase. Just wondering, my understanding was Firebase is targeting for mobile/web/iots devices, serverless developments, but practically it is not possible to achieve this now ?    

Btw I'm really beginner on this area, excuse me if I have stupid questions...

My plan is really looks as you have mentioned:

- The users are installing a nodejs app on their raspberry PI. The app can communicate with firebase and has a REST API available locally
- The users starting their mobile/web app, registering at Firebase using one of the standard methods
- The App scanning the local network, find the Pi. From the Pi local data the app can see it is a new device, never registered before.
- The user can "register" a new device in the FB database, getting a new key generated by FB, let say under the iots/ node, or similar.
- The app will get the key from FB, forward this key to the Pi, Pi will store it. From now it is a registered Pi device, belongs to a user.
- The Pi device have to log on the FB, watch for changes under iots/deviceId, and post new values to here as well.
- The user can see the values reported by his Pi devices in the app/web, realtime through FB , and can send messages to the units,
- etc...

In my test the PI devices authenticating themselves with user ID and pwd, but this should not be the case at a real app (?), and in this case I will not be able to setup proper authorisations and db validations. All Pi device can do what just want in the name of the user...


So any advise regarding the authentication, or regarding this scenario as well, welcome.

thanks in advance,
Sandor





--
You received this message because you are subscribed to a topic in the Google Groups "Firebase Google Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/firebase-talk/X6xcFIajkPU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to firebase-talk+unsubscribe@googlegroups.com.

To post to this group, send email to fireba...@googlegroups.com.

Jacob Wenger

unread,
Dec 5, 2016, 4:43:43 PM12/5/16
to fireba...@googlegroups.com
Hey Sandor,

Your plan sounds reasonable to me. The crux of the issue here is that the Raspberry Pi needs to authenticate to Firebase at some point. Unfortunately, you cannot just send an ID token from the phone to the Pi and have it log in with that token. You will need to create a new ID token somehow. I think you have two plausible ways of making this happen:
  1. Share the email and password combination with the Pi and have it log in with signInWithEmailAndPassword().
  2. Have a custom server create a custom token and send that to the Pi for it to log in with signInWithCustomToken().
Both ways should work for you. The benefit of (2) is that it's more secure (the Pi never has to handle any credentials), but it does require your own server. For what it's worth, your custom server would be very small (that is, only contain a little bit of code) and would cost next to nothing on services like Google App Engine or Heroku.

Cheers,
Jacob

Reply all
Reply to author
Forward
0 new messages