# Fastest OneWire (ds18b20) update rate on Raspberry Pi

**URL:** <https://discourse.nodered.org/t/fastest-onewire-ds18b20-update-rate-on-raspberry-pi/16520>\
**Category:** General\
**Created:** [9 October 2019 21:20 UTC](https://discourse.nodered.org/t/fastest-onewire-ds18b20-update-rate-on-raspberry-pi/16520 "2019-10-09T21:20:21Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![meeki007](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/meeki007/32/12499_2.png) [@meeki007](https://discourse.nodered.org/u/meeki007)\
**Post date:** [12 October 2019 03:00 UTC](https://discourse.nodered.org/t/fastest-onewire-ds18b20-update-rate-on-raspberry-pi/16520/10 "2019-10-12T03:00:42Z")

</div>

@m_elias

I too have a ton of DS18B20's and was floored by how long it took to get data back down the line using [contrib-ds18b20-sensor](https://flows.nodered.org/node/node-red-contrib-ds18b20-sensor)  
So I started diggin how is polling the sensors on a 1 wire can geting so congested

If you look at the contrib-ds18b20-sensor code [ds18b20 github](https://github.com/bpmurray/node-red-contrib-ds18b20-sensor/blob/master/ds18b20-node/ds18b20-node.js). You will notice that its polling information from all the sensors then checking an array for the matching ID you entered into the node.

**So if you have 10 sensors its polling 10 times! 10 sensors** Its not using the match rom commands found in the 1-wire documentation. [DS18B20.pdf](https://cdn-shop.adafruit.com/datasheets/DS18B20.pdf)

My solution was to poll once and sort the data myself. I've had 14 sensors talking fine!

Here is my flow I'm using for one 100 yard lane of the company freezer ( oh there are more lanes 😊 )

 ![sensors](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/3/33bf4653f84f9ab6703274cac808e34692f0c5d6.png)

```auto
[{"id":"6a6c83b8.bb185c","type":"inject","z":"e1935875.a74068","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":120,"y":80,"wires":[["13ef1dd3.a2cf62"]]},{"id":"604ddc78.fab204","type":"comment","z":"e1935875.a74068","name":"TESTING: Output all temp sensors connected into an array. To figure out sensor ID's","info":"","x":310,"y":40,"wires":[]},{"id":"13ef1dd3.a2cf62","type":"rpi-ds18b20","z":"e1935875.a74068","topic":"","array":false,"name":"","x":310,"y":80,"wires":[["1f01bf2a.2f3b71"]]},{"id":"1f01bf2a.2f3b71","type":"debug","z":"e1935875.a74068","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":510,"y":80,"wires":[]},{"id":"d2bb6889.0e9c88","type":"comment","z":"e1935875.a74068","name":"Body: Tempature Probes","info":"diagram of map link here ","x":130,"y":140,"wires":[]},{"id":"78b46331.d9ff7c","type":"comment","z":"e1935875.a74068","name":"Freezer_400_East_U","info":"","x":240,"y":240,"wires":[]},{"id":"796619bd.d06898","type":"comment","z":"e1935875.a74068","name":"edit when changing sensor","info":"","x":750,"y":180,"wires":[]},{"id":"b656262f.9f4ee8","type":"comment","z":"e1935875.a74068","name":"TmpSen-Checks ----->","info":"","x":1200,"y":260,"wires":[]},{"id":"1a32f115.43a18f","type":"change","z":"e1935875.a74068","name":"format topic to mqtt header","rules":[{"t":"set","p":"topic","pt":"msg","to":"Sun/SunValley/TempSensor/Freezer_400_East_U","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":740,"y":240,"wires":[["a9f385f1.3e9de8","69e008c7.5e0bd8"]]},{"id":"a9f385f1.3e9de8","type":"debug","z":"e1935875.a74068","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":1170,"y":600,"wires":[]},{"id":"69e008c7.5e0bd8","type":"link out","z":"e1935875.a74068","name":"TmpSen-RX OUT","links":["7b1ba438.5b19ec","7410bd02.e9f9b4"],"x":1075,"y":260,"wires":[]},{"id":"4a0ae719.de3f58","type":"inject","z":"e1935875.a74068","name":"30sec","topic":"","payload":"","payloadType":"date","repeat":"30","crontab":"","once":true,"onceDelay":"","x":120,"y":180,"wires":[["a780bcc.d212b4"]]},{"id":"1abb841e.5a146c","type":"switch","z":"e1935875.a74068","name":"If = FFB001A31704","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"FFB001A31704","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":470,"y":240,"wires":[["1a32f115.43a18f"],["b619ce5b.8681a"]]},{"id":"a780bcc.d212b4","type":"rpi-ds18b20","z":"e1935875.a74068","topic":"","array":false,"name":"","x":310,"y":180,"wires":[["1abb841e.5a146c"]]},{"id":"4a878a7f.f420b4","type":"comment","z":"e1935875.a74068","name":"Freezer_400_East_L","info":"","x":240,"y":280,"wires":[]},{"id":"b619ce5b.8681a","type":"switch","z":"e1935875.a74068","name":"If = FFAA33401802","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"FFAA33401802","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":470,"y":280,"wires":[["d0e0c004.6fd2a"],["3e0ebc54.8d7ee4"]]},{"id":"d0e0c004.6fd2a","type":"change","z":"e1935875.a74068","name":"format topic to mqtt header","rules":[{"t":"set","p":"topic","pt":"msg","to":"Sun/SunValley/TempSensor/Freezer_400_East_L","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":740,"y":280,"wires":[["a9f385f1.3e9de8","69e008c7.5e0bd8"]]},{"id":"98d18d4e.df1cd","type":"comment","z":"e1935875.a74068","name":"Freezer_400_Center_U","info":"","x":240,"y":320,"wires":[]},{"id":"3e0ebc54.8d7ee4","type":"switch","z":"e1935875.a74068","name":"If = FFAA0F411801","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"FFAA0F411801","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":470,"y":320,"wires":[["12701796.dd9258"],["8dc831b7.4b3a5"]]},{"id":"12701796.dd9258","type":"change","z":"e1935875.a74068","name":"format topic to mqtt header","rules":[{"t":"set","p":"topic","pt":"msg","to":"Sun/SunValley/TempSensor/Freezer_400_Center_U","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":740,"y":320,"wires":[["a9f385f1.3e9de8","69e008c7.5e0bd8"]]},{"id":"54ce9ea5.13a41","type":"comment","z":"e1935875.a74068","name":"Freezer_400_West_U","info":"","x":240,"y":360,"wires":[]},{"id":"8dc831b7.4b3a5","type":"switch","z":"e1935875.a74068","name":"If = FF8710411801","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"FF8710411801","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":470,"y":360,"wires":[["9c0c8a20.b71128"],["c9cc70a.b54399"]]},{"id":"9c0c8a20.b71128","type":"change","z":"e1935875.a74068","name":"format topic to mqtt header","rules":[{"t":"set","p":"topic","pt":"msg","to":"Sun/SunValley/TempSensor/Freezer_400_West_U","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":740,"y":360,"wires":[["a9f385f1.3e9de8","69e008c7.5e0bd8"]]},{"id":"f8eb4ab0.77f5e8","type":"comment","z":"e1935875.a74068","name":"Freezer_400_West_L","info":"","x":240,"y":400,"wires":[]},{"id":"c9cc70a.b54399","type":"switch","z":"e1935875.a74068","name":"If = FF790B411801","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"FF790B411801","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":470,"y":400,"wires":[["9c20d488.d080b8"],["a738605e.324f3"]]},{"id":"9c20d488.d080b8","type":"change","z":"e1935875.a74068","name":"format topic to mqtt header","rules":[{"t":"set","p":"topic","pt":"msg","to":"Sun/SunValley/TempSensor/Freezer_400_West_L","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":740,"y":400,"wires":[["a9f385f1.3e9de8","69e008c7.5e0bd8"]]},{"id":"a9b72790.2912e8","type":"comment","z":"e1935875.a74068","name":"Freezer_400_Evaporator_West_Coil","info":"","x":200,"y":440,"wires":[]},{"id":"a738605e.324f3","type":"switch","z":"e1935875.a74068","name":"If = FF2233401802","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"FF2233401802","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":470,"y":440,"wires":[["8ccbe599.592bb8"],["1f08a207.0316be"]]},{"id":"8ccbe599.592bb8","type":"change","z":"e1935875.a74068","name":"format topic to mqtt header","rules":[{"t":"set","p":"topic","pt":"msg","to":"Sun/SunValley/TempSensor/Freezer_400_Evaporator_West_Coil","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":740,"y":440,"wires":[["a9f385f1.3e9de8","69e008c7.5e0bd8"]]},{"id":"fdabded6.4baed","type":"comment","z":"e1935875.a74068","name":"Freezer_400_Evaporator_West_Intake","info":"","x":190,"y":480,"wires":[]},{"id":"7024c4f.2a0f93c","type":"comment","z":"e1935875.a74068","name":"Freezer_400_Evaporator_West_Exhaust","info":"","x":180,"y":520,"wires":[]},{"id":"f2757e0e.8448e","type":"comment","z":"e1935875.a74068","name":"Freezer_400_Evaporator_East_Coil","info":"","x":200,"y":560,"wires":[]},{"id":"adf5687a.72fbe8","type":"comment","z":"e1935875.a74068","name":"Freezer_400_Evaporator_East_Intake","info":"","x":190,"y":600,"wires":[]},{"id":"1f08a207.0316be","type":"switch","z":"e1935875.a74068","name":"If = FF370F411801","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"FF370F411801","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":470,"y":480,"wires":[["7dd0da09.27a764"],["83e81070.5a8b6"]]},{"id":"7dd0da09.27a764","type":"change","z":"e1935875.a74068","name":"format topic to mqtt header","rules":[{"t":"set","p":"topic","pt":"msg","to":"Sun/SunValley/TempSensor/Freezer_400_Evaporator_West_Intake","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":740,"y":480,"wires":[["a9f385f1.3e9de8","69e008c7.5e0bd8"]]},{"id":"83e81070.5a8b6","type":"switch","z":"e1935875.a74068","name":"If = FF2BB7331801","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"FF2BB7331801","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":470,"y":520,"wires":[["28e8b5f8.d64a0a"],["1cba9c60.871ca4"]]},{"id":"28e8b5f8.d64a0a","type":"change","z":"e1935875.a74068","name":"format topic to mqtt header","rules":[{"t":"set","p":"topic","pt":"msg","to":"Sun/SunValley/TempSensor/Freezer_400_Evaporator_West_Exhaust","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":740,"y":520,"wires":[["a9f385f1.3e9de8","69e008c7.5e0bd8"]]},{"id":"1cba9c60.871ca4","type":"switch","z":"e1935875.a74068","name":"If = FF1304C11705","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"FF1304C11705","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":470,"y":560,"wires":[["6a9640cc.45f73"],["31d65f4.6ccd1a"]]},{"id":"6a9640cc.45f73","type":"change","z":"e1935875.a74068","name":"format topic to mqtt header","rules":[{"t":"set","p":"topic","pt":"msg","to":"Sun/SunValley/TempSensor/Freezer_400_Evaporator_East_Coil","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":740,"y":560,"wires":[["a9f385f1.3e9de8","69e008c7.5e0bd8"]]},{"id":"31d65f4.6ccd1a","type":"switch","z":"e1935875.a74068","name":"If = AAB7CA131302","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"AAB7CA131302","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":480,"y":600,"wires":[["87c3c26e.0d41f"],["3c110f1.3dd4cf"]]},{"id":"87c3c26e.0d41f","type":"change","z":"e1935875.a74068","name":"format topic to mqtt header","rules":[{"t":"set","p":"topic","pt":"msg","to":"Sun/SunValley/TempSensor/Freezer_400_Evaporator_East_Intake","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":740,"y":600,"wires":[["a9f385f1.3e9de8","69e008c7.5e0bd8"]]},{"id":"72ba34ec.a7fe5c","type":"comment","z":"e1935875.a74068","name":"Freezer_400_Evaporator_East_Exhaust","info":"","x":190,"y":640,"wires":[]},{"id":"3c110f1.3dd4cf","type":"switch","z":"e1935875.a74068","name":"If = FF13A3B31701","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"FF13A3B31701","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":470,"y":640,"wires":[["95291a0f.00d098"],[]]},{"id":"95291a0f.00d098","type":"change","z":"e1935875.a74068","name":"format topic to mqtt header","rules":[{"t":"set","p":"topic","pt":"msg","to":"Sun/SunValley/TempSensor/Freezer_400_Evaporator_East_Exhaust","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":740,"y":640,"wires":[["a9f385f1.3e9de8","69e008c7.5e0bd8"]]}]

```

Hope this gets you to 5 seconds. 15 is more realistic.

---

_[View the full topic](https://discourse.nodered.org/t/fastest-onewire-ds18b20-update-rate-on-raspberry-pi/16520)._
