Home > 18FXXXX, microcontroller > CAN Nodes for Smart House

CAN Nodes for Smart House

Good news everyone! I got two working CAN nodes that I hope to use for setting up a smart house network. I want to outfit my house with sensors and controls for various tasks such as data logging, HVAC control and as a reminder to not leave doors open all night. In a nutshell, CAN is a communication protocol first used in automobiles and more info is here. It’s features include collision detection, operation in noisy environment and being a single twisted-pair wire for easy install(I hope).

CAN Node #1

So far my two nodes both use the PIC 18F4580 microcontroller and MCP2551 CAN bus Driver, but different peripherals. The CAN engine built into the 18F4580 takes care of the bulk of the CAN protocol, like bit-stuffing, masks and filters, the different frames and all the other goodies in the spec. I had a class a couple years ago that covered it all and some other stuff that is already replacing CAN, so I didn’t actually read it(ha!). Anyways, the basic communications are demoed with the two nodes, press a button on Node1 to send a message to Node2, and Node2 periodically requests data from Node1 (a temperature sensor). This is my mock-up for the first phase of the smart house when I replace my ancient doorbell system of cloth-clad, solid wire to the twisted pair CAN bus, then expand by adding nodes.

CAN Node #2

As far as schematics and code, they are works in progress and yet to be released. I have a Sensor node schematic and board almost done, then an LCD/Info node following. As far as the code is concerned, I was disappointed in the Microchip ECAN Library, and found loading the appropriate registers following the datasheet to be easier. This was also the  general theme coming from Microchip’s CAN forum. Also I’m getting a git hub together to share, so yeah.

Categories: 18FXXXX, microcontroller
  1. February 29, 2012 at 6:57 pm

    Looks like fun, i plan to do this when i move. Or well… something very similar to it 🙂 Keep on posting dude, ill keep on visiting 🙂

    • February 29, 2012 at 7:35 pm

      Thanks, I have more stuff to post. I’m finishing up some permanent nodes to setup the real bus.

  2. February 29, 2012 at 9:28 pm

    Hey i am working on some LCD stuff. Perhaps when im done, you can read and get some inspiration for using a large 4.3″ LCD for a base or something. I see you used a color and 4×16 or 4×20 lcd in the post. Would be awesome to see what you can do with a bigger display on this. My LCD board will allow the use of a single PIC for control. But it will have to be like a 40 pin PIC, but i think it would be worth it and add to the coolness 🙂

    • February 29, 2012 at 9:55 pm

      Awesome I saw, a node with an 8″ LCD would be neat. I was working with a PIC32 starter kit, 3.2″ LCD and touchscreen, but sidelined it to get the easier put going.

  3. March 8, 2012 at 10:15 pm

    Вдохновляет к дальнейшей работе.

  4. anjali
    March 18, 2012 at 8:51 am

    hi blackrynius,
    I’m also trying to establish communication between two pic18f458 using CAN bus but its not working…can you post the software at least initialization part thanks

    • March 18, 2012 at 12:48 pm

      Sure, I’ll write up something in a new post. If you haven’t yet, check out the Loopback mode to test if one node is setup correctly.

    • Vicent
      April 30, 2012 at 1:07 pm


  1. March 7, 2012 at 4:02 pm
  2. March 7, 2012 at 5:13 pm
  3. March 7, 2012 at 11:03 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: