Electronics for Neuroscience

Clock Synchronization

Clock Synchronization in Deuteron’s Neural Loggers

Unlike other data acquisition systems, wireless loggers must operate without any connection to their host computer. This means that the logger has to have its own clock that determines the exact moment that each data measurement is made. Thus wireless loggers have a potential problem of clock drift.

Almost all the electronic equipment we use today, such as our computers, phones and watches, use quartz oscillators to keep accurate time in their internal electronic clocks. Likewise, Deuteron’s data loggers use quartz oscillators to keep time. The typical accuracy or a quartz oscillator is about 10 parts per million (ppm). This accuracy is equivalent to about one second per day, and is generally good enough for most purposes, but as will be explained, is not accurate enough for most neural logging experiments.

If we have two devices each with their own quartz clock, the drift of one clock relative to the other could be 20ppm. Can we regard a clock drift of 20ppm as negligible in a neural logger?  Very often, the answer is no.  A relative drift of 20ppm is roughly equivalent to 1 millisecond (ms) every minute. So if we have a neural recording that lasts for 2 hours, we could end up with an accumulated clock drift of about 100ms towards the end of the recording. If we are trying to relate features of recorded neural data with other events in our experiments, we typically cannot neglect timing errors of this magnitude. We therefore need either to compensate for clock drift, or preferably, to eliminate it altogether.

Earlier versions of Deuteron’s loggers provided a measurement of the clock difference between the transceiver and the logger in order to facilitate compensation of clock drift. However, when performing experiments with multiple loggers, the compensation calculations can become quite difficult. For this reason, Deuteron has devised a method for keeping the clocks of all loggers in synchrony with a sustained accuracy of around 10 microseconds (µs) over an entire experiment.

Most of our phones today automatically adjust their clocks by a few seconds every few days in order to eliminate the clock drift that accumulates in that period. However, when making a neural recording, it is clearly unacceptable to make a sudden adjustment to the clock inside a logger, because almost all data processing algorithms depend on the fact that samples are made at a uniform rate, with no sudden jumps in the measurement of time. Therefore, Deuteron’s method for keeping the clocks in synchrony cannot be allowed to make stepped adjustments of the logger’s clock. Instead, they use a very special hardware feature that is built into all of Deuteron’s loggers.

Deuteron’s loggers have a facility to adjust the rate of their clocks with a very high resolution, about one part per billion. LoggerCommand3 is the program that runs in the host computer that allows one to control Deuteron’s loggers. It replaces the older LoggerDemo program. One very important feature that LoggerCommand3 introduces is that it automatically adjusts the rate of the logger’s clock approximately once every minute. Note that it is the rate of the clock that is adjusted, not the time indicated by the clock. During a recording session, the periodic correction to the clock rate is very small, typically about 0.05ppm,  corresponding to a typical change in the rate of the quartz oscillator that results from a small change in ambient temperature. The embedded software of the logger and the LoggerCommand3 program work together to implement a special control loop that cancels the relative clock drift. This ensures that the clock drift is always maintained well below 1 ppm, and that the accumulated clock difference is generally less than one ADC sample time (about 30µs).  This allows experiments to be performed with one or several animals, and eliminates any need to compensate for clock drift in any of the recorded data.