2

I am planning to make a prototype for wired home automation devices, and I am thinking of using CAN bus for communication between nodes and Gateway.

The way I am planning to build it, there is one gateway with CAN bus capabilities, let's say up to 4 CAN buses for extension, with only software running. No inputs or output, and up to the limited number of nodes per bus with up to 2 relays, or 4 sinking transistor outputs, and 5 V inputs to act as switch and sensor inputs. I also think of wiring each node connected to the same CAN bus with a single wire.

I was hoping to use up to 32 nodes per bus for a maximum distance of 500m per bus cable

My questions are as follows:

Should I use 24 VDC or 24 VAC for power supply to cover the distance between gateway and all nodes?

What kind of twisted pair shielded cable should I use to ensure both communication and power supply of the nodes?

Is there another bus that will be better in this use case?

Null
  • 7,448
  • 17
  • 36
  • 48
awakrim
  • 21
  • 3
  • 1
    I’d be thinking power over ethernet would be a better move. Your power and comms solved in a standard way. Tour cable requirement is taken care of. Otherwise you need to have isolated dc dc converters, circuit protection and so on. – Kartman Feb 10 '22 at 04:26
  • 24VAC is readily available in North American homes as thermostat wire (and is also a common doorbell voltage). Listed 24VAC transformers are readily available in the US$13 range. However, do not switch AC mains using stuff you home-built. Use packaged, UL Listed relays such as RiB or Aube which provide for partitioning of AC mains and low voltage wiring (they must be on opposite sides of a divider). – Harper - Reinstate Monica Feb 10 '22 at 06:39
  • CAN is very robust (so normal twisted pair with the correct impedance is OK, at long distances shielding is a definitive must). Keeping in mind it was designed for automotive, e.g. lorries up to 50m, 500m might be possible with a careful design, but maybe RS485 with galvanic separation like its used for Profibus is better suited. E.g. Profibus provides for 1km at lower baudrates like up to 187.5 kbps @ 1000 Meter or 500 kbps @ 400 Meter. – schnedan Feb 10 '22 at 07:24
  • 1
    @schnedan CAN is more rugged than Profibus on both short and long distances. Running Profibus at 187kbps @ 1000m copper will not end well no matter what various fishy Internet sites claim. The main problem is the crappy data link layer of UART - apart from that, RS485 and CAN are quite similar signal-wise. There is nothing in RS485 which would make it more suitable than CAN at higher baudrates - on the contrary. – Lundin Feb 10 '22 at 07:42
  • 2
    Anyway the answer to the questions here entirely depend on what you have available and what current draw you expect. Assuming each node has a local regulator from 24V down to 5V and that the current draw is something sensible. However if you manage ~100mA per node and 32 nodes scattered across 500m, that's some serious potential voltage drop still. You'll need quite thick cables, AWG10 or something. All the theory and an online calculator can be found here: https://www.rapidtables.com/calc/wire/voltage-drop-calculator.html 4 signals at that and ideally shielded... it's not going to be cheap. – Lundin Feb 10 '22 at 07:57
  • @Lundin Yes and No - while I am maintaining a industrial CAN product, RS485 (e.g. Profibus) is designed for very harsh environments with high tolerance to common Mode Problems, etc... CAN allows for applications far beyond its initial design goal and the protocol might even compensate for some weaknesses in the physical layer, but if you are not forced to use CAN in a 500m application, maybe other technologies are even more suited. And here RS485 might be an option, as the described application is inside the intended use of it. There is also good documentation available for such applications – schnedan Feb 10 '22 at 08:17
  • 1
    @schnedan Nothing in that comment explains _why_ Profibus would be more suited. Which it isn't - compare for example the classic MAX485 transceiver with a modern CAN transceiver like MCP2562. MAX485 is _nowhere near_ playing in the same league. It's like comparing a car from 1980 with a car from 2022 to see which one is safest. – Lundin Feb 10 '22 at 08:38
  • @Lundin "with high tolerance to common Mode" - need any more explanation? galvanic separated RS485 designs are much more robust than CAN - even if CAN already is good. – schnedan Feb 10 '22 at 08:45
  • 1
    @schnedan This is getting silly. Are you comparing a galvanic isolated RS485 vs a CAN bus without isolation? How is that even relevant? It is very common practice to use galvanic isolation for CAN as well. – Lundin Feb 10 '22 at 08:59
  • @Lundin "This is getting silly." At least I can agree on that – schnedan Feb 10 '22 at 09:07
  • 1
    @schnedan If you want to argue you need to provide actual arguments or facts. "High tolerance to common mode" how, exactly? Compare the mentioned transceivers, MAX485 can handle -8V to +12.5V absolute maximum, MCP2562 can handle -58V to +58V. Modern CAN transceivers has a SPLIT pin for increased common mode stabilization, RS485 transceivers lack one. Sorry but your car from 1980 is _not_ safer than the one from 2022. – Lundin Feb 10 '22 at 09:12
  • 2
    Hello, thank you for the insightful debat between the RS485 and CAN. I was concidering CAN for two main reasons: 1) broadcast communications and collision prevention and 2) Protocol and Addressing. As per @lundin reply, i was thinking of wiring through a wire with Thick wires AWG10 for powering, and thin ones for CAN communication. The board will have a 24v to 5v regulator for uC and transistor to control 2x 24vdc 220VAC/8A (9.2mA Omron) relay for switching in order to reduce current consumption. Also, nodes will be in sleep mode awaiting signal either from gateway or inputs. – awakrim Feb 10 '22 at 19:46
  • @lundin let's say to avoid voltage drops, is it possible to power independently each 32 node via main AC power through pcb transformer, or battery, and maintain robust CAN communication without ground in practice not theory, with smaller lines of 50 or 100m through cat6 cable? – awakrim Feb 10 '22 at 19:59
  • 1
    @awakrim The CAN data link layer is far more suitable for broadcasting indeed. Regarding the wires, there are "CAN standard" M12 5 pin cables with 2 thicker supply wires and shield (Phoenix Contact), PUR and IP67 etc, high quality but expensive. As for relays and voltage drops, a 24V coil only works reliably down to 18V so that's actually your voltage drop bottleneck. Maybe consider different coils. I don't understand what you mean with "without ground", galvanic isolation? – Lundin Feb 11 '22 at 07:43
  • 1
    What about this? https://www.ti.com/lit/an/slla496a/slla496a.pdf?ts=1645021649018&ref_url=https%253A%252F%252Fe2e.ti.com%252F Two wires. Power and data. 256 nodes (theoretical). No polarity requirements. They are showing for possible wire lengths up to 1Km. Extensive design guides and examples available. Dev-board available as well. Could be nice right? – Thijs Feb 16 '22 at 14:36
  • @Thijs thanks for the suggestion, sounds promising, the dev board is only $49, worth the test. Also as you mentioned it supports power line communications via single dc power supply and RS485 features (half duplex). Have you or anyone else test this THVD8000? – awakrim Feb 20 '22 at 22:03
  • 1
    A little late in here, but have you considered using a protocol like NoCan which runs on top of a CAN bus. I've just started playing around with it and finding it to be suitable for my next automation project. Anyway, more info can be found at omzlo.com – David Moorhouse Aug 29 '22 at 19:40
  • 1
    @DavidMoorhouse Better late than never! That's a great addition, plus it covers everything I needed, 300m one 9-24VDC + it's open-source. Thank you so much for your input ! – awakrim Aug 30 '22 at 21:04
  • @awakrim I'm making some good progress on my project. I am looking at being able to dynamically bind nodes together without having to change the programme for each one. Let me know if you are interested. – David Moorhouse Nov 19 '22 at 10:46
  • @DavidMoorhouse I will be happy to see what you've got so far. – awakrim Nov 19 '22 at 16:09
  • @awakrim I've proto typed the binding stuff, my code is in a private repo on github. Let me know if you want access. At the moment my focus is on a couple of hardware projects that I'll be using NoCan type nodes to control: - 6 channel switch input - 3 channel relay output - 4 channel dimmer output I hope to have the work on these completed early next year at which point I'll move back to look at some tooling to enable static configuration of the nodes, that can be uploaded over the bus. – David Moorhouse Nov 19 '22 at 19:08
  • @DavidMoorhouse I'm intrested in getting the access to the repo. is there a way we can get in touch ? – awakrim Nov 20 '22 at 11:52
  • @awakrim my github handle is fastbike – David Moorhouse Nov 22 '22 at 07:22

0 Answers0