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]

Comments

  1. Bryan says:

    May the power of PIC compel you!

    It’s nice to see more Microchip brand projects

  2. Steve-O-Rama says:

    Nice CAN.

    Sorry, couldn’t resist. ;p

    Thanks for posting this! That MCP2551 looks to be a decent low-cost solution for CAN transceiving.

  3. jlargentaye says:

    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.)

    • Steve-O-Rama says:

      +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.

    • kubik says:

      There’s a SW implementation of CAN for Atmel AVR 8 bit microcontrollers called Caraca – http://caraca.sourceforge.net/

    • Daid says:

      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.

  4. tantris says:

    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.

    • Dusk says:

      There is “1-Wire”, but it’s pretty limited.

    • stu says:

      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.

    • Daid says:

      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.

  5. dingwizard says:

    Gives me a great idea to help build upon my CAN. rep+

    Going to have to go get the MCP2551.

  6. Brian says:

    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.

  7. Jimmy the Geek says:

    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.

  8. qwerty says:

    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.

    • Brian says:

      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.

Speak Your Mind

*

Related Hacks in home hacks

  • Arduino compatible home automation for smart phone or voice control
  • The trials of working with brushless DC motors for the first time.
  • Golden spiral chicken coop
  • A much easier take on an Android garage door opener
  • Automatic cat feeder made with recycled laminator parts