# Multilateration with TOA using lowcost transceivers (like NRF24L01) and uCs

My problem is the following, I would like to localize an object (main node) via multilateration using a wireless sensor network of 4 nodes with less than half a meter accuracy. The equations are already worked out and what is left is to obtain distance measurements from the network nodes to the main node using TOA method (this is what I am working on right now). My hardware specifications are the as follows:

• 5 NRF24L01+ transceivers (2.4GHz, 2Mbps, GFSK, 16MHz inner clock)
• 4 ATTiny85 uC (for the wireless sensor network) (8MHz clock)
• PIC16f877A (main node) (16MHz clock)

Specifically, what I want to know is: can I measure the time of arrival of a signal (in less than a meter), with this hardware? If not, point some way out for me, either acquire new hardware (not too expensive) or change the method implemented.

PD: If possible look at the basic idea I have in mind before answering (and give me feedback on it): Narrowing down the problem time of flight between two nodes only (N1 and N2), the total time for a bit of data to go from N1 to N2 and back is: $$t = 2(t_b + t_c) = 2\left ( \frac{1}{R} + \frac{1}{c}\times d \right ),$$ where $t$ corresponds to bit transfer rate ($R$ = 2Mbps for NRF24L01+), or the time the transceiver takes to send that one bit to the channel; $t_c$ is the time in the channel that is approximately, the length of the channel over the speed of light.

The NRF24L01+ can send up to 32 bits in one go, this implies: $$t = 64(t_b + t_c) = 2\left ( \frac{1}{R} + \frac{1}{c}\times d \right ).$$ However, for $d=0.5$ (as I want) this yields $t_c = 0.106\mu s$, with a 8MHz MCU this time is invisible (1/8MHz = 0.125$\mu s$). A posibility is to resend the message to increase $t_c$ to a visible value. Is the previous reasoning accurate?

• You need a clock much faster than 16MHz. Lets be optimistic with the following assumptions: You get an interrupt on the 1st bit of a packet received, you get an interrupt on the 1st bit of the transmission. between these two signals, you need to count and compensate for processing time at the far end. – Lior Bilia Jun 30 '17 at 16:15
• Your best counter is 16MHz (again optimistic) That gives you 10m resolution, at the best case. – Lior Bilia Jun 30 '17 at 16:17
• @LiorBilia actually the ATtiny85 has an internal PLL to 64 MHz for the peripherals, but that's still orders of magnitude from sufficient. – Chris Stratton Jun 30 '17 at 22:06

Why does everyone try to do this digitally with modules NOT designed for precision timing?

Think mixers, filters and oscillators, not computer datacomms, there will probably be a computer in there somewhere but the high speed timing and phase shift measurement should be in hardware.

I would be looking at modules from MiniCircuits not Nordic.

The basic problem with your formula is that tb has nothing to do with the time of flight. The start of the transmitted bit arrives at the receiver delayed only by the speed of light, not by the bit time. The processing time of bits and messages is not related to time of flight either. So increasing the message length does nothing with regard to time of flight resolution.

If you wish to get 1/2 meter accuracy, your solution will need to resolve a delay of less than 1.67 ns. The notion of pinging a signal back and forth multiple times to reduce this burden will require that the turnaround delay on each end have a delay error orders of magnitude less than 1.67 ns. This is probably not achievable with off the shelf radio modules.

A different approach you could pursue is to triangulate on the device by using electronically steerable antennas.

Depending on what is legal (if you care) in the 2400MHz ISM band, you can implement instantaneous phase-reversals in your data-streams, generating broad-band bi-phase modulation. Mixing that 180 degree phase flip in a receiver's mixer will produce a useful reversal of sign in a differential-output mixer, but the broad-band nature of the phase flip produces a SNR problem. You can restrict the mixer's differential output using a common-mode capacitor, producing a controlled slewrate, and the greatly reduced noise bandwidth gives a greatly improved TimeJitter measurement.

But this approach requires custom design work, instead of gluing modules together.

Some RF DACs may suffice; use the DAC to produce low band (100MHz?) Biphase, then upconvert to 2400MHz.

None of the Nordic RF ICs are suitable for TOA/TDOA measurements. The best you can do with these devices is make use of RSSI (only available on some of the ICs) and even that is unlikely to provide the accuracy you desire.

For accurate positioning consider UWB hardware such as the DecaWave DW1000 (available as a module as DWM1000). The DecaWave site also has many whitepapers describing the challenges present in real-time location systems.