As already mentioned in another question, I'm spending LOT of time planning the home-automation system for my new house (currently still in the "still building" phase).

Even if started only as a "lights/switch management project", things started getting bigger and bigger and, at the moment, in addition to original requirements, I already have:

  1. A reed switch including cut-detection wires (for a total of 4 wires) installed on every single window (one switch for single-windows; two switches for dual-door windows);
  2. planned the location of a DHT22 sensor in each room.

In addition to the above, I'm currently evaluating the opportunity to add a single RGB led to have visual-feedback for each push-button (something like: GREEN=>LIGHT/OFF; RED=>LIGHT/ON). More specifically, I'm evaluating the opportunity to replace common/simple pushbuttons with these:

enter image description here

Obviously, such a change will heavily impact the cabling, as:

  • original simple/pushbutton required only two wires for each pushbutton, with one wire potentially shareable among adiacent pushbuttons (I'll be using "internal pullups", so one wire will be GND)

  • RGB pushbuttons require six wires (GND and SIGNAL for pushbutton; R, G and B plus COMMON for LED), with only two wires potentially shareable among adjacent pushbuttons (GND and COMMON).

Adding to this that it will be easy to have wall-boxes hosting two, three or even four pushbuttons, and you easily understand that LOTS of cables are required!

Here below I'm attaching a rough schema of what I'm planning to build, in terms of hardware:

enter image description here

where you can see:

  • ROOM 1, with:

    • 2 x reed switch (up to 8 wires);
    • 1 x DHT22 (3 wires);
    • a wall box with two pushbuttons/wLED (up to 12 wires);
    • a wall box with one pushbutton/wLED (up to 6 wires)
  • ROOM 2, with:

    • 1 x reed switch (4 wires);
    • 1 x DHT22 (3 wires)
    • a wall box with two pushbuttons/wLED (up to 12 wires)

Also, as for "controlling" the whole system:

  • two POWER-BOXES, located externally to rooms, where I originally planned to host the "controller" (a MEGA2560) together with needed Relay-modules, and interconnected via an RS-485 bus.

(BTW: actually, I'll have three POWER-BOXES, and not only TWO. But this is a detail, as for the spirit of this question).

Please note that POWER-BOXES (PB1 and PB2) will be located (...as for the original plan) quite FAR from some rooms: up to 10/15 meters, in the worst case scenario. Also, please note that each power-boxes are far up to 10/15 meters from each-others.

Before the real question, let me add another couple of important points:

  • Even tough I know that some kind of wireless system and/or wireless segment could simplify my overall architecture, I'm a strongly believer that a "wired" system is more reliable than a "wireless" one, expecially in the long-term. As such, as I'm lucky enough to put down lots of "pipes" (to properly distribute cables all around the house), I really prefer a wholly wired system;

  • As for this question, I'm not interested in the "software" side of the system. This is really an accessory (again, as for this very question). My really_big_problem relates to the "hardware" infrastructure to put in place. That's why I'm posting this question here.

After the all of this, here is the question:

As for your experience and knowledge:

  1. should I stick to original plan, having an RS-485 multidrop-bus interconnecting only the MEGAs, with "signal" cables going directly from room-hardware (pushbuttons, reeds, DHT22, etc.) to the MEGA PINs ....


  1. should I add some other Arduinos (a Micro seems a really good candidates) in each room, terminating all the signal-room-cables coming from room-hardware, and speaking with MEGAs via the same RS-485 bus?

In the first case, I'll have a real simple RS-485 bus with a mess of cables; In the second case I'll have a _longer_and_more_complex_ RS-485 bus, with a much manageable network cabling/infrastructure.

Am I right? What are the PROs and the CONSs of above two scenarios? Should I investigate other approaches?

Are there some documentation that can help me picking the right solution?

Thanks in advance to all of those who will spend some (precious) time helping me in this really difficult decision to take!

BTW: if you need further details, please don't hesitate to ask.

  • I'd put Ethernet shields and Arduinos in each room. Then when you need a more powerful Arduino (or even a Raspberry Pi) you simply connect it to the existing network. It's easier to maintain and expand when some years passes. And, of course, it's very likely you are already wiring the rooms with network wires.
    – fabrosell
    Commented Mar 18, 2016 at 14:28
  • IMHO wiring each button to the central unit (mega) is a real waste of cables, pins and money. Not to mention that that solution is not flexible at all: if you want to add something in some place you will need to pull another wire. IMHO the ideal setup (but I'm just a beginner, so I can be wrong) is having one microcontroller per box: you can use an arduino micro or a simple attiny if the box is really small. Then all these uC are connected through a fieldbus (can be the same RS485 which goes through all the house, can be a "room-wide" rs485, CAN, I2C, Serial, daisy-chain network, ...).
    – frarugi87
    Commented Mar 18, 2016 at 14:35
  • This way you can serially communicate with each box, each box can communicate with the main mega, and most important you will just need to pass a few cables, so extending the network is really easy.Personally I'd use RS485, since it's easier to use than CAN but it's strong enough (in fact, you can use the serial protocol over RS485 transceivers). I'd avoid a global ethernet connection, for both security and performance reasons (security because someone connecting to your net will also be able to see every message, performance because you can't connect an attiny to the ethernet without efforts)
    – frarugi87
    Commented Mar 18, 2016 at 14:35
  • @frarugi87 : thanks for commenting. As for "ethernet security", this should not be a big issue as in such a scenario I will surely rely on a dedicated VLAN. Anyway, the idea of having a fully distributed network, with Arduinos in every box, sounds interesting. I have to check how many nodes can be handled by the framework I'm planning to use. Commented Mar 18, 2016 at 14:47
  • 1
    @fabrosell : thanks for commenting. I spent some time, before beginning, investigating ethernet involvement. As the network, initially, looked much like a bus and considering that RS485 was both more cheap and more reliable (not needing an external switch) I'm currently oriented towards RS485. Obviously I'll have ethernet, around the home, but it will be used up to the main "gateway" (one, or probably two of the MEGAs), so to have the whole infrastructure easily accessible by a Raspberry/OrangePI, acting has a web-server/data-collector/etc. Anyway, I'll re-evaluate the ethernet option. Thanks. Commented Mar 18, 2016 at 14:56

2 Answers 2

  1. short wires are generally better than long ones
  2. I agree, that wired is better in your situation
  3. Maybe you distinguish between two different areas: sensor/actor to controller and controller to controller communication
  4. In many cases you can not chose the sensor/actor to controller communication, because it is given by the device (DHT-22, reed, led push button etc.). Therefore, keep these lines short
  5. RS-485 is good, but is it necessary? It adds drivers to each device. Maybe, I2C could do it,to. You can still use twisted pair cables.
  • Thanks for commenting. The very first problem I faced was the decide "how" and "with which protocol" interconnect my Arduinos. As: 1) the distance between them was quite large (20 meters or even more); 2) I need to handle "noise", during transmission, as best as possible; 3) the bandwidth required by the whole system is relatively low; I ended up with RS-485 in multidrop configuration (like the one described here. Have you been able to test I2C under similar conditions? Commented Mar 20, 2016 at 9:31
  • As for RS-485, Nick Gammon in his excellent answer made several really useful tests about cable lenghts, communication speeds and collision/detection/avoidance approaches. Based to them, I ended up deciding that RS-485 was really suited to my needs. Don't you? Commented Mar 20, 2016 at 9:40
  • As for "short wires are generally better than long ones", such an approach would take me in having an ad-hoc Arduino in every wall-box (this wall-box). I wonder if I'll be able to fit everything inside such boxes (1 x Nano 3.0; 1 x MAX485; up to 3 push-buttons; cabling) and/or if I'll need to design a proper PCB to optimize everything. What's your opinion? Commented Mar 20, 2016 at 10:00
  • As for two different kinds of networks: "sensor/actor <=> controller" and "controller <=> controller" this is absolutely reasonable and I'm actually investigating this as I've 3 serials on each MEGA so I can definitely have a "secondary network branch" from each MEGA towards the "local" boxes. Also, the software-framework I'm currently evaluating/experiencing, souliss, should play nicely with such an architecture. Commented Mar 20, 2016 at 10:11

Here my additional thoughts in short:

  1. 20 meters is, compared with the distance to the moon, quite short ;-). Maximum length of RS-485 is reported to be kilometers with small transmission rates (google: rs485 cable length).

  2. Noise can either be avoided (hardware) or corrected by software (fault tolerant codes, checksums etc.) Generally, software is cheaper.

  3. Short wires does not mean no wires at all. Short wires would e.g. result if you have a controller per room and connect the sensors to it.

  4. There are also small packages of Arduino compatible chips available (ATTiny84/85). And without RS485 you save the space of the controllers...

  5. I2C bus length should work inside a house, if yous is not bigger than the one of Bill Gates... http://www.esacademy.com/en/library/technical-articles-and-documents/miscellaneous/i2c-bus/frequently-asked-questions/i2c-faq.html

  6. I would not use serial for communication. It is not extensible. Serial is ok for debugging.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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