Read multiple DS18B20 at high rate with Node Red on Pi 4

I'm wanting to shift from monitoring & controlling a geothermal system with an Arduino to directly with a Pi 4 running Node Red. Currently I'm reading several DS18B20 temperature sensors with my Arduino about every 15 seconds to generate fast response graphs. The last time I played with reading them on a Pi I found out it was much slower. Have there been any updates or alternative nodes to speed up the temperature refresh rate? I can settle for something slower but IIRC it was much slower, in the neighborhood of minutes instead of seconds.

What have you tried on the Pi? I have 2 DS18B20's that I can read a lot quicker than 15 seconds.

As Garry says, you should be able to read each sensor in a few seconds. What node were you using to read them? node-red-contrib-something possibly.

Not sure why you would want to do that since the Arduino is far better suited to the task than the Pi is. AFAIK, the Pi GPIO is hard to deal with except from C/C++ based code and then you have to interface that to your higher-level code (Python or Node-RED) via Linux which isn't well suited for real-time operations. Also, the GPIO on the Pi isn't buffered and it is easy to blow the Pi with some poor wiring.

The Arduino, on the other hand, is specifically designed for real-time use and cack-handed wiring and has all of the interface libraries you could wish for and presents a high-speed serial interface that is easy to use with Node-RED.

1 Like

Sounds like I'll have to dig into it again and see what I can figure out.

The problem with my standalone Arduino setup is that it's connect back to my server via mqtt across a couple wireless links and it frequently losses connection. Arduino then reboots itself in hope that the connection restores but that doesn't always fix the problem so in the meantime it's not reporting temperatures & status. I had some success with a Johnny Five setup but it was quite fiddly to get the serial port access working so I'd like to switch to a local rPi only setup and use node red for the automation.

You can read pretty fast with a Pi and do lots of data processing at the same time. If you use 12-bit resolution on DS18B20, you should be able to read at 1s speed reliably with Pi according to the data sheet of DS18B20.

You need to make sure that you are using the 1-wire interface of Pi, which is typically pin 7 (GPIO 4). You may check out this guide on how to set up the 1-wire interface:

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