Go Down

### Topic: Measuring nanoseconds  (Read 8737 times)previous topic - next topic

#### Jimanator

##### May 07, 2018, 07:36 am
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

#### TolpuddleSartre

#1
##### May 07, 2018, 09:11 am
Multiply micros() by 62.5

#### ard_newbie

#2
##### May 07, 2018, 01:04 pm
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 ?

#### Jimanator

#3
##### May 08, 2018, 12:07 am
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.

#### AWOL

#4
##### May 08, 2018, 12:17 am
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.

#### Jimanator

#5
##### May 08, 2018, 02:21 amLast Edit: May 08, 2018, 04:52 am by Jimanator
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?

#### jremington

#6
##### May 08, 2018, 04:45 amLast Edit: May 08, 2018, 04:47 am by 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.

#### slipstick

#7
##### May 08, 2018, 01:53 pm
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

#### larryd

#8
##### May 08, 2018, 09:22 pm
This is not a Arduino solvable problem.

No technical PMs.
If you are asked a question, please respond with an answer.
If you are asked for more information, please supply it.
If you need clarification, ask for help.

#### Jimanator

#9
##### May 08, 2018, 11:54 pm
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?

#### jremington

#10
##### May 09, 2018, 12:17 amLast Edit: May 09, 2018, 12:22 am by jremington
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.

#### pito

#11
##### May 29, 2018, 10:29 pm
You can measure ~nanoseconds with arduino.
You would need an additional piece of hardware, a pulse_width ->voltage converter.

#### MarkT

#12
##### Jun 07, 2018, 09:30 pm
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.
[ I DO NOT respond to personal messages, I WILL delete them unread, use the forum please ]

#### allanhurst

#13
##### Jun 26, 2018, 01:00 am
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

#### wvmarle

#14
##### Jun 28, 2018, 12:54 pm
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.
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

Go Up