On a polled bus the sample rate per node is one over the number of nodes times the time of one poll. Frame length, turnaround and above all the schedule set that time. Cable delay and transceiver speed are rarely the limit at tens of metres.
What is a multi-drop sensor bus?
Several sensing nodes share one pair of wires with a master. Only one device may drive the pair at a time, so the nodes take turns. The common arrangement is polling: the master sends a short request to one node, that node answers with its data, and the master moves on to the next node. Differential buses of the RS-485 kind work this way over tens of metres, with data and often power in one cable.
The question this note answers is practical. A system delivers fewer samples per second than its parts seem to allow. Which part is the limit?
What does one poll cost in time?
Four things happen in a row, and each takes time.
t_poll = t_request + t_turnaround + t_reply + t_gap
- The frames. A byte sent as start bit, eight data bits and stop bit is ten bits on the wire. A frame of
bbytes at bit rateRtakes10 · b / R. - The turnaround. The node must receive the request, check it, switch its transceiver from receive to transmit and start sending. That is firmware time plus the driver’s enable time.
- The gap. After the reply the master needs a moment to switch direction and to mark the end of the frame.
- The cable. A signal travels about 5 ns per metre in a cable, so request and reply together add
2 · L · 5 ns/mfor a cable of lengthL.
With n nodes polled one after another and one sample per poll, each node is sampled at
rate per node = 1 / ( n · t_poll )
Worked example (example values, not our bus). Bit rate 1 Mbit/s. Request 4 bytes, reply 20 bytes, turnaround 50 µs, gap 20 µs, cable 25 m, four nodes.
| Part of one poll | Time |
|---|---|
| Request, 4 bytes | 40 µs |
| Turnaround | 50 µs |
| Reply, 20 bytes | 200 µs |
| Gap | 20 µs |
| Cable, 25 m there and back | 0.25 µs |
| One poll | 310 µs |
Four nodes polled back to back give 1 / (4 · 310 µs) = 806 samples per second per node.
Is the cable the limit?
Not through its delay. In the example the cable contributes 0.25 µs to a poll of 310 µs, less than a tenth of a percent. At 100 m it is 1 µs.
A cable limits the bit rate, not the schedule. Long cables round the edges of the bits; the usual rule of thumb for twisted-pair buses of this kind is that bit rate times length should stay below roughly 108 bit·m/s, which is 4 Mbit/s at 25 m. Below that line, with the two ends of the cable terminated in its characteristic impedance and stubs kept short, a faster cable would change nothing. Note 3 shows what happens when the termination rule is broken.
Are the transceivers the limit?
Seldom. A transceiver has a rated bit rate and enable and disable times well under a microsecond for fast parts. If the chosen bit rate is within the rating, a faster transceiver changes only the small enable share of the turnaround. The turnaround itself is mostly firmware: how quickly the node recognises the request and starts its answer.
Then what is the limit?
Usually the schedule: the rule by which the master decides when to send the next request.
The simple and robust way to write a master is a timer. Every tick, poll the next node. It is easy to reason about and it never collides. But it fixes the time of one poll to the tick, whatever the frames need.
In the example a poll needs 310 µs. A master that polls on a 1 ms tick gives each of four nodes one poll every 4 ms: 250 samples per second per node instead of 806. The line carries bits for 240 µs of every millisecond and is silent for the rest. An oscilloscope on the bus shows it at once: short bursts, long gaps.
Three more schedule effects cost rate in the same hidden way:
- A tick that is just too short. If one poll needs 310 µs and the tick is 300 µs, every poll takes two ticks. A small change in frame length can halve the rate.
- One sample per poll. If the node converts faster than it is polled, samples are lost unless the node stores them and sends several per reply.
- Waiting for the conversion. If the request starts a conversion and the node answers when it is finished, the converter’s time is inside the turnaround.
What did we find on our own bus?
While we developed our own measuring chain, the line was idle most of the time. The polling scheme capped the sample rate; the cable and the transceivers had margin. A model of the time budget, checked against the bench, put the limit in the schedule, so the remedy lies in the schedule, not in the parts.
Our standard plates state their rate with its condition: 2,000 samples per second with one or two plates on one terminal, 1,000 with three or more. The rate depends on how many plates one terminal serves.
How do you raise the rate?
In this order, because the first steps are free.
- Measure the idle time. Look at the line. If it is silent most of the time, the schedule is the limit.
- Poll back to back. Send the next request when the last reply has ended, not on a tick. Keep a timeout for a node that does not answer.
- Shorten the turnaround. Prepare the reply before the request arrives; answer from an interrupt, not from a main loop.
- Send more per reply. Let every node sample on its own clock or on a common trigger, store the samples and send a block. The sample rate is then no longer tied to the poll rate, and the frame overhead is shared between several samples.
- Shorten the frames. Binary instead of text, no fields that never change.
- Raise the bit rate only now, and only as far as the cable length allows.
The ceiling is the line itself. At 1 Mbit/s the line carries 100,000 bytes per second. With 24 bytes per sample set (payload plus overhead, example value) that is about 4,170 sample sets per second for all nodes together, at a line that is never silent. No schedule gets past that; a higher bit rate or a smaller frame does.
What are the limits of this note?
The budget assumes one master, polling in turn and no retries. Errors and repeated frames cost extra time. A bus where nodes send without being asked, in fixed time slots, has no request frame but needs a shared time base; its budget is similar with t_request = 0. And sampling instants are a separate matter: nodes that are polled one after another sample at different moments unless a common trigger starts their conversions together.
Where we fit
We design the whole chain, from the node’s front end over the bus to the terminal and the software, so the time budget is ours to write. In custom designs it reaches 6,000+ samples per second where a project needs it. If your existing sensor drops samples or runs slower than planned, Sensor Rescue finds the cause from measurements on the line; send us a scope capture of the bus.
What this means for your product
Before you buy faster parts, write the time budget of one poll and compare it with what the line shows. If your bus delivers a fraction of the rate its bit rate suggests, the cause is most often in a few lines of scheduling code. Decide early whether your sample rate should depend on the number of nodes at all. If your system already runs slow or drops samples, the next step is a capture of the line: Sensor Rescue finds the cause from it.
[1] ANSI/TIA/EIA-485-A, Electrical Characteristics of Generators and Receivers for Use in Balanced Digital Multipoint Systems, Telecommunications Industry Association, 1998.