Why use MQTT with InfluxDB with sensors

Hi

I am trying to send my DS18B20 sensor data to InfluxDB and then use Grafana. I have seen a few examples to get this working, but they all use MQTT. Why is that? Is there no way to just send the data from the sensor to the DB?

If your sensor is directly connected to your board, there is no need to use MQTT at all, you can send the readings straight to InfluxDB.
BUT, if you start adding remote sensors you will be well advised to consider MQTT as it adds a sensible framework for collecting data, it also adds a layer of safety for sensor values by being able to guarantee that the data reaches its destination. It is well worth taking the time to get to know MQTT.

Also it allows you to separate the parts of your flows which keeps the flows simper. You can have a flow (tab) the collects that inputs from the sensors and passes them to MQTT. Then a separate flow which picks up the data from MQTT and displays them on a dashboard. Switch positions and so on feed back to MQTT again. A third flow picks up the data from MQTT and passes it to Influxdb. Note that the flow that shows the dashboard need not even be on the same computer that picks up the inputs as it can subscribe to the MQTT server remotely.

3 Likes

Can you share some of the examples that you use?

Who is that addressed to, and examples of what?

RousSA said that he have seen a few examples to send DS18B20 sensor data to InfluxDB and then use Grafana using MQTT