Pages: [1]   Go Down
Author Topic: CAN bus for home automation, opto isolation plus other questions  (Read 7937 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Full Member
***
Karma: 2
Posts: 157
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Has anyone used a CAN bus for home automation?  I don't want proprietary or wireless (zwave), am not about to rewire the house and spend $10k+ on parts (C-bus), and the ethernet interfaces to arduinos are frankly a bit shit (lack of POE, crappy socket functionality, high power, etc), so I'm currently looking at CAN.  I can run a CAN bus around my roof more easily than two dozen CAT5 homeruns for 802.3.

If you're using CAN, did you find that you needed to opto-isolate the transceiver?  It seems to be something that the CAN bus descriptions recommend and the fact that MCP2515/2551 are two separate chips seems to support the idea that one is meant to isolate the RXD/TXD lines between them and run the 2515+microcontroller completely floating compared to the bus, presumably with an isolated DC-DC converter if bus-powered.  Analog Devices and I think TI both sell bus transceivers with built-in opto-isolation but they're quite a bit more $$$ than the Microchip option.

Has anyone done it?  For example, with a pair of 6N139 or similar?  Or implemented a whole-house CAN bus without isolation and found it reliable?

If you're using CAN for HA, which higher-level protocol are you using, CANopen, DeviceNet or something else?  Which HA integration system (head end, UI, etc, e.g. homeseer, freedomotics, etc) are you interfacing with?


thanks...
Logged

ਪੰਜਾਬ
Offline Offline
Edison Member
*
Karma: 12
Posts: 1573
Another year! Alone! :(
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

look at this > https://www.sparkfun.com/products/10039
Logged

"Real Men can Accomplish  Anything"
-  Website  
- skype : nishants5  

ਫ਼ਤੇਹ ਕਰੂਂ !

Offline Offline
Full Member
***
Karma: 2
Posts: 157
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


Yes, that is the MCP2515+MCP2551 that I referred to.  It is also not opto-isolated.  I eventually found some affordable ($5) CAN transceivers from TI that include opto isolation in a single package so at least I can use those if I need to.

The real question is about the higher-level protocols and I've not made a lot of progress in that area - DeviceNet is the most widely supported protocol for factory automation but it's "open" insofar as they will sell you a specification for $'000s.  CANopen really is open (they emailed me 500 pages of PDFs just for the asking), and I've started reading the protocol spec, plus there are open source implementations of CANopen though not for AVR.

Say I hypothetically get CANopen working - it doesn't look too bad and I'll probably need to spend about as much time reading the spec as writing code.  That doesn't get me connected to a common/popular home automation system, merely interoperability with industrial PLCs etc.  I plan to read up on freedomotics with a view to writing a CANopen plugin for it, but haven't had time yet.
Logged

Indiana, USA
Offline Offline
Newbie
*
Karma: 1
Posts: 16
I'm a self-taught electronics engineer from Columbus, Indiana. I've only recently become involved in the Ardunio community.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

My first MCP2515/MCP2551 interface was built on a proto-shield.  I also added isolation and it works fine.  I'll try to post a picture and details of the isolation parts when I get home.
Logged

"Taking the time to make a proper, punctuated, post is a mark of courtesy and respect."  http://forum.arduino.cc/index.php?topic=149022.0

Offline Offline
Newbie
*
Karma: 0
Posts: 15
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

polyglot,

Glad to see that I am not the only out there working on something similar (home automation using CAN) and with the same questions. I didn't want to use wireless since I wanted reliability and affordability. Here are some of my findings of my work. It might be a little long so grab a cup of coffee....

On the software/library/firmware side I originally started with the MCP2515/2551 library from sparkfun but after getting frustrated with the documentation and lack of support out there I compiled everything I can possibly find into one library with the most useful stuff with some CANopen, J1939 and standard CAN message structure support and some arduino friendly commands (https://github.com/DRO/CAN-Library/tree/CAN_MCP2515). Once I was done I ended up finding coryjfowler library and realized he was doing something very similar and I will definitely suggest his library as well (it would have saved me a LOT of time if I would have found it earlier!!!)

Another member here, Neil McNeight, forked this library and is working on a standard approach to use any "arduino supported" CAN controller using the same functions, similar to the Adafruit unified sensor library approach. I have not been able to provide him with much help in that department as I have been working on this home automation stuff but I am glad something is taking a stab at it.

On the hardware side, I started with the sparkfun shield for proof of concept and moved to my own hardware since I has having issues with SPI CS and wanted to add other shields on top. The board had Atmega328p SMD + MCP2515 controller + MCP2561/62 all in one for prototyping. I broke out all the MCP2515 pins so I can test different things and had SPI CS on pin 7. FYI  MCP2551 transceiver is going away so you may want to look at MCP2561/MCP2562 from Microchip or NXP TJA1048T for future boards. If you are looking for galvanic isolation you could use NXP TJA1052IT.

Now that I am done with prototyping stage, I am moving to a very small board for my nodes (1.4" by 0.9") using MCP25625 chip as I can use the same library as the MCP2515 and it comes with built in controller and transceiver. This board also has the ATmega328p so it will have all Arduino functionality. That board will be the "heart" of each node and I will be making some carrier boards depending on the functionality. I will be ordering some preliminary boards once I confirm I can use an oscillator with both chips (ATmega328p and MCP25625) instead of using a cheapo resonator and/or crystal with caps. 


For right now I am focusing in Temp/humidity sensor board and will expand to more later. I have also designed a power "module" carrier board using RJ45 connector (I abandoned Db9 half way through since it is too big and I have to make my own cable) since I wanted to use inexpensive CAT5 cable for communication and providing power to my nodes. I don't care about 802.3 either so I will be using a deviation from the standard CAN RJ45 pinout found here  (http://www.interfacebus.com/Can_Bus_Connector_Pinout.html) and I think will be using freetronics midspan injector non 802.3 complaint to supply power on pins 4 and 5 and ground on Pins 7 and 8. (http://www.freetronics.com/products/poe-injector-4ch#.U7Qr4vldVI4).

Since I am using that approach I didn't focus too much in galvanic isolation but I did add a TVS to my CAN lines to have some protection. So far all my prototypes are working very well and I have not had issues. We will see what happens on the next round of prototypes...

Now as far as Higher level protocol...... I have done A LOT of reading... CANopen, deviceNet, J1939, caraca  and even VSCP (very simple CAN protocol which is an oxymoron since it is really not that simple....) Some of these have a lot of support some others have not been updated for many years. None of these really have what I wanted!!! VSCP has some potential but looks like they got so big and started implementing ethernet and other protocols, xmls and other stuff I don't care about and they lost me there.. I do like the fact that you don't have to be a member or pay money to get what you want there, they have lots of info, they focus on home automation Oh, also they have arduino example there! I don't know, I might have to do more reading on their spec again and see if they loose me again....

I also felt the same way you feel about CANopen, way too many things to read and make sure you meet. The drawback is that you must me a member and/or pay royalties to have manufacturer IDs and your product needs to pass their certification in order to be "CANopen" certified BS. Also their focus is really not Home automation... The positive is that you could use commercially available interfaces/sensors and such.

I didn't want to reinvent  the wheel with protocols but the more I read the more I feel I just need to create my own so I all my nodes can communicate with each other and I have a way to talk to them through a centralized controller (currently using an ardLCD with my CAN board for HMI). So far that is what I have been doing in my prototyping stage. a couple of CAN ids for each node, and data bytes for each event. For full scale implementation, my idea was to use variant of J1939. Assign an ID to each node, assign a PGN to each "event" (room temperature, light status, sprinkler status, node heartbeat, etc) and use data bytes for information... This might allow me to add more nodes as the project expands. I don't know, I might be chewing more than I can swallow here but until I find a better solution I might have to run with it. The drawback of this approach is that any commercially available interface will not work with it but you could also create your own using Rasperry pI, beaglebone. ardunio, laptop etc

Right now, everything that I have done is on a bench and running cables up and down some rooms in my house with my wife yelling at me. So far messages are reliable and have not had any issues. I did find out I might have to use a 100 ohm terminating resistors instead of 120 since CAT5 impedance is rated at 100 and don't want some mismatch there. Note: even with 120 ohm terminating I have not had issues though, CAN is very reliable!

I have not fully implemented this in a house since I am building a new one that should be done in November. Until then, I continue to prepare/learn/tinker and perfect it so once the house is done I can run the cables, set up all my nodes and be up and running!

I hope you didn't get bored by now but I just wanted to share my thoughts since i don't have a blog or anything like that where this is documented (maybe I should... but that sounds like more work lol)

I will post some pictures of some of my stuff later. Where are you at in your project?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have been working on an RS485 arduino that is daisy-chainable for a few months.  It has PoE, and can use a single cat5 to connect lots of nodes.  you could use it to loop around your attic for sure.

the Kickstarter began today, it might be of interest!  If it does interest you, I can answer any questions you might have.  I was also looking at CANBUS, so keep us posted on that progress!

http://ChainDuino.com
or
https://www.kickstarter.com/projects/1370454848/chainduino

Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 15
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Mike,

That looks like a great product! I have already gone the path of CAN for home automation as it has more benefits over RS485 however I think your product definitely fills a void and looks well thought out! Good luck on your Kickstarter campaign. Have you considered a smaller foot print for a future product? Something as small as the mini?

Thanks

Dro
Logged

Pages: [1]   Go Up
Jump to: