This article explores the suitability of a Wii nunchuk based USB accelerometer as an earthquake sensor for the Quake-Catcher Network (QCN) project. It examines the nunchuk over several metrics: precision and range, frequency response, total cost and availability.
The Quake-Catcher Network is a collaborative initiative for developing the world’s largest, low-cost strong-motion seismic network by utilizing sensors in and attached to internet-connected computers. With your help, the Quake-Catcher Network can provide better understanding of earthquakes, give early warning to schools, emergency response systems, and others. The Quake-Catcher Network also provides educational software designed to help teach about earthquakes and earthquake hazards.
Range and Precision
QCN supports a few different USB accelerometers. The most basic one is the JoyWarrior24F8 (JW24F8), which is a 3 axis accelerometer with 10 bits of precision and a measurement range of +-2g, +-4g, or +-8g. QCN uses the +-2g range. According to WiiBrew, the Wii nunchuk’s accelerometer also has 10 bits of precision over a range of +-2g. Therefore, the nunchuk meets the first criteria for evaluating its suitability as a QCN sensor.
I don’t have access to a shake table so I’m unable to directly evaluate the frequency response of the nunchuk based USB accelerometer. However, QCN did provide me with a JoyWarrior24F8 USB accelerometer for comparison. Since the frequency response of the JoyWarrior24F8 was already deemed suitable by Prof. Cochran for QCN, I simply had to attach the JoyWarrior24F8 and the nunchuk to the same substrate, shake them by hand at various frequencies while recording data from both sensors simultaneously, and compare the Fourier transform of the nunchuk’s data to the transform of the JW24F8′s data.
Here are comparisons of an official (i.e. STMicroelectronics accelerometer) nunchuk to the JW24F8. The microcontroller code used was mega32u4_hard-i2c_no_filter.zip and the plots were made using the Octave scripts found in the code section below.
The STMicroelectronics based nunchuk appears to have a response that is very similar to the JW24F8′s response. It should be noted that I was shaking the accelerometers by hand so I don’t think I covered the entire range of frequencies of interest.
Unfortunately, there are fake (i.e. 6331 accelerometers) nunchuks that are unsuitable earthquake sensors because their accelerometer data has stuck bits. Even worse, it can be very difficult to impossible to tell if a nunchuk is official by external examination only.
The nunchuk uses I2C to transfer its data. Therefore, a microcontroller that supports USB and I2C is required to read the data from the nunchuk, filter it, and pass it to the host computer. Three different microcontrollers were evaluated: an ATmega32U2 board that supports hard USB and soft I2C, an ATmega328P with V-USB that supports soft USB and hard I2C, and an ATmega32U4 (teensy) that supports hard USB and hard I2C. The ATmega32U2 only works with 6331 based nunchuks and only at 100 kHz. The ATmega328P works with both STMicroelectronics and 6331 based nunchuks, but the two-wire interface (TWI) eventually locks up for an unknown reason. The ATmega32U4 works with both types of nunchuks tested and with no crashes observed over a two-week period. The STMicroelectronics nunchuk works at 100 and 200 kHz with hard I2C only. The 6331 based nunchuk works at 100, 200, and 400 kHz when hard I2C is used.
A Quake Catcher Kit from Saelig is $42.25 with about $12 for shipping to a U.S. residence, for a total of $54.25.
A Teensy with a 3.3V regulator and shipping costs about $22. A genuine, official nunchuk is approximately $20 shipped. A nunchuk extension cable from eBay is around $4.50. For a total price of $46.50. However, the cost of a proper mount for the nunchuk as well as the labor cost of assembly has not been included. Therefore, I believe that Quake Catcher Kit is most likely a better deal for your time and money.
The output resulting from microcontroller code that didn’t filter the accelerometer data was the most similar to the output of the JW24F8. Code that filters the accelerometer data with Chebyshev and moving-average filters is included for comparison purposes and because I’d already written it.
This code is for research purposes only; it uses an Atmel USB VID/PID pair for LUFA demos only. This code doesn’t work with QCN because the QCN software checks the joystick’s name to make sure it’s a JoyWarrior. This code can be easily made to work with QCN by modifying its USB descriptors, which I’ve done, but I won’t be releasing this code since it uses Code Mercenaries’s VID/PID. The code also checks the connected controller’s identification bytes to make sure its a genuine Wii nunchuk. It doesn’t work with fake nunchuks.