Go Down

Topic: remote sensors - wich (wired) connection is better? (Read 9984 times) previous topic - next topic


Apr 05, 2013, 12:39 pm Last Edit: Apr 05, 2013, 01:54 pm by sotomaior Reason: 1
Hi evrybody,

im a newbie so please forgive me for any mistake/missing info/wrong topic etc, ill do my best.

My aim is the following:

I want to build a DOMOTIC system based on a RASPBERRY PI (php server for interfacing all commands, i.e. close window, switch off lights etc) linket through UART to a ARDUINO MEGA (master, other arduinos will be connected later on but this is not the actual problem) with a GSM SHIELD (so that i can command all stuff also by means of a mobile phone)

in practice:

intenternet (router)-ETHERNET-raspberry-UART-mega-??????-all actuators and sensors and maybe some slaves

The problem is related to the connections between the mega and all sensors and actuators, potentially far tens of meters.

Due to the fact that the hause i would like to "domotize" is not totally built yet, i wanted to use as many wires as possible because im a little afraid of wireless systems: a twisted wire is working/not working and so it will be "forever" and also because im free to place as many "wire pipes" as i wish.

Here comes the problem: i cannot connect anything by means of simple wires farther then 50cm-1m.

The possible solution i analyzed:

-signal repeaters along the wire=>expensive, unefficient (pw dissipated), hard to implement (inside pipes i should place thousand of those)
-wirelessy sonnected remoted arduinos (xbee-like)=>expensive (one arduno+xbee evry group of I/O), unefficient & i like wires :)
-wirelessy connected remoted sensors=>a little cheaper, unefficient (lots of power supplys), a mess to implement (70-80 wireless I/O?) & again i like wires :)

Any suggestion?
Have anybody tried something similar?

P.S. sono italiano, scrivo in inglese perchè oramai sono abituato a cercare e chiedere così, ma una risposta è ovviamente la benvenuta in qualunque lingua sia, se volete una traduzione in ITA non avete che a chiedere :)


Apr 05, 2013, 02:15 pm Last Edit: Apr 05, 2013, 02:17 pm by Erdin Reason: 1
If you use ethernet cable, cat5 or cat6, you can use RS485 signals.
The ethernet cable can also be used for some power (not too much).
If you use 12V .. 30V as power, and use DC/DC converters for each Arduino, the total current is limited.
I would use Arduino boards as remote I/O at the end of the cables.

internet (router) - ETHERNET - raspberry - UART - mega - RS485 - Arduino - remote actuators and sensors

If there are many power cables next to the ethernet cable, or the cable is very long, I would add optocouplers. That will prevent any grounding problems.


thank you for my first answer!

the problem is that i need to install switches (for light driving) pretty much "far from evrithing", and i would like to avoid using one adruino only for one button, if i understend correctly your answer


You wouldn't be using an "arduino" per se, you would be using an atmel chip at each light.  This would be a barebones type board.  An ATTINY 45/85 or 44/84 is perfect for this sort of thing.


You wouldn't be using an "arduino" per se, you would be using an atmel chip at each light.  This would be a barebones type board.  An ATTINY 45/85 or 44/84 is perfect for this sort of thing.

sorry, i cannot get it. (too newbie maybe)

Do you mean to use an ATTINY plugged into some sort of "ethernet shield"?

because that would require tens of "input" ethernet ports, i think


Suggested RS485 protocol is very good decision, you will need on distance places some Tiny Arduino like Board if you prefare Arduino, also You may use 1-Wire combination by MAXIM-Dallas . They have various range of IC-s .

I use both, and i am satisfied of they performance.



What you could do is use some of these:
Each censor would have one of these radios with something like an attiny to handle the rf protocol. There would be one arduino connected to your PI to receive all the signals.


You don't need to have another arduino at the other end of your wires. The "RS485" part that is important is only the physical layer. You do not need the datalink layer.

Your hint was in using twisted wire. Twisted wire is used for differential signaling. So, all you need to do is convert your single-ended signaling (what you have now) into differential and then back to single-ended again. There are numerous drivers out there that do this. They are refered to as "Line Drivers" what would make one line driver RS485 and another RS422 is simply the voltages that are used. Any manchester encoding, protocoling, and all that other jazz is completely up to controller. All the line driver cares about is taking your single ended signal and converting it to a differential.



So, all you need to do is convert your single-ended signaling (what you have now) into differential and then back to single-ended again. +

do you think i need to do arduino->"rs485 encoder"->WIRE->"rs485 decoder"->switch->"rs485 encoder"->WIRE->"rs485 decoder"->arduino

or it is enough to do arduino->"rs485 encoder"->WIRE->switch->WIRE->"rs485 decoder"->arduino

can you please suggest me any connection drawing, so that i can better recongnize what you meant?

i also found this topic http://arduino.cc/forum/index.php?topic=19254.0 but it doesent seem to have a "general long wire" solution


Let's switch that around... what would be the ideal way for your you to hook things up? Meaning, how would YOU like them hooked up? And we will go from there.


thank you for your kind answer  :)

the best thing would be to find a way to amplify/encode the 5v signal close to the arduinos (so that i dont need to bring any extra power supply outside the "control box" where transformers, relays, controllers, pi and shields are settled), send them to any switch/sensor and then back into the "control box".

The idea was:

-PI, SHIELDS and ARDUINOS that drives all RELAYS that move the power that is "generated" from the TRANSFORMERS <--- all inside the "control box"

-signals wires from/toward the controllers to the sensors and switches

-"power wires" from the relays to any actuator (i.e. lights, window actuators and so on)

if i am not clear enaugh ill provide any drawing  :)


RS485 is a way to go along with Cat5 or Cat6 cables. Since your house has not been completed yet, it is much better to put in as much high quality cable as possible inside walls.

Also if total distance is not that much, you can also transmit 24V power over Cat5/Cat6 cable so that your switch or other remote devices does not have to be powered separately. Of course, do not transmit line power over it.

disclaimer: I am saying this because I have RS485 shield like that for sale so I am biased.


it seems to be a good idea, but my (ignorant) questions are:

-how do i connect any switch/sensor through a "ethernet" cable? may I send up to 7 signals? only digital ones are allowed?
-can i program my controller with the shield connected as if any inner wire is a "pin"?
-how many shields may i use for each arduino? may i leave the serial pins for other applications?

to be more specific about the sensors i will place:

-"rain" sensors http://cgi.ebay.it/ws/eBayISAPI.dll?VISuperSize&item=121067055196
-"hall" sensors http://cgi.ebay.it/ws/eBayISAPI.dll?VISuperSize&item=270984792461
-"light" sensors http://cgi.ebay.it/ws/eBayISAPI.dll?VISuperSize&item=271083725046
-some -not well defined- "ir/movement" sensors
-switches (normal or capacitive)
-temperature/humidity/pressure sensors

these are not the final choice obviously, and if required i can "cut" the analog ones and turn them into digital, i posted links only as "suggestions"

sorry for all those questions but it is hard for me to imagine this "connection"  :)

P.S. i dont think im going any farther then 50 m (probably 30m are enaugh)



RS485 Cable spec;-
Shielded: Yes
Impedance: 100-130 ohms
Distributed capacitance: <100 pF/m
Wire: AWG 18

Cat 5/6 Cable spec;-
Shielded:STP, ScTP, UTP
Impedance: 85-115 ohms
Distributed capacitance: <= 52 pf/m
Wire: 24-26 AWG/Cat5, 22-24 AWG/Cat6

2 catches for using Cat 5/6 Cable sub RS485 Cable;-

1. Impedance, It could be fine tune the transceiver resistor to keep match.
2. Only  STP Shielded  cable is compatible, order that type cable only.

Go Up