Close

RS485 Bus Protocol

A project log for Interactive Disco Dance Floor

A large interactive disco dance floor with hidden capacitive sensors

jeremyJeremy 03/10/2015 at 07:360 Comments

I finally got the disco floor slave/master network working end-to end. Here's how the protocol works (see README for more info).

There is one master and many floor cells (slaves) all running on an RS485 bus. Each floor cell is daisy chained to the next with a single 'enable' wire, for automatic address registration. There are 3 phases in the floor life cycle: addressing, status, updating.

  1. Addressing phase
    1. Master makes the enable pin on first floor cell HIGH and sends a global message with the current highest address (1). (master will repeat this message every 500ms that the bus is idle)
    2. The first node...
      1. See's the enable pin is HIGH
      2. Receives the address message from master
      3. Increments the address by 1 and responds to master with this address (2).
      4. Makes the enable pin on the next floor cell high
      5. Master responds with this new address. (and repeats every 500ms)
      6. Repeat 1 - 4 for each node on the floor.
    3. Once the bus is idle for more than 5 seconds, master moves onto the status phase
  2. Status phase
    1. Master sends a global message asking for nodes to report their status.
    2. First node responds with it's status, which includes
      • Is it fading
      • Does the capacitive sensor detect anything
      • It's current color
      • What color it's fading to (if it's fading)
    3. Each node waits until the node before it reports status before sending it's status.
    4. If a node does not respond after 500ms, master sends another status request for all nodes from that node forward.
    5. If it still does not get a response, master skips that node and asks for status from the next node forward.
    6. Once all nodes have responded, master moves to the update phase.
  3. Update phase
    1. Master sends a program update to nodes. Either set a color or fade to a color
    2. After master has finished updating nodes, it repeats the status phase.

This has all been prototyped with an arduino as the master node. The next step is to update the nodejs computer program to talk to the nodes directly.

Discussions