0
\$\begingroup\$

I need to create a sensor network, with a central node receiving data from +10 different nodes, each one +20meters from the central node. So basically I need to create a star configuration, with a central node in the middle (a pcb with an raspberry pi) and than a big stub(around +20m) for each sensor node. I really don't know what protocol use: CAN, I2C or RS485.

Can I use CAN? Can I use I2C (with P82B96 boost voltage transceiver or PCA9615 differential buffer transceiver) or maybe an RS85 with MAX485 IC?

My biggest problem is how to implement this kind of solution, cause for big stubs, there is a huge mismatch in the bus, so the signal is bad.

This article is amazing, show a lot of different configurations and the importance of terminator resistors for impedance matching. But I really need to implement a solution like Figure 12 or Figure 13, with stubs w/ +20meters.

This article explore the I2C solutions with P82B96 and PCA9615 transceivers, however, I still have the problem about star configuration and big stubs.

Best regards and sorry for my english.

\$\endgroup\$
5
  • 1
    \$\begingroup\$ A little inelegant but you could run the bus to and from the device back to the hub so it looks like a star but is actually still a daisy chain. Or place bidirectional repeaters all around the hub just before each stub. \$\endgroup\$
    – DKNguyen
    Commented Jan 13, 2021 at 14:51
  • \$\begingroup\$ But infortunally the bus instalations is already done. So now I just have all the wires (+20m) mergin in the same spot where the central node will be \$\endgroup\$ Commented Jan 13, 2021 at 15:04
  • \$\begingroup\$ Do you have to use a star network or did you just think it would be a good idea? \$\endgroup\$
    – Lundin
    Commented Jan 13, 2021 at 15:15
  • 3
    \$\begingroup\$ And well, don't install cables before you know what data that should go through them... \$\endgroup\$
    – Lundin
    Commented Jan 13, 2021 at 15:17
  • \$\begingroup\$ Wasn't me... By boss did the instalation and now wants to automate everything. And I need to work with the current instalation of wires... \$\endgroup\$ Commented Jan 13, 2021 at 15:32

2 Answers 2

3
\$\begingroup\$

Star-shaped networks are generally not recommended, but 20m stubs on a starshaped RS485 should be fine, assuming you keep under ~38400 baud and not go much beyond 10 sensors.

\$\endgroup\$
4
  • \$\begingroup\$ But in this article* about RS585 w/ MAX485 IC, as figure 12 and 13 explain, Star configuration or big stubs are not recomeded :( Article*: maximintegrated.com/en/design/technical-documents/tutorials/7/… \$\endgroup\$ Commented Jan 13, 2021 at 14:59
  • 2
    \$\begingroup\$ Yea, a 500m stub starshaped network at 115200 baud will not work. So it is not recommended as in "You cannot reach the maximum potential of a RS485 network if it is starshaped". My point is that 20m is not a big stub. You probably don't even need termination anywhere else than at the transmitter, and it will work just fine. \$\endgroup\$
    – Arcatus
    Commented Jan 13, 2021 at 18:19
  • \$\begingroup\$ Are u sure 20 meters is not a big stub?? \$\endgroup\$ Commented Jan 13, 2021 at 20:24
  • 1
    \$\begingroup\$ The significance of the length of the stub depends on the baud rate you're running. As Arcatus has said, if you only run at a slow baud rate like 38400 then a 20m stub isn't all that bad. \$\endgroup\$
    – brhans
    Commented Jan 14, 2021 at 3:56
3
\$\begingroup\$

Assuming the dysfunctional star topology is already in place and you don't have very tight real-time requirements, you could perhaps patch together what you have with this solution:

  • At the central node, place one CAN transceiver and a 120R terminator.
  • At each node, another CAN transceiver and a 120R terminator.
  • Mux the CANH CANL lines to one node at a time, using an analog switch IC.
  • Now time-multiplex the access to each node and read them one at a time in sequence on the CAN bus.
  • All communication should be: master node requesting something, slave node responding. Slaves are not allowed to speak unless told to (or they will quickly go CAN error passive in case the master is disconnected).

With this solution you essentially have 10 nicely terminated CAN-buses of 20m each and no stubs. There won't be any problems running CAN at 1Mbps then, just make sure that the master selects a node before transmitting CAN data.

\$\endgroup\$
6
  • \$\begingroup\$ wow great ideia. But some nodes need to send data to the central node without waiting for a request. Imagine that a door opens, that node needs to immediately send that information to the central node ... In a typicall CAN BUS, any node can sent a message to the bus (and wait for the central node to receive that). In your idea, that isn't possible... \$\endgroup\$ Commented Jan 13, 2021 at 15:38
  • 2
    \$\begingroup\$ @user273780 - Hi, Regarding "that node needs to immediately send [...]" Please check the system specification (or, if you don't have one, then create it and get it approved) to state exactly what "immediately" means - because there is always a delay (e.g. even just the MCU execution time) so truly "immediately send" is impossible. Now the only question becomes: How long can the delay be, between event and master reception? Then, as you see, the approach in this answer might still be possible, if the master device polls the sensors quickly enough to meet the overall system specification. \$\endgroup\$
    – SamGibson
    Commented Jan 13, 2021 at 16:23
  • \$\begingroup\$ Imagine you have a button on your microcontroller. When you press the button, the falling/rising edge can generate an external interrupt in the microcontroller. In the moment (and only in that moment) I would like to send that "information" to the master. So I don't want the master to constantly ask the slave for new data ... \$\endgroup\$ Commented Jan 13, 2021 at 16:28
  • \$\begingroup\$ @user273780 - Hi, Yes, I understand interrupts. However even an interrupt triggers code to be executed so any result is not immediate. The only question is how much delay can be accepted (and why) in your specific system. "So I don't want the master to constantly ask the slave for new data ..." It is still not clear to me exactly why you don't want that. Of course, the more such constraints you have, the fewer solutions there will be. Please edit the question and add all known constraints into the question, to avoid us wasting time giving solutions that you will reject. Thanks! \$\endgroup\$
    – SamGibson
    Commented Jan 13, 2021 at 17:00
  • 1
    \$\begingroup\$ @user273780 Time to be engineers and do the actual real-time math. An 11 bit CAN frame with 8 bit data comes with 47 bit overhead counting interframe space. If the master makes a request through a RTR frame, there is no data. So the total time to poll each node for 8 bit of data would be 47 bit master RTR request + 47+8 bit data slave response = 102 bits. 102 bits @ 1Mbps = 102us response time. With such a design you can poll 10 nodes in 1.02ms, or if you will, around one thousand times per second. \$\endgroup\$
    – Lundin
    Commented Jan 14, 2021 at 9:44

Not the answer you're looking for? Browse other questions tagged or ask your own question.