Displaying temperature sensor from secondary raspberry

#1

I have two raspberry pi with node-red running. Both have temperature sensors (DS18B20). Both are on the same local network and no password requirements. (They also run Cayenne, if thats relevant).

How can I easiest display the sensors from the secondary raspberry on the first raspberry in the dashboard?

Any help appreciated.

#2

You should use MQTT to bring in all sensor readings. Then you can easily consolidate everything in the same dashboard

#3

I have looked a bit into MQTT, but I'm a bit confused about how to proceed. Can you/someone briefly explain the configuration/steps?

#4

By far the best intro I've found to MQTT is here https://www.hivemq.com/blog/mqtt-essentials-part-1-introducing-mqtt/

You would need to install a broker, most people tend to use mosquitto a quick google should find a step-by-step guide to how to install it.

3 Likes
#5

Hi Ole88

Once you have read the link UKMoose suggested......

This is a very basic flow you need.
There is a slight bit of extra stuff only because of how I have my MQTT set up.
It doesn't really matter that much.

You will need to install MQTT on one of the machines.
(I'd suggest the one used to receive the data)

Understand that the INJECT node is only to show things working.
That are on Machine 1
And the other two nodes are on Machine 2

There is a "link" between the two MQTT nodes (kind of) and so what one sends, the other receives.
It is a bit more complicated than that, but for the sake of getting things up and running, I hope it will suffice.

You will have to set up MQTT on one of the machines as the "main machine".
Not that difficult.

Past this onto a blank flow area, then cut/paste which ever part to the respective machine.
Machine 1 sends the temperature and machine 2 receives it.

(Maybe at first put it all on Machine 1 and just see it working, then add the node to do the temperature and see that working, then copy the Machine 2 part to the other machine. You can leave the nodes for "machine 2" on machine 1.)

So, and overview:
The inject creates a timestamp (which changes, so you can see it is "getting through" the system) and that is displayed on Machine 2 in the debug node.

You replace the "timestamp" node with the node sending temperature data. Though you will probably only need to put the node which creates the temperature data between the inject and MQTT node.
The inject node will be used to trigger the temperature node to generate and send the temp'.
You edit how fast it does this by double clicking on the inject node and changing the repeat value.

Then, on machine 2:
You add what ever it is you want to display the data received.

I hope that helps.

[{"id":"28e006d7.95f13a","type":"inject","z":"baf80d2f.6bd538","name":"","topic":"","payload":"","payloadType":"date","repeat":"10","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":2640,"wires":[["5e31c048.7bc038","fc9a8b5c.e87ad"]]},{"id":"60de4e20.ef5448","type":"mqtt in","z":"baf80d2f.6bd538","name":"","topic":"Temperature","qos":"2","broker":"6ccf853d.6f8004","x":450,"y":2740,"wires":[["b0bccf1b.80ec48"]]},{"id":"b0bccf1b.80ec48","type":"debug","z":"baf80d2f.6bd538","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":630,"y":2740,"wires":[]},{"id":"5e31c048.7bc038","type":"mqtt out","z":"baf80d2f.6bd538","name":"","topic":"Temperature","qos":"","retain":"","broker":"8a2e80be.f7c928","x":440,"y":2640,"wires":[]},{"id":"2484a7d7.9e12d","type":"comment","z":"baf80d2f.6bd538","name":"Machine 1","info":"","x":330,"y":2560,"wires":[]},{"id":"fe1319f.aca1ce8","type":"comment","z":"baf80d2f.6bd538","name":"Machine 2","info":"","x":540,"y":2690,"wires":[]},{"id":"fc9a8b5c.e87ad","type":"debug","z":"baf80d2f.6bd538","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":440,"y":2600,"wires":[]},{"id":"6ccf853d.6f8004","type":"mqtt-broker","z":"","name":"192.168.0.99:1883","broker":"TimePi","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"8a2e80be.f7c928","type":"mqtt-broker","z":"","name":"MQTT host","broker":"192.168.0.99","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"ARDUINO_STATUS","birthQos":"2","birthPayload":"connected","willTopic":"ARDUINO_STATUS","willQos":"2","willPayload":"disconnected"}]```
#6

Thank you.

I made it installing mosquitto on one raspberry and mqtt input and mqtt output from each raspberry pi. Setting server ip and ports.

2 Likes
#7

Good to hear you got it all working.

:slight_smile: