5
\$\begingroup\$

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

\$\endgroup\$
  • \$\begingroup\$ For relatively long connections, I would advise against 1-wire (some details here). CAN, RS-485, Ethernet would work. \$\endgroup\$ – Nick Alexeev Jan 6 '13 at 20:41
  • \$\begingroup\$ Yup, your two diagrams look correct. \$\endgroup\$ – Olin Lathrop Jan 6 '13 at 21:40
  • \$\begingroup\$ @abolotnov here's some CAN slave modules we built for a customer. networkio.wordpress.com/can-bus-devices I'm sure you can find similar or contract me. \$\endgroup\$ – kenny Jan 6 '13 at 23:04
8
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ Thank for great tips, can you point me to a sample device that I could use on the network for this? If I get this right, I will need one device to bridge my PC to the actual network (I have two raspberry pis at hand as was thinking one could act as "data recorder") and a few controllers that can connect the network to actual sensors? I've updated my original posting with a picture of CAN topology - am I getting it right? \$\endgroup\$ – abolotnov Jan 6 '13 at 21:31
  • 1
    \$\begingroup\$ @abolotnov: I know there are USB to CAN bridge devices out there. National Instruments would be a logical suspect, and there are probably others. For the end devices, there are lots of micros with CAN built in, like a number of PIC 18, PIC 33, PIC 30, etc. Most manufacturers have will have CAN support in some of their micros. \$\endgroup\$ – Olin Lathrop Jan 6 '13 at 21:36
  • 1
    \$\begingroup\$ @abolotnov I think it would be easier for you to use CAN rather than Ethernet. CAN requires only a simple transceiver like the MCP2551 which costs about a buck. Ethernet requires an RJ-45 jack along with an interface circuit (referred to as "magnetics" because it uses transformers), and these can cost from $5 to around $8. The CAN protocol would be easier to handle than Ethernet, which requires a full TCP/IP stack. \$\endgroup\$ – tcrosley Jan 7 '13 at 0:41
  • 1
    \$\begingroup\$ @abolotnov: CAN is considerably simpler than ethernet, and CAN implementations can take a lot less power than ethernet. A lot fewer micros have ethernet built in. Most only have a MAC and you still need a external PHY. If you use ethernet, you probably will want to use higher level protocols like TCP and UDP, which require significant firmware overhead. Nodes can be a $2 micro with maybe a $1 CAN transciever and quite simple electrically. A processor to run a net stack, MAC, PHY, and magnetics will be rather more costly and complicated, both in firmware and in hardware. \$\endgroup\$ – Olin Lathrop Jan 7 '13 at 1:19
  • 1
    \$\begingroup\$ @abolotnov, to add to tcrosley's answer, a DIP package can be simply pushed-in into a breadboard, and follow schematics published around the usage of MCP2551 (this one, for example, specifically for Home-Automation). However, if even this is intimidating, then you might like to consider some simpler DIY projects. Home-Automation with few dozen sensors sounds simple, but isn't entry-level stuff. \$\endgroup\$ – icarus74 Jan 19 '13 at 13:18
-1
\$\begingroup\$

If I were you, I'd look into using WiFi and not any wires. Do you really want to run wires around your home?

WiFi is probably your best bet. It's relatively easy to use and with the right algorithms you can run it for a year or so depending on the application without batteries.

\$\endgroup\$
  • 2
    \$\begingroup\$ Well, controllers will need wifi shields. They are priced around $100. I'll need 10. That's $1k in getting that wifi. Now, if I wanted to control 30-50 end point devices around the house (that's not too many) - that's another bunch of $$$ :) I never recognized wifi as a reliable technology for this sort of things, really. I could be wrong, but 300 meters of cat5e for $100 will give a solid and reliable network. I do want to put wires around the house because there is wiring to do anyway (power, TVs, media), walls aren't done yet taking very little hassle to implement. \$\endgroup\$ – abolotnov Jan 7 '13 at 0:27
  • \$\begingroup\$ Let me clarify. There are lower priced solutions. TI's CC3000 Booster pack is available tat $35 at ti.com/tool/cc3000boost, so that's a cheaper alternative and it can be interfaced with basically any microcontroller. For low data rates, WiFi is quite solid since your effective range increases. It'll never be reliable like cat5e but it sure is more convenient and flexible. \$\endgroup\$ – Gustavo Litovsky Jan 7 '13 at 0:47
  • \$\begingroup\$ There is another solution. Using a home's own electric wiring for sensing data. This is a proven technology that's relatively inexpensive. You could create a network with that as the backbone and then CAN to actually connect to things. This will be reliable, cheap and can also use power from AC. \$\endgroup\$ – Gustavo Litovsky Jan 7 '13 at 0:53
  • 2
    \$\begingroup\$ He is talking about a fixed installation, so yes, running wires will be better than relying on radio. I don't know why people seem to jump to wireless solutions first. Wireless should be the last resort only when running wires is difficult or mobility is required. Otherwise, wired is better in pretty much all ways. \$\endgroup\$ – Olin Lathrop Jan 7 '13 at 1:21
  • 1
    \$\begingroup\$ @abolotnov: I missed the fact that you have bare walls. If that's the case, I'd route ethernet all over the house. Make sure to get the quality wire that's more fire proof. I've done that myself. So PoE seems good here. \$\endgroup\$ – Gustavo Litovsky Jan 7 '13 at 2:28

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.