I'm planning a project that requires me to have around a dozen temperature and humidity sensors placed around the house and the yard. These would connect to a central Arduino in the house that would log the data and send it to a database elsewhere.

I have browsed the internet for solutions that work for long cable runs. For temperature sensors I found 1-Wire, especially DS18B20 sensors. However, there doesn't seem to exist humidity and pressure sensors that utilize 1-Wire.

What is the easiest way to accomplish such network of sensors? RS485 seems to do great even with long cables (my longest run will be less than 50 meters, most in the 5-10 m range) but as far as I know it would require a microcontroller in each end, which would add complexity.

  • 1
    \$\begingroup\$ For long cables you'll find that current signals are often used as these do not degrade with distance. 4-20ma Current Loops are the standard for many industrial processes. For 5-10m you can utilize I2C sensors if you slow down the data rate and use buffers in the line. See the Master I2C library \$\endgroup\$ – Rohan Jun 21 '16 at 13:04
  • \$\begingroup\$ That "1 wire" is just marketing terminology in my opinion, in practice you need 3 connections, 2 for supply, 1 for data. You could modulate the data on the supply but that complicates the circuits you need. Same for RS485, it complicates things. \$\endgroup\$ – Bimpelrekkie Jun 21 '16 at 13:04
  • \$\begingroup\$ Is wireless off the table? \$\endgroup\$ – vicatcu Jun 21 '16 at 13:12
  • \$\begingroup\$ At slow data rates (300-1200 baud) you can go immense distances with 0/5V signalling over not much more than wet string. For extra points you can use 2 wire twisted pair with DC feed on the pair and a diode to a capacitor at the far end, and then signal over the pair for small percentages of the time with the far end capacitor maintaining voltage. | Take 50 metres of twisted pair, apply a 5V square wave, add a light load at the far end and observe. Over that distance you'll typically have under 10 Ohms loop resistance and probably not over 5 to 10 nF capacitance.... \$\endgroup\$ – Russell McMahon Jun 21 '16 at 17:33
  • \$\begingroup\$ ... At 1200 baud attenuation is liable to be minimal. With say 10 Ohms loop resistance if your sensor draws 20 mA the voltage drop is V = IR = 0.02 x 10 = 0.2V. \$\endgroup\$ – Russell McMahon Jun 21 '16 at 17:35

If you must use a wired option, then it sounds like you have lengthy cable lengths and you'll need to design for both a long-distance communication and long-distance DC power.

For wired communications, RS-485 as you mentioned is not bad and can be driven by a UART, which is easy in software. CAN is also a good candidate and brings some more benefits if you are willing to do more software (or not, depending on what code you can find off the shelf). I would avoid SPI or I2C - these are meant to be on a board and not travel such long distances.

For both RS-485 and CAN, it would be best if you could get your hands on twisted pair cable, and it would be a bonus if you could find a composite cable with a twisted pair and a DC power pair. Although, for home/hobby use, it would probably still work well enough if you didn't have twisted pair on the data lines.

For DC power, you will need to design for a voltage drop and also some protection for ESD, lightning-induced effects (you have a long antenna there) and also shorted conductors in case your cable gets damaged.

If wireless is in play, then a Zigbee network is the way to go. Digi's XBEE would be an excellent start. However, you'd need to power your remotes separately or with batteries, which can be done but is another design step. The XBEE network could be managed directly by your database PC via USB, thereby skipping the Arduino part.

  • \$\begingroup\$ RS-485 is really needed for moderate speeds over long distances. A dosen of humidity/temperature sensors won't generate any significant data to justify its use. \$\endgroup\$ – Dmitry Grigoryev Jun 21 '16 at 16:15

For signals in 5-10 meters range I would definitely try simple UART at low baud rates: if the voltage drop in the wires is not too big, it will simply work. For longer connections which do exhibit voltage drop, I would try RS-232 drivers for UART: these are cheaper than RS-486 and work well for distances up to 300 meters at low speeds.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.