8

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

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

2 Answers2

9

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.

Olin Lathrop
  • 310,974
  • 36
  • 428
  • 915
  • 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? – abolotnov Jan 06 '13 at 21:31
  • 1
    @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. – Olin Lathrop Jan 06 '13 at 21:36
  • I'm sorry if that sounds stupid. I keep looking into all this and drawing schemas and looking for micros and all that and come to a funny conclusion: there are no real advantages in CAN over Ethernet then? I looked up arduino/netduino as somewhat that seems friendly enough and well documented and supported by community and CAN/Ethernet shields - the pricing is pretty much the same but Ethernet is a bit friendlier to newbies like myself right? So should I look after Ethernet enabled micros that allow more of less plug and play of sensors? – abolotnov Jan 06 '13 at 23:33
  • 1
    @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. – tcrosley Jan 07 '13 at 00:41
  • @tcrosley, what you are saying is very relevant if you are not me - this MCP2551 is a little chip that you have to solder into something right. I'm not good enough to do that far :) So I'd have to get a CAN shield or something to enable CAN networking on my micros. And they are $25 as far as I could find so far. We are taking 10 boards to cover my whole house - saving $80 is not that big of a deal even if I knew how to put ships on the boards :) – abolotnov Jan 07 '13 at 00:56
  • 1
    @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. – Olin Lathrop Jan 07 '13 at 01:19
  • @abolotnov "this MCP2551 is a little chip" It is available in a [DIP package](http://www.digikey.com/product-detail/en/MCP2551-I%2FP/MCP2551-I%2FP-ND/509453). Most of Microchips ICs are, which is why I prefer them. – tcrosley Jan 07 '13 at 01:51
  • 1
    @abolotnov, to add to tcrosley's answer, a DIP package can be simply pushed-in into a [breadboard](http://www.ebay.com/itm/1-pcs-Mini-Solderless-Prototype-Breadboard-170-Tie-points-for-Arduino-Shield-/270973557315), and follow schematics published around the usage of MCP2551 ([this one](http://projekt.auml.se/homeautomation:hardware:avr:corecard), 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. – bdutta74 Jan 19 '13 at 13:18
-1

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.

Gustavo Litovsky
  • 7,619
  • 3
  • 25
  • 44
  • 2
    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. – abolotnov Jan 07 '13 at 00:27
  • Let me clarify. There are lower priced solutions. TI's CC3000 Booster pack is available tat $35 at http://www.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. – Gustavo Litovsky Jan 07 '13 at 00:47
  • 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. – Gustavo Litovsky Jan 07 '13 at 00:53
  • Another solution is for you to design using your own wireless network using CC1101. I recommend this device from experience since it is easy to use, is low power, and because it operates at 900MHz, its range is greater than 2.4GHz devices. – Gustavo Litovsky Jan 07 '13 at 00:57
  • I appreciate your wireless advice but I honestly don't see a real value (yet?) - it is only more convenient when you are not starting with bare walls like myself. Besides, the end controllers will need power anyway. That's wiring, too. – abolotnov Jan 07 '13 at 01:00
  • 3
    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. – Olin Lathrop Jan 07 '13 at 01:21
  • @Olin: I agree that most people do just jump to wireless. However, mobility, and holes are two issues with cables that are easily addressed with wireless. In his case it's warranted to offer it as an option. He wanted to cover multiple rooms in a setting where WiFi is usually available and it's small enough for wireless coverage. Also, his application doesn't require a lot of bandwidth and is not completely real time. Therefore, wireless would be an ideal solution if he can meet his price point. No wires, no holes, and he can expand at will. There's a reason most use 802.11 and not Ethernet. – Gustavo Litovsky Jan 07 '13 at 02:22
  • 1
    @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. – Gustavo Litovsky Jan 07 '13 at 02:28
  • Maybe run CAT5e for the sensors, and *separate* CAT5e from each room to a utility room, closet, or basement, so that you can have networking in each room as well. I have a WiFi card in a "family" computer for "ease of use" around the house, and it is AWFUL. 5 bars of signal yet frequent disconnects. I'd gladly use a wired port if one were available. Planning on running CAT5e to this area instead. Long flex-drill bit, existing-construction outlet box, RJ45 plate, and drywall saw = no need to tear out drywall, no ugly holes. – rdtsc Aug 30 '15 at 21:02