Why use mqtt server for BLE gateway? - firebase

I have a BLE temperature sensor, which should send measurements to an ESP32 via a BLE connection and my plan was that the ESP32 could send the measurements via WiFi to my database (Firebase Realtime Database). However, I have seen from a few tutorials that a mqtt server would be neccesary (see the screenshot below - link to the video: https://www.youtube.com/watch?v=PBYCG-ypvRY). Could someone please explain to me why the mqtt component is neccesary? Currently I am measuring temperatures using my ESP32 (without the BLE temperautre sensors) and sending them directly to the database, so I am confused as to why with BLE I would need a mqtt server.
Thanks for your help in advance!

You don't need MQTT. It's just one of the IoT-friendly protocol alternatives (like HTTPS, AMQP, CoAP, homebrew, etc) available to you for device-to-server communication. There are pros and cons to each one. It's up to you to choose whatever solution is relevant to your system.
If you've already implemented the Firebase HTTPS interface and it does the job, you're done.
If you are having problems, note that the Google IoT Core also prescribes MQTT (or, alternatively HTTPS) as an underlying messaging protocol - used together with the Device SDK for Embedded C. But this is for people who want to have a large-scale authentication and management solution for their devices. By all means, stick to your existing solution if it works.

Related

Can I use HTTPS and SSE client libraries on Arduino PORTENTA Machine Control board?

I am looking for simple board for IoT professional projects. I bumped into the Arduino PORTENTA Machine Control board a while back, but I cannot get some things sorted out:
What libraries can I use on this board (mainly SSE and HTTPS libraries)?
Does it have enough computational power to do HTTPS requests (not HTTP but HTTPS)?
What am I trying to achieve:
I am trying to build a project around Google’s Firestore / Firebase.
I need to communicate to it via REST API.
Google enables only HTTPS communication with their databases – and
normal Arduino boards can’t do HTTPS requests because they do not
have enough power.
So, I need either SSE client + HTTPS requests library to run on the
PORTENTA board OR Firebase Realtimedatabase library (I know the
library is built on HTTPS requests – but if it’s not compatible I can
recreate it with SSE client and HTTPS requests).
Other info:
By SSE I mean Server Send Events for Realtime communication and
updates to the board :)
I have no problem programming it in native Arduino language or in Micropython.
The answer below states that I can use those libraries if the board is supported - but I don't know how to know if the board is supported :/
I have never heard that Arduino lacks the power for HTTPS requests and Arduino have documentation on how to make HTTPS requests for many of their official boards: https://arduinogetstarted.com/tutorials/arduino-https-request
If you are using an unsupported board you will have to route the traffic to another host first. Either another Arduino or an ESP to act as the main host/client that it can communicate to access external resources such as Firebase.

What network protocol does python influxdb use to send data?

I'm interested in the answer to this question above because I'm trying to setup my Lab so I can send data from an ESP32 device over wifi to Influx DB hosted on my local network with a raspberry pi.
I've tried doing this with udp but the arduino libraries are very poorly documented (and didn't work)
and I couldn't find anything from Influx about what and how the data sending format should be...
Also is there a way to quickly find the network method used to transmit communicate with Python and influxDB?
According to the documentation here they support several methods.
Looking in particular to the upd listener seems that you need to enable the listener on the influx db server first.

Support for ESP8266 and Firebase

I am trying to connect to Firebase from an ESP8266 microcontroller. This device has limited RAM and can't handle large TLS fragments. The developer who supports TLS for ESP8266 implemented Maximum Fragment Length Negotiation only to find that Firebase servers ignore it. Is somebody at Firebase listening? Can anything be done to turn on this option on your servers?
You can see the discussion here, towards the bottom.
I use some Esp8266's with Firestore to monitor my foil tunnel for tomatoes and it works good.
I use the Firebase-ESP-Client from mobizt.
https://github.com/mobizt/Firebase-ESP-Client

Using MQTT between Raspberry Pi, Arduino and JavaScript

A mate and I are doing a project at the moment that hosts a webpage on a raspberry pi which I would like to send a message via MQTT to the arduino which reads sensors and then sends the values back to the pi to be displayed on the web page.
I am hoping to use Mosquito on the pi as a broker and treat the arduino and the webpage as clients.
I am just having a lot of trouble working out how it all fits together.
A lot of examples I have seen use web sockets and node.js and MQTT.io and I'm just so confused..
Could someone please help me piece it all together and explain how everything fits and what it does?
Thanks in advance!
Websockets allows a web browser to open a bi-directional communication pipe to a server.
For websockets to work you need a websocket enabled mqtt broker. At the moment you have to install this seperately, some examples of what is out there are here. Mosquitto will have websockets enabled in the next version, 1.4, you can compile it if you wish.
An example of what can be done, and what I am doing atm with mqtt and websockets is;
publish temperature data to mqtt broker from an arduino.
subscribe to the topic that the arduino is publishing to and populate the data into a mysql database using python scripts.
have a live website subscribe to the topic and show the current temperature as a line graph.
We did tutorials on building applications with MQTT and websockets in the past. Slides (+ Code) can be found on Slideshare.
If you're interested in how MQTT over websockets works in detail, this blog post may help you. Also, a full example websockets/MQTT application tutorial can be found in this blog post.

GPS data to a website

There is a GPS device which can send data to IP:Port. I have a website hosted on IP 1.2.3.4
Can I send GPS data from the device to that website? 1.2.3.4:8080? How I will retrieve the data?
This is the device
http://cgi.ebay.com/GSM-GPRS-GPS-Vehicle-Car-Tracking-System-Tracker-Device-/270683202099?pt=AU_Car_Parts_Accessories&hash=item3f05f9e233
Maybe this should be a comment...
To be honest we can't answer that question the device will most likely use its own data format(s) so the service that receives from it will have to implement those. Additionally the device might not support web protocols, it could use raw TCP sockets for example, so you may have to implement a listener service that adheres to those protocols. In fact it looks like the device uses GSM (a mobile telephony standard), so using a web site to receive the data is definately off the cards unless you have a GSM proxy service sitting between the device and the web server.
Assuming that you are allowed to implement your own service it follows that the documentation will include the necessary details and if you are lucky a full SDK that you can use.

Resources