Modbus Temperature Module with 18B20

Recently I was asked (by a friend of mine) about a temperature controller, to automate a solar water heating system. A system that is used in combination with a classic central heating system based on natural gas.

In short, it requires a temperature controller with two inputs:

  • first – temperature of water in solar panel(s)
  • second – temperature from hot water storage tank

And one output: a relay for recirculation pump that move (or not) water between solar panels and hot water storage tank.

I’ll come back with details, eventually with photos when the system will be fully functional. Right now is functional… without this automation. Which means that recirculation pump is switched on and off manually by the owner 🙂 . …Anyway this resulted in a considerable savings in money and carbon emissions, so everyone is happy.

It seems all so simple, with two temperature sensors and an Arduino (or similar) it should be ready in minutes or hours. But there’s a catch. There are always a catch. This time is about distance. The sensor for solar panels must be placed outside, on the roof at a distance of 15-20m from controller. And the length of the circuit (cable) will be even greater, around 35 meters.

From FAQS section of Maxim Integrated site:

“What is maximum distance over which the DS18B20 operates?

There is no stated maximum distance for connecting the DS18B20. The transmission range depends highly on the system’s environment and design. Instead of specifying a distance, the part is specified by logic level and timing thresholds. As long as the system can satisfy the timing and voltage considerations, it will work fine.”

Even though I heard about positive results at around 20-25 meters, seems it depends on the cable configuration, the pull-up resistor (must be lower than 4.7k) or other techniques to satisfy the timing and voltage (and noise) requirements:

If you have the curiosity to go through the above application notes, you will see that longer distances are possible. But this is not a competition “Who manages to connect a DS18B20 most distant?”

I think another approach would be much more feasible considering the given conditions. Besides the distance have to keep in mind the fact that the cable will be located outside. And outdoor cable (positioned on the roof) is subject to other challenges, in addition to the mechanical stress, electrical interference and temperatures between -25°C…+55°C (-13°F…131°F)

So even if we manage to have a stable 1-Wire link, if this link depends on some cable parameters and those parameters degrade over time or changes over the seasons, we may have unpleasant surprises.


It seems like a job for RS-485. Yes the old and humble RS-485. Ok it is old but it’s not humble. It uses current loop over a balanced line and that is perfect for this job. It has good immunity for noise on the signal lines and maximum 100 kbs at 1200m (35Mbs/12m). There are very good electrical specifications for both industrial applications and automation.


Since RS-485 standard only specifies electrical characteristics and not specify (or recommend) any communications protocol, I chose one of the easiest to implement protocols namely MODBUS.

At this point I will reveal the main reason for which I designed this module: It will be used as a template for for other modules. Modules that will be used in a bigger project for home automation. This project will have as its main communications protocol RS-485 / MODBUS (also will be published here…).


Download: RS485-Node-schematic.pdf



  • gEDA project: (*.sch and *.pcb)
  • Arduino code: very soon…
  • Hex file: very soon…
Updated: March 6, 2017 — 2:48 pm

Leave a Reply

Your email address will not be published. Required fields are marked *

OpenHardware.Ro © 2017 Frontier Theme