Netduino Plus V1 Clock Accuracy vs. NTP

The Quakezure client application needs a reasonably accurate clock for time stamping the arrival of P-waves and S-waves (P waves travel at 2000-8000 m/sec so a couple of seconds can make a significant difference).  A GPS unit would provide a very accurate reference but it adds significant cost. For example the SeeedStudio GPS twig costs USD39.90 which is roughly 1/3 of the current BoM. The QuakeZure device (or separate GPS unit) would also need to be installed where it could receive information from the GPS satellite constellation. .

In New Zealand the Measurements Standards Laboratory which is part of Industrial Research Limited (a Crown Research Institute) offers public SNTP & NTP services. Using a tiered SNTP approach looked like a cost-effective alternative to GPS for internet connected devices. I started with a ping on my ADSL connection to see what the connectivity with MSL was like (will be much slower on cellular, have seen approaching 10x slower on 2G GPRS)

Ping statistics for     Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds:     Minimum = 33ms, Maximum = 33ms, Average = 33ms

I then wrote a quick ‘n dirty .NetMF console application which used a configurable (default 10mins) timer to regularly compare the current device time with the IRL time and display the difference. I wanted to see what the jitter was on the NTP request and how accurate the N+ on board clock was.

Current Time 12-12-16 06:45:00.09 Duration 43mSec Difference 0 mSec
Current Time 12-12-16 06:55:00.09 Duration 44mSec Difference 86 mSec
Current Time 12-12-16 07:05:00.09 Duration 44mSec Difference 174 mSec
Current Time 12-12-16 07:15:00.09 Duration 44mSec Difference 262 mSec
Current Time 12-12-16 07:25:00.09 Duration 44mSec Difference 349 mSec
Current Time 12-12-16 07:35:00.09 Duration 45mSec Difference 437 mSec
Current Time 12-12-16 07:45:00.09 Duration 44mSec Difference 524 mSec
Current Time 12-12-16 07:55:00.09 Duration 44mSec Difference 611 mSec

After running for an hour the N+ clock was just over half a second out, which equates to roughly 12.5 seconds a day so I then did some digging and found I was not alone.

Need to look at how often I should adjust the device time back into sync with the back office without generating to much NTP traffic.

MMA7660FC & ADXL345 I2C Accelerometer read rates

Based on this USGS information I need to ensure a sufficiently high sampling rate to ensure the data collected is useful. Most earthquake waves appear to have a frequency of < 20Hz so taking Nyquist in account I need to be sampling at least at 40Hz.

In a tight loop doing nothing but communicating with the accelerometer I read X,Y & Z acceleration values then averaged the results over 10 lots of 10000 readings.

MMA7660FC – 6 bit acceleration value in 1 byte for each axis 650 RPS.

ADXL345 – 10 bit acceleration value in 2bytes for each axis 435 RPS

Netduino Plus using a SeeedStudio Grove Base ShieldMMA7660FC twig & ADXL345 twig.

The devices also have configurable acquisition rates & in some cases FIFOs for queuing readings which I need to look at some more

Accelerometer Evaluation Process

Two Analog devices ADXL345 Twigs from Seeedstudio arrived today. These offer much better sensitivity than the MMA7660FC Twigs that I have been using. The MMA7660 has a 6 bit 2’s complement output for X,Y & Z acceleration whereas the ADXL has 10 bit resolution in the +-2G range which I would be using.

I have also ordered a couple of MMA8451Q Accelerometer breakout boards from a vendor in China. These have a 14 bit accuracy and have a low noise mode which looks promising. The low noise mode requires a bit more power but for a non mobile application this shouldn’t be an issue.

Earthquake Early Warning system in Japan

After some quality google time I found this article published on the American Geophysical Union (AGU) from 2008 which discusses how such an Earthquake Early Warning (EEW) system could work, and other issues such as the performance limitations based on the size of the sensor array.

Now I think it’s time to install streaminsight and see what how good a proof of concept I can build to validate my backoffice approach.

MEMS Accelerometers – Issues

The BMA180 looked ideal with good sensitivity etc. but I was wondering why the Bosch accelerometer page only had a flyer and no data sheet.

The device has been discontinued so I need to do further research. I think the Kionix KXCJ9 or Freescale MMA8451 are worth a look

Also considering an integrated Gyroscope + Accelerometers device like the InvenSense MPU 6000 series and only using the accelerometers.

MEMS Accelerometers – Options

Have ordered an Analog Devices ADXL345 Seedstudio twig and the specs look positive.

Next range of sensors to look at is from Bosch (BMA180 most probably) I’ll have to see what I can get on a breakout board, but I will most probably need a logic level convertor as well.

Seeedstudio have a wish list might see if I can get them interested….

Need to do this without blowing the toys budget as I paid provisional tax tonight

MEMs Accelerometers – Trade offs

Spending a lot of time looking at consumer, industrial & military grade accelerometer specification sheets to see what is available/suitable. As soon as I go beyond strong motion & early warning objectives the accelerometer device cost gets prohibitive. Though, I might buy a couple of the more expensive sensors and look at providing optional driver support for them.

I have been looking mainly at I2C connected devices so that I can avoid dealing with Analog to Digitial converters etc. Might have to buy an analog device like the ADXL335 and and see how well it works with the processor boards I am planning to use.The I2C interface may have some limitations for maximum sampling speed but the onboard queues in some of the devices look useful.

I have been using a SeeedStudio Grove twig based on the Freescale MMA7660FC but they also have another twig based on the Analog Devices ADXL 345 and I will include a couple in my next order. Looking for a daughter board based on the ADXL103 single axis or ADXL203 dual axis device.

Other wildcard ideas include DIY seismometer project

QuakeZure – Elevator pitch

Over the last couple of years my home town of Christchurch has been badly damaged by a series of earthquakes. The Alpine Fault which runs along the Southern Alps is due to rupture anytime. The impact of the Alpine Fault rupturing on the Otago region is discussed here. Based on the Christchurch experience even 10’s of seconds of warning could save many lives.

An earthquake consists of P-Waves & S-Waves which travel at 2-8 km/s (S-Waves travel at roughly 60% the speed of P-Waves) so by using complex event analysis software running in the cloud and a dense array of commodity sensors it should be possible to provide 10’s of seconds warning depending on how far away the epicentre is located.

My TechEd 2012 presentation demonstrated a proof of concept of how you could use commodity embedded hardware & cloud computing resources to provide early warning of earthquakes.

In my presentation I talk about how a dense network of sensors could be deployed by using ADSL cabinets, cell sites, police stations, telephone exchanges etc. (basically anywhere with robust power and communications)In addition, private individuals could contribute by hosting devices in their homes, like the Quake Catcher Network.

There are already systems available for providing early warning, including at least one locally developed one. But, in a country like New Zealand where population density is low getting a sufficiently dense network of conventional seismic grade sensors would be expensive.

I’m not a Seismologist and I’m struggling to find one who has the time to listen, but I think the problem is solvable by using existing technologies in new and innovative ways.

It wouldn’t take a lot of cash to build a working prototype and deploy some units into the field. Other developers and Microsoft have offered development and cloud computing resources. I just need a seismologist to help with the validating the algorithms and approach.

So if you know a seismologist who could help…

Quakezure device

This is the prototype QuakeZure device for detecting P-Waves and notifying Azure backoffice.

The kit cost about USD 120 and would get cheaper in quantity. Organisations like Seeedstudio can take a concept built with the Grove prototyping kit I used and organise production engineering of a real product from a concept if volumes are sufficient.

Netduino Plus USD 57.95
Grove Base shield USD 9.90
Grove Accelerometer USD 12.90
Grove GPS USD 39.90

I have been looking at other MEMS devices from Freescale,  ST MIcroelectronics, Analog devices, Memsic  plus a few others. The key issue is that as soon as you go beyond consumer grade accelerometers the price rapidly rises to several times the cost of the rest of the kit.

For a production system you would most probably use something like GHI G120 Module USD37.39 with a custom board with the necessary power supply, connectivity & sensors mounted on it.

PoC QuakeZure Client on my desk