Electronic – arduino – Use network cable internal wires for Arduino project connections

arduinowiring

I am new to Arduino and Raspberry Pi, and I have no eletronics knowledge outside of this. I have a good programming background.

I just learned how to solder (basic), got my LCD working, my rain sensor, external temperature sensor, barometric sensor and camera working. They are connected and logging data.

Now I want to put this thing outside. I'll need long wires for my rain sensor and temperature sensor. Can I dismantle a network cable (Furukawa Cat 6) and use the pairs inside?

I'll need two wires for the rain sensor and three for the temperature sensor. One network cable has more than enough pairs, so I'll just need to pass one cable.

I plan to dismantle both ends and solder.

Is this okay? What is the maximum distance?

The distance would be about 20 meters.

The protocols and interface – I don't know, but I'll look into the datasheets. The barometric pressure sensor is Bmp180, the temperature sensor is the DS18B20 and the rain sensor is the YL-83.

Best Answer

Ok, so you have:

  • BMP180 = I2C
  • DS18B20 = 1-Wire
  • YL-83 = Analogue Voltage

Over 20m, all of these are tricky (though not impossible)

  • I2C is designed for short interconnects (inter-intergrated circuit!) not long runs. It is especially problematic over twisted pair as the crosstalk between lines will completely kill it. There is a method called dI2C or differential I2C, using the PCA9615 chip, but that is only rated for about 3 metres.

  • Analogue will be terrible unless you buffer it (and probably even if you do) - voltage drop across the wire from any load imparted by the ADC, and more crucially noise caused by crosstalk with the digital lines amongst other things.

  • 1-wire has similar limitations of I2C. Though having re-familiarised myself with the specification, this may be the only one of the three which would could reliably interface over 20 metres as long as you are careful with crosstalk and noise. As per this Maxim application note, 1-wire should be possible (thanks @Passerby for point that out) over that length with some care.

My suggestion then would be to add an MCU at the end of the cable to interface with all of the sensors. Something like the ATTiny85 would be quite compact being only an 8-pin package, but you would have to look at how many I/O pins are required. You would need at least 4-pins for your inputs (1 is an ADC, 2 for the I2C interface, and 1 for the 1-wire bus). But then you would also need an interface through the cable. The ATTiny85 has only 6 I/O pins, so you would have 2 left to interface with the other end of the cable.

I would suggest something like RS-485 to do this as it is designed to be a differential I/O standard and should work fine with a CAT6 cable - you would have to make termination \$100\Omega\$ otherwise signal reflections would be quite problematic. In this setup you would have half-duplex communication. You would have two (maybe more) options for doing this:

  1. Implement RS-485 directly using the 2 free I/O pins of the MCU - this should be do-able from an electrical standpoint, and is not that difficult to implement in software. Plus it means you don't need an external driver.

  2. Use a driver chip such as the MAX481. You would tie the DE and !RE pins together and to one I/O pin (transmit/receive mode select), and tie the DI/RO pins together to the other free I/O pin which would be a bidirectional data-in/data-out line.

For both options you could for example sit in receive mode until instructed to transmit by a master at the other end of the cable. At which point you collect and send information about the sensor values. Once you send the response, you switch back into RX mode and await further instructions by the master.


In any case if you combine the sensors together you would only have one interface. Given that there is not high volumes of data here, reducing the transfer speed would help over this distance - you could for example use dI2C or 1-wire to interface the MCU over the cable as long as you run the bus slowly (10kHz maybe) to allow signals to propagate and settle.