CAN vs MQTT: Best Protocol for a Reliable and Secure Shelved Room System?

I’m planning a communication system within a closed room (variable but should work up to 10x10m) filled with shelves, connecting up to 10–40 nodes distributed over the shelves to a central processing unit, would CAN or MQTT be the better choice? (The system will have to be CE-certified).
Key details and criteria are:

  1. Environment and Layout:
  • The room has minimal external interference or noise sources.
  • The nodes sit in the shelves and need to transmit simple sensor data only when a state changes.
  • To ensure full coverage, the total cable length for CAN could reach up to 80m, given a potential serpentine cable routing cable layout.
  1. Reliability and Security:
  • The system must be reliable for transmitting data without loss. When a change occurs it has to be received by the central processing unit in under 1 second, losses would be fatal.
  • Security against hacking or tampering is crucial.
  1. Modularity and Scalability:
  • Nodes must be modular, with connectors allowing easy plugging and unplugging. The cables would run in the floor with sockets for plugging in nodes, if there is a shelve at the respective location. The layout of the shelves and therefore nodes might change sometimes, but not too often (like 1-2 times a year).
  • The system will be used in rooms of different size from 3x6m to 10x10m. But all rooms should run with the same system.
  1. My thoughts:
  • CAN comes with higher hardware and cabling complexity, potentially reducing modularity.
  • MQTT is more flexible and easier to set up but may require WiFi networking, leading to higher power consumption, increased security concerns, and possibly more expensive CE certification.

Given these factors, which protocol would be more suitable for this setup, and what are the trade-offs to consider in terms of implementation complexity, scalability, reliability, and security?

Hi @z0ki

Welcome to the community!

Choosing between CAN and MQTT for your system depends heavily on balancing reliability, modularity, and the CE certification process.

1. CAN (Controller Area Network):

  • Reliability:
    • Designed for reliable real-time communication in industrial and automotive environments.
    • Messages are prioritized, ensuring critical data is transmitted without delay.
    • Less susceptible to interference, as it’s a wired protocol.
  • Latency:
    • Excellent. Guaranteed delivery within milliseconds due to deterministic behavior.
  • Security:
    • Wired communication reduces vulnerability to external tampering or hacking.
    • Can be supplemented with encryption or authentication layers, though this adds complexity.
  • Scalability:
    • CAN networks can handle up to 40 nodes without significant issues but require careful termination and resistance balancing for longer cable lengths.
  • Modularity:
    • Each node connects via connectors, but reconfiguring the layout (plugging/unplugging nodes) requires proper planning, especially for termination resistors.
  • Implementation Complexity:
    • Wiring and connectors can be more complex due to a serpentine layout and need for termination resistors.
    • CE certification is typically straightforward since CAN hardware often complies with electrical standards.
  • Cabling:
    • 80m cable length is acceptable for CAN at lower speeds (125 kbps or less). For higher speeds (e.g., 500 kbps), additional considerations for signal integrity are required.

2. MQTT:

  • Reliability:
    • MQTT is designed for reliable messaging over unreliable networks, but it depends on the stability of the underlying transport (e.g., WiFi or Ethernet).
    • QoS (Quality of Service) levels ensure message delivery, but latency and packet loss depend on the network quality.
  • Latency:
    • With a good network, sub-second latency is achievable. However, interference or congestion in wireless networks could introduce delays or loss.
  • Security:
    • Requires strong encryption (e.g., TLS) and authentication mechanisms (e.g., username/password, certificates) to ensure data security.
    • Wireless networks (if used) are inherently more vulnerable to interference and hacking than wired systems.
  • Scalability:
    • Highly scalable, as nodes only publish messages when needed.
    • Adding or removing nodes is straightforward, with no rewiring required.
  • Modularity:
    • Very flexible. Nodes can be added or moved easily.
  • Implementation Complexity:
    • Higher power consumption for WiFi-enabled devices.
    • WiFi-based systems often have higher CE certification costs, especially for electromagnetic compatibility (EMC).
  • Cabling:
    • A wireless setup eliminates cabling concerns, but an Ethernet-based MQTT setup may require structured wiring, adding complexity.

Recommendation

CAN is the better choice for your scenario due to:

  1. Reliability: Wired communication ensures minimal data loss and predictable latency under 1 second.
  2. Security: The wired nature inherently reduces vulnerability, which aligns with your critical security requirements.
  3. CE Certification: Easier and cheaper with CAN due to the mature ecosystem of hardware components compliant with standards.
  4. Power Consumption: Wired CAN nodes are typically low-power compared to WiFi-enabled MQTT nodes.

Trade-offs of CAN:

  • Initial setup is more complex due to cable routing and termination resistors.
  • Limited modularity, as reconfiguring nodes requires rewiring and careful planning.

MQTT could be viable if:

  1. You can ensure a robust Ethernet network (avoiding WiFi for critical systems).
  2. Security mechanisms like TLS and proper authentication are implemented to address hacking concerns.
  3. CE certification for WiFi-based systems is not prohibitively expensive for your case.

Based on your requirements, CAN would be the better choice due to its reliability, low latency, enhanced security, and simpler CE certification process. Additionally, CAN’s wired nature ensures low power consumption and minimal data loss, making it ideal for your scenario.

For inquiries about HiveMQ for commercial purposes, please contact our Sales Team at HiveMQ Contact.

Best regards,
Dasha from The HiveMQ Team