# I need to measure the distances between several moving tags

I am working on a school project to create a warning system for bicyclists that activates when they get too close to each other. Each bicyclist should have one Decawave module on them. This module should connect to any other module that it comes in range of and repeatedly calculate the distance between them. If two bicyclists get too close, a red warning light should turn on for each of the two bicycles. The system needs to work with at least eight bicyclists communicating with each other at the same time. The system does not need to calculate direction at this point, only distance. Battery life is not a major concern at this point; a system that lasts 15 minutes would be acceptable.

I am wondering if anyone could point me towards information to help me tackle this problem. This is my first time trying to program Decawaves modules. My search for information has only lead to systems in which a single stationary anchor talks to a single mobile tag. In my case, I need to have several mobile tags and no stationary anchors.

Stationary and mobile is a matter of perspective. You only care about the distance between two points so you can pretend that one of those two points is stationary.

The simplest system would be that unit 1 acts like an anchor and measures to tags 2-8.
Unit 1 then acts like a tag while unit 2 acts like an anchor and measures to tag1 and tags 3-8.

Each unit knows when its turn to be an anchor has come based on when something lasted measured to it.

e.g. say you give each unit 100ms for it’s time as anchor.
On power up all units wait for at least 800 ms (a full cycle) before they first transmit. They then schedule their transmit times based on what they hear.
e.g. At time T unit 4 gets a measurement request from unit 1. Unit 4 now knows that the system is about half way through unit 1s turn.
It knows that it needs to wait 50ms for unit 1’s turn to finish and then 200 ms for units 2 and 3 to have their go.
So it schedules it’s turn as anchor to start at time T+250ms.
If during this time it gets other requests (from units 2 or 3) then it recalculates the required wait time based on that.
Once the wait time is over it starts its turn as anchor.

This method isn’t flexible, isn’t power efficient and the timing can get tricky if you are trying to push the update rate to the limits. But if power and update rate don’t matter too much then it is the simplest solution I can think of.

Good luck, this is not an easy project you’ve taken on. It’s certainly possible but don’t get disheartened if you hit issues or feel overwhelmed, it is not a simple system that you’re trying to build.