Middleware in Node Red

Dear Node Red community,

I'm building my own IoT demonstrator as kind of a university project at the moment.

I connected a DS18B20 temperature sensor to a Raspberry Pi and from there to Node Red.

The thing I struggle with, is identifying the elements of the IoT Architecture. The Pi would be the device communicating over the Gateway (The universities Wi-Fi Router) with Node Red, but where in all this would be the Middleware? Is it the Http Protocol processing the request send form the Pi?

Thank you for your support!

Welcome to the forum! If you are trying to show a situation where the sensor is at a seperate location, might I suggest you connect it to a WeMos D1 mini flashed with eithor ESPEasy or Tasmota. The WeMos has wireless capibility and you could send the data via MQTT.

Or are you saying that Node-RED is on a different device than the Pi and you need to send data. If that is the case, I would install NR on the Pi and still use MQTT to send the data the Pi reads via MQTT to the other instance of NR. You could install MQTT on the Pi. The Pi would publish the data, and your other device with NR would 'subscribe' to the topic the data is published with.

For a good idea of how MQTT works, go read this set of blog posts https://www.hivemq.com/mqtt-essentials/ and feel free to ask any questions

To install MQTT on the Pi, do a google search using rpi install mosquitto

1 Like

Thank you so much the great response!
It really helped me and I thought about using MQTT as well.
However my question was rather simpler. In a world where the Pi is directly connected to the Node Red Plattform via Ethernet (and the sensor is at the same location as the Pi), what would be the Middleware or is the none?

But how is your temperature sensor/pi talking to the outside world ? mqtt, http, tcp/udp ?
You need some software/code to generate the values coming out of the pi no ?

1 Like

I would say there's no exact definition to answer this so it's a bit difficult to answer. If I understood correctly you have:

  • a DS18B20 sensor connected to a Raspberry Pi
  • a cloud server / database of some sorts
  • Raspberry Pi runs Node-RED to read the sensor and send the data to the cloud server / database

I would say the Raspberry Pi running Node-RED is acting as an edge computing device and the Wi-Fi router is the gateway and there's no middleware.

To be perfectly honest I'm not an IoT architecture expert but I haven't seen middleware mentioned in that context.

Edit: after specifically searching for "middleware iot architecture" I found this picture. In that model Node-RED AND the cloud server would form the middleware layer.

1 Like

That is the issue I have, by using the Node Red Application which is preinstalled on the Pi there is no need to generate some kind of code.
Since it communicates via the Internet and Node Red would be my IoT Plattform I would assume that the HTTP Protocol is my Middleware.

HTTP protocol is just what the name implies, a transfer protocol.

Could I say that my Raspberry Pi and Node Red are communicating over a HTTP Protocol and the Middleware would by the API of the Node Red Application?

No I would not say that. Middleware is typically used when talking about software that processes data to be further sent onwards. Or alternatively software used to bridge the communication gap between two services/devices that otherwise would not support direct communication between each other.

1 Like

Yes you are right. Since there is only source of data comming from the sensor, there is no need for a typical Middleware.

1 Like

If the sensor was connected to something like a WeMos and sent the data via MQTT then MQTT would be the middleware

or if the sensor is connected to the Pi and a python program read the data and used MQTT (installed on the Pi) to send to NR (also installed on the Pi) then MQTT would still be the middleware.

1 Like

Strictly speaking wouldn't MQTT be the protocol and mosquitto (or whatever) be the middleware?
Though I am not really sure that middleware is the right term for any of this.

1 Like

I would also be hesitant calling Mosquitto middleware. Somehow the term feels out of place in the context of IoT and maybe even old fashioned overall but given the context it sounds like it's a term used in education context these days.

Then again I'm not an IoT architect, only an ecom developer/consultant. :slightly_smiling_face:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.