Measuring nanoseconds

Does anyone know of any arduino attachments
that can keep track of the amount of nanoseconds that have passed? I know that
there is the Millis() and Micros() function but I would like to have the functionality of a Nanos() function.

Thanks

Multiply micros() by 62.5

TolpuddleSartre:
Multiply micros() by 62.5

That is weird math !!

If the OP wants to measure nanoseconds, I guess that's because he needs a precision of a few nanoseconds.

With AVR arduinos clocked at 16MHz, you can't expect this precision. With an arduino DUE clocked at 84 MHz, the best you can expect is a 12 ns precision. Therefore the question is : what sort of nanoseconds precision are you looking for ?

I need to go as precise as 1 nanosecond. I know the arduino can't do it on its own, but do you know of any realtime clocks or anything that I can connect to it? I've looked but no luck.

Think a little about your problem.
A 16 MHz Arduino executes its fastest instructions in 62.5 ns.
The fastest it can respond to any external stimulus is therefore at least 62.5 ns.

If you need to record shorter times, you'll be looking at external hardware.

A better description of your problem might elicit better answers.

So, basically I am trying to get the difference in time received between 2 rf pulses from the same source. All I need is a timestamp from each in nanoseconds to be passed to the arduino. The arduino will do the math for the 2 timestamps to get the difference, that part is fine if it is slower. I did the math and as long as the receiver is more than 0.26 meters from the transmitter it won't be quicker than a nanosecond, so I don't need to worry about picoseconds.

What sort of external hardware do you mean?

To get 1 ns time resolution, you will need some pretty high end hardware for the "front end".

A programmable gate array with a clock rate of 10 GHz or higher should be serviceable.

Jimanator:
I did the math and as long as the receiver is more than 0.26 meters from the transmitter it won't be quicker than a nanosecond, so I don't need to worry about picoseconds.

Surely it's the difference in distance of the two receivers that counts not the distance from the transmitter. If the difference is always considerably greater than 0.3m then you don't need better than nanosecond resolution otherwise...

Steve

This is not a Arduino solvable problem.

Thanks for all the info. I just don't understand why if a 16 MHz clock can do 62.5 ns, why do I need to jump all the way to 10 GHz to get 1 ns?

Assuming a gate array or computer takes, say 10 processor cycles to recognize and store event times to a resolution of 1 nanosecond (1 GHz rate), then the processor clock must be at least 10 times faster.

The Arduino doesn't "do" 62.5 nanoseconds. That simply the time for one cycle of the processor clock. See above.

You can measure ~nanoseconds with arduino.
You would need an additional piece of hardware, a pulse_width ->voltage converter.

Sometimes phase differences are easier to measure than time differences. Perhaps a phase detector
could be part of the mix - but we need to know much more about the problem. For instance 2 isolated
RF pulses have very poor temporal resolution if the bandwidth is low or the signal/noise ratio is poor.

What frequency is your RF? What risetime are the pulses? What detector electronics are you using?

I suspect an X-Y problem - Further details required.

Any way an arduino isn't going to be a lot of help except as a display driver.....

Allan

GPS receivers do better than 1 ns. In a way. They receive signals of 1.5 GHz and measure difference in flight time down to a single wave, so that's less than 1 ns. Unsure what OP really tries to accomplish but it appears to be some kind of time of flight measurement.

The GPS hardware that does that is not a 5V 20MHz CMOS part! And its using correlation primarily,
ie phase measurement, not time measurement.

If you want time of flight with RF then you're asking for something like pozyx.io or one of the UWB chips
that are starting to appear.

UWB = ultra wide band, which is what you need for time of flight - narrow band has very poor time resolution
by its very nature.

jremington:
To get 1 ns time resolution, you will need some pretty high end hardware for the "front end".

A programmable gate array with a clock rate of 10 GHz or higher should be serviceable.

Ummm... I think your calculations are a bit off there

You've revived a dead thread for no reason!