RE: [ha] CAN in Home Automation

Lars Wictorsson (lars.at.lawicel.com)
Fri, 27 Nov 1998 12:01:18 +0100

Hi Zeb et. al,

As I said, I'll be happy to answer CAN related stuff.

> We've recently talked about the possibility to use CAN as a backbone
> network. There are however some issues that need to be worked out first.
> One of our design objectives is to allow several access media options
> (Powerline, RS485, RF...). Can CAN cope with that?

I've read that it can be on top of a DC network (24VDC), but havn't seen
the design yet. Then recently I also heard that it can run on the AC power
lines
and I'm currently investigating that "rumor". Here it seems like they are
"protecting" the idéa, but saying it can be done (always like this, eh?).

Any way, CAN normally runs on a twisted pair, and doesn't have to be
shielded, but it helps on higher bit rates and distances, so infact you
can run it in normal telephone line cable types as you have at home
(at least here in Sweden). _But_ however, if all units are supplied from
a different power source, there could be a voltage difference from ground
and then it fails, this creates currents to flow from one tranciever to
the other and they might be damaged, so even if they say it is a 2 wire
it is actually 3 wires (ground included). So then (normally) there is a
cable with 2 pairs twisted pair, one pair for running CAN and the other
to supply the units (or at least have one wire for common ground).

Instead of using CAN trancievers, I have also used MAX485, which
is RS-485 line drivers and that works too, but not at high speeds.

There are on the market today media drivers for, wire, opto and
then also RF (very expensive).

The whole point is that to send CAN, the media has to be able
to do the following things:

When a node sends a bit value of "1" (ressisive) and when a node sends
a bit value of "0" (dominant) that nodes wins over the others sending "1",
so if you can create that rule, you can send in any media!

Also thought of this:

When using AC power lines, I do not know how that would work at
all, since in Sweden we use all 3 phases in our homes and they are
splitted in the whole house. (between these phases it is 400V, but
then we also use "ground" to generate the 240VAC). So if you send
on one phase in one part of the house, it may not show up in the
whole house, since there are other phases there. I do not know
how to solve this, maybe some of you do?

> Second, with my basic
> knowledge of CAN, I know there's a lot of overhead, the packet lenght is
> rather small, the maximum speed drops significantly in case of longer
> lines lenghts and stubs are prohibited.

That is true (a bit of getting the good stuff, you need to offer others).

If you send a packet with 8 bytes (which is max), that contains
64 bits, but the whole packet includes about 135 bits (this
includes the Identifier, CRC, bit stuffing etc.). _But_ when
you send something, you never have to worry that it doesn't
get through of collide with something, just send it!

And since it is multi master, you could have one small node
sending e.g. the temperature each second without bothering
about if the bus is free and then other nodes who needs that
temperature, just picks it up and uses it!

And there is normal CAN with 11 bit identifiers and the new
CAN 2.0B with 29 bit IDs (that is much!).

> Assets are the very robust error detection, high noise immunity
> (originally designed for the automotive environment) and there are
> already numerous embedded processor types with build in CAN controller.
> I've already browsed the net for more relevant CAN information & data
> sheets (app. notes) but apart for some vendor specs, I haven't found
> much explanation about the do's and dont's. Maybe Lars can show us the
> way?

Sure, just shoot with the questions if you have any, then I'll try to
answer them.

As you said, there are many CAN chips out there today, single
chips and integrated in MCs. I have used the 82C200 (now is
that replaced with SJA1000, Philips), then the 82527 from Intel.
The MCs i have used C515C & C505C from Siemens and
the 592 (from Philips). The C505C is perfect for this, simple
8051 with RS-232 and CAN on board together with 8 ea. 8 bits
ADC. The C515C has 8 ea. 10 bits ADC, SPI, RS-232 etc.

And when one have decided how the protocol should work,
the C505C has 32k OTP and 1k RAM which is enough
for making a simple node. (and they less than $10US each).

So, if you want to ask, shoot!

Regards

/Lars

P.S. Could mention a bit on length V.S. Speed etc.

Max is 1Mbit which will take you 40m bus length.
But if you go down to 125kbit (which is more than
enough in many cases), you could go 500m.

You could have 50-60 nodes in the same network
without having bridges etc.

----------------------------------------------------------
LAWICEL Phone : +46 (0)451-50750
Lars Wictorsson Fax : +46 (0)451-50750
E-mail: lars.at.lawicel.com WWW : http://www.lawicel.com

Embedded hardware/software together with 8051/C16x and
smart distributed I/O with Controller Area Network (CAN).
----------------------------------------------------------