CAN Bus For Home Automation

Here’s one node on the new home automation system on which [Black Rynius] is working. So far he’s testing out the system with just two nodes, but plans to build more as the project progresses. He’s chosen to use the CAN bus for communications; a protocol which is most commonly found in automotive applications.

The biggest plus about using the CAN bus is that it requires just one pair of wires for communications. As you can see, there’s an old doorbell included on this board and he’s hoping to use the existing doorbell wire to connect between nodes. Each unit includes a PIC 18F4580 which has a CAN engine built into it for easy protocol translation. There is also an MCP2551 which handles the transmissions. You can read a bit more about the hardware choices in his breadboarding post.

So far almost everything is working as planned. He’s able to send and receive data between the two boards including temperature from a sensor and time from a DS1305 RTC chip. The one thing that vexes him is that doorbell. It draws too much current for the wall wart that’s powering the board, browning out the microcontroller and causing a reset. That’s not a hard fix and we look forward to more developments in the near future.

[via Dangerous Prototypes]

19 thoughts on “CAN Bus For Home Automation

  1. CAN is nice for automotive applications: it’s realtime (a higher-priority sender can grab control of the bus), and resistant to electrical interference (fuck you, spark plugs and alternator!).

    I used to think CAN was the bee’s knees. However, chips which include a CAN transceiver are more expensive, and those robustness features aren’t really necessary for home applications.

    I’d love to see a proper comparison of buses for home automation, like 1-Bus, RS-485, or even I2C.
    (Multi-master on CAN is great, though.)

    1. +1

      Those transients alone in an automotive setup can be a real pain! Things get interesting with failing rectifiers & regulators, people disconnecting the battery to “check” the alternator (ugh…), jump-starts with 24V or higher, reverse polarity, welding (body parts), corrosion, temperature extremes and changes, non-resistive spark plugs & wires (yes, they exist), petro-chemical exposure, moisture, etc.

      It’s an interesting environment, for sure.

    2. RS-485 doesn’t specify a communication protocol, like CAN does. So it would be a bad comparison. But RS-485 is simple and is a real step up from RS-232. You can also use default UART hardware with the right line driver to get RS485. So it’s quite simple to implement.

  2. just one pair of wires for communication? ah yes, a differential pair, can-high and can-low. but then also v and gnd. that’s 4 lines again.

    does anyone know a cheap two wire system? dc-power + ac-communication like in a phone, or ac-power + hf-communication like data over powerline.
    i know these two, but chips aren’t cheap.

      1. There is also 1-wire CAN. Single wire CAN is currently found mainly in specialty automotive applications which emphasizes low cost. It is defined in the SAE 2411 specification, single wire CAN uses only one single-ended CAN data wire, as opposed to the differential CAN wires found in most applications. In a vehicle there is also a common ground. Lookup the MC33897.

    1. The only two I know of are ‘one wire’ (comms and power share the same conductor, plus ground makes 2 conductors) and ASi-bus. One wire doesn’t have many chips built for it and it is designed for very low power applications (unless you split power and comms to have 3 conductors). I have only seen ASi-bus in industry, never in a hobby setting. I believe it sends a AC differential over the 2 DC (power and ground) conductors. It runs at 14V I think, so more power than one wire.

    2. Check “OpenTERM” while OpenTerm itself is just a communication protocol, it specifies communication over low power lines. There should be some DIY hardware if you google around.

  3. I’m pretty sure that two can-nodes requires a common ground, just like RS-485. But judging from the pictures there seems to be a no common ground. It might be working, but it may also be that at some point it burns the MCP2551 CAN-transceivers.

    1. It is a differential signal so no ground is needed. Common noise, offsets etc can become a problem. In my system they are powered by the same power source so ground is already connected. I have tried external modules with only CAN-H and CAN-L connected, it worked fine.

  4. It may not be the drawing of the power in the solenoid that is the issue, it may be the releasing of that magnetic field causing an equal amount of power coming back down the circuit. Try putting a diode across the wires to give the current a place to go and see if that helps.

  5. Beware that CAN is designed for vehicles, not homes: at 1 Mb/s it wouldn’t allow more than 30 meters or so.
    You can lower the bit speed and go reasonably far away with CAN, but then RS485 would allow the same distance at 5 to 10 the speed.

    1. When working with CAN you are well aware of the speed/distance conditions and you rarely need 1mbits, 25kbits/1600 meters is good enough for projects like this.
      The disadvantage of the RS485 is the lack of multi master nodes, so a single master needs to pull each node for changes.

  6. Save yourself a lot of work if you are using AVR (Arduino), most of the CAN work is done for you. You can get Cory Fowler’s library, it has most everything you need and it works, You will need two nodes because CAN transmissions need an acknowledgement and cannot acknowledge themselves. Here is the link: I run it at 250K in home automation without any problems.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.