# Why use MQTT with InfluxDB with sensors

**URL:** <https://discourse.nodered.org/t/why-use-mqtt-with-influxdb-with-sensors/5145>\
**Category:** General\
**Created:** [23 November 2018 13:16 UTC](https://discourse.nodered.org/t/why-use-mqtt-with-influxdb-with-sensors/5145 "2018-11-23T13:16:42Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![RoueSA](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rouesa/32/2102_2.png) [@RoueSA](https://discourse.nodered.org/u/RoueSA)\
**Post date:** [23 November 2018 13:16 UTC](https://discourse.nodered.org/t/why-use-mqtt-with-influxdb-with-sensors/5145/1 "2018-11-23T13:16:42Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [23 November 2018 13:25 UTC](https://discourse.nodered.org/t/why-use-mqtt-with-influxdb-with-sensors/5145/2 "2018-11-23T13:25:47Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [23 November 2018 16:12 UTC](https://discourse.nodered.org/t/why-use-mqtt-with-influxdb-with-sensors/5145/3 "2018-11-23T16:12:10Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Martin10](https://avatars.discourse-cdn.com/v4/letter/m/a587f6/32.png) [@Martin10](https://discourse.nodered.org/u/Martin10)\
**Post date:** [3 May 2020 13:36 UTC](https://discourse.nodered.org/t/why-use-mqtt-with-influxdb-with-sensors/5145/4 "2020-05-03T13:36:12Z")

</div>

Can you share some of the examples that you use?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [3 May 2020 17:03 UTC](https://discourse.nodered.org/t/why-use-mqtt-with-influxdb-with-sensors/5145/5 "2020-05-03T17:03:14Z")

</div>

Who is that addressed to, and examples of what?

---

<div class="post-metadata">

**Author:** ![Martin10](https://avatars.discourse-cdn.com/v4/letter/m/a587f6/32.png) [@Martin10](https://discourse.nodered.org/u/Martin10)\
**Post date:** [3 May 2020 17:16 UTC](https://discourse.nodered.org/t/why-use-mqtt-with-influxdb-with-sensors/5145/6 "2020-05-03T17:16:05Z")

</div>

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