The Physical CAN bus
I made some long overdue progress on my Smart House project that uses CAN bus. Up till now, the physical bus were two scrap wires I twisted together and soldered on a couple pins for plugging into breadboards. This wasn’t going to be an option once it was time to run the actual wires through my house, since it will be more than a few feet. A search for a single twisted pair, around 18 AWG and unsheathed yielded nothing, unfortunately. I settled on some security cable, which is two conductor 22 AWG, shielded and sheathed, as well as readily available for cheap at any hardware or big box home store.
For a test bus, I randomly cut a piece 12 feet long and soldered on 120 ohm resistors to each end, then connected to the K-node and SpartaNode. Of course it didn’t work, and probing with an oscilloscope showed a nice 60 Hz wave causing interference. The wave was present with or without power on and also near or far from other wires. The interference wave’s amplitude varied from about 1 volt peak to peak, to over 3V when moved around and was superimposed on any CAN messages on the bus. I suppose Murphy’s electrical law was in effect; the one about a wire being an antenna when you don’t want it to be.
The good news is the book, CAN System Engineering, held the solution. By using three capacitors per end, all the 60 Hz wave was removed and a crisp CAN message was able to travel just like in the test setup. The values of the capacitors are the same for both ends and depend on the length of the bus. For mine, I needed a 68pF cap between the CAN High and Low wires, and two 220pF caps from each to ground. I soldered these to the board (but just realized I shouldn’t have, d’oh) and added a place to connect the cable shield. The two nodes are still showing a communication error, so the same CAN message is being repeated for a response, but the at least you can see it’s nice and clean looking. I suspect it is a software issue.