Electronic – 1-wire verses CAN-bus for home sensing network

canhome-automationsensor

I'm trying to put together a home automation solution for my newly built house. I'm very new to this, specifically for hardware matters and asking this question to verify if my understanding of what I've learnt from internet is more of less correct and an advice on how to move on.

I have decided that I will separate the whole thing into three "layers" – sensing, alarming and control. The question is regarding the first one. I put sensors on my floor plan and it counts 60 environmental sensors (temp, humidity, light, movement, moisture) and 40 security ones (smoke, movement, gas, distance, vibration, magnetic contact).

There are two general options I have figured – 1-wire and CAN-bus. 1-wire is relatively simple and there is lots of information on this on the internet and many projects to learn from. But since all the sensors are passive it looks like 1-wire is good for collecting data from temperature, humidity and alike sensors. But doesn't quite well work for light and movement sensors for instance – if you want to know if there is movement right at the time, you'd have to "question" those sensors pretty much as frequent as you can generating a lot of garbage traffic. 1-wire is relatively cheap, too, and requires very little soldering – just making sure 3 wires are wired correctly, even a kid can do this.

CAN-bus seems to contain more possibilities but is as well harder to understand and it's not easy to find sample home automation projects that will explain everything in enough detail. But if I understand it right, since you are able to have a main device and child boards connected to it, the sensors on the child board can be active and trigger signals to other members of the network without involving the main controller device.

If CAN-bus is a good way to go, can someone point me to affordable devices in the field? Like boards that you can connect sensors to and so on?

Here are two pics of topology layout for CAN/1wire – am I getting it right?

1-wire layout
CAN layout

Best Answer

1-wire is not a good idea for distances like accross a house. It is inherently single-ended and relatively high impedacne, so quite susceptible to noise. Everything might work fine until the water pump in your furnace kicks in, or you run a particular blender with a failed line filter, etc, etc.

I think CAN makes the most sense. The normal electrical interface for CAN, such as implemented by a MCP2551 and many other chips, is differential. This makes it quite good at noise immunity, certainly much better than 1-wire. At the distance of a normal house, you should be able to run the CAN bus at 500 kHz. That's also way faster than what 1-wire can do, although data rate is probably not a major issue if this network is limited to a few dozen sensors.

The end devices will basically require a micrcontroller each. However, those are small and cheap and low power nowadays. Instead of using bare sensors that talk directly over a 1-wire bus, you have a microcontroller that receives the raw sensor signal. The micro then sends the sensor data on over the CAN bus as defined by your protocol.

One advantage of using micros at each device is that you have much greater flexibility in chosing sensors. You are not limited by the small subset of sensors that have native 1-wire capability. Micros can read the voltage of analog signals, talk IIC, SPI, measure pulse widths, etc. If you have a micro, you can easily make your own sensor. It just needs to put out a voltage and the micro can do whatever interpretation is necessary. For example, making a light sensor would be as simple as tying a CdS cell and a resistor to a A/D input of the micro.

I would put the CAN lines, power, and ground all in one cable. Let that be your "bus". CAT5 cable would be fine for this because it is relatively cheap and readily available. Use one of the four twisted pairs for the CAN lines, and the other three for power/ground. One line of each of these pairs would be power and the other ground, for a total of 3 power wires and 3 ground wires. Get one good efficient DC power supply and have it drive the power for the whole CAN network. I'd probably use 24V DC for the power on the cable. Each device includes a small buck converter to make 5V and/or 3.3V to run the micro, sensors, and whatever other circuitry you might want on a node. Put the power supply near the middle of the bus to minimize the maximum distance from power to any node, and to minimize the maximum power current on any part of the cable.