A Little Shake of Pepper (what is a nanosecond)

My mentor, Mike, had so much to teach me. Coming from University, I knew I was the best programmer on campus and better than anybody I had met.

That changed the day I met Mike. After being introduced to him, I went to my boss and said something like, “That is the most arrogant man I’ve ever met.”

Greg replied, “He’s earned it.”

When I had an opportunity to work with him, I found that yes, he was that good.

He was the first person to stretch my abilities in computer science. I will forever be thankful to him for that.

He had the privilege of meeting Admiral Grace. He was one of the many that were handed her “packet of Nanoseconds”.

This was Grace’s way of getting across to people just how fast computers were running.

In 1 ms, light will travel 299.79 meters. This is a reasonable rifle shot.

In 1 us, light will travel 0.2998 meters (299.8mm), or about 1.2 inches.

In 1 ns, light will travel 0.2998 mm. This is about the size of a single grain of ground pepper.

Just how fast?

My Cray X-MP/48 had a memory bank cycle time of 38ns. This means that light would be able to travel about 10mm or a little less than 0.5 inches.

My memory said that we had a 85ns wait time from accessing memory to having loaded that word into a register.

Your PC likely runs faster than that X/MP. It surely has more memory.

Frames of Reference

As stated above, my world was baby sitting a Cray Super Computer. We worked in nanoseconds. We were trying to optimize code to shave a few nanoseconds out of a loop.

Saving grains of pepper.

When I purchased some study lights for doing photoshoots, I didn’t buy the fancy radio controllers. Instead, I bought “slave” style lights.

With the slave style, you could tell your study light to fire when it detected the flash of another strobe.

Before I purchased these study lights, I went to Mike with concern. I had done the math.

From the moment my flash fired, a long sequence of things had to take place. The light had to travel from my strobe to the detector on the study light. There was a delay while the photoreceptor energized and “fired”. There was still more time as that signal propagated through the circuitry, and finally that light would fire.

My studio lights would be at different distances, we couldn’t even predict the sequence that they would fire.

According to my simple calculations, we could be talking as much as 2ms from the time my light fired until the last study light fired.

Mike pulled me back to the ground. My shutter speed would be set to 1/60 of a second. That is 16.6ms. If the study lights fired anytime while the shutter was open, I would get a good photo.

I was so focused on my reference frame, nanoseconds, I lost sight of the real-world application that was running in 10s of milliseconds.

pkoning Brings Reality to the Clocks

Here is the magic of GPS. It works by knowing the time and then calculating the distance to different satellites.

The more accurate the clock, the more accurate the location.

Communicating that time to an external device is where it gets interesting. The definition of NMEA tells use exactly when the second mark occurs during the transmission of the NMEA message.

Most GPS units default to transmitting at 9600 baud. Which for us is the same as 9600 bits/second. Each 8 bit byte sent requires start and stop bits. My rule of thumb is 10 bits per byte.

This means that it takes around 83ms to transmit one 80 character NMEA sentence from the GPS to the computer.

The instant when the second starts aligns with the edge of a signal of one of the characters in that sentence.

Now my issue was that I thought that the GPS unit had time that was “wrong” it was offset from the real world.

This is not the case. The real reason for the delay is in the time it takes to process the sentence. That should be fixed to the computer, not to the GPS unit.

Which brings us to PPS, or Pulse Per Second. This is a signal that indicates the start of a second. Depending on the GPS unit, this can be at ns accuracy. Even cheap units will get you sub us accuracy.

The processing time to handle the pulse is much lower than to handle a full NMEA sentence.

A PPS can be treated as the “real” time, without fear of being too far away from reality.

A couple of grains of pepper.


Comments

2 responses to “A Little Shake of Pepper (what is a nanosecond)”

  1. dittybopper Avatar
    dittybopper

    Check your math: .299 meters is (whips out slide rule) about 11.7 inches, just under a foot.

    There are roughly 39.4 inches in a meter, so 39.4 * .299 = ~11.8 inches.

    There are also 2.56 centimeters per inch, so 29.9 / 2.56 = ~11.7 inches.

    Difference is because of imprecision of the slide rule and using approximations memorized.

  2. pkoning Avatar
    pkoning

    You misplaced a factor of 1000 there.
    I remember Grace Hopper’s presentations. (There’s an extended version of it, held at NSA, on YouTube.) In the one I attended at DEC in the 1980s, she didn’t hand out bags of pepper. She did hand out foot-long pieces of wire: those are nanoseconds. A spool of about 1000 feet is a microsecond. A grain of pepper is a picosecond.
    In fiber optics, given the medium (glass not air) you’re looking at 5 nanoseconds per meter, not 3.
    Similarly, in the slave flash case you were dealing with transit times of a fraction of one or two dozen nanoseconds, max. Entirely negligible compared to the time for flash electronics to react to the trigger signal and actually produce the discharge in the flash tube.

    By the way, on GPS: typically the time message you receive gives the time as of the just-preceding PPS pulse. That’s for the common case of one time message per second. When precisely during the period after the PPS the message is generated isn’t necessarily well controlled. If you want good to a second timing, that’s not an issue. If you want better than a millisecond, I would think you need to use the PPS signal. With that, you know seconds start at the PPS leading edge, and what second that was you’re told in the time message received shortly afterwards.

Leave a Reply

Your email address will not be published. Required fields are marked *