So between having to deal with an insane work schedule and fighting with an unruly microcontroller, I’ve managed to finally digitize the output of the seismometer:
How sensitive is this geophone? To answer that, here is the same graph as above, except instead of ADC values, the y-axis now indicates velocity:
At the time, the geophone was on my desk where even a light tap will cause signal clipping (about 0.0001145 m/s). I’ve even had the geophone in another room where it picked up my foot taps, so this geophone is pretty darn sensitive!
Digitizing the analog output of the geophone is pretty simple in principle: connect the amplified geophone signal to an ADC line, make some firmware to sample at a sufficient frequency and output the results to a computer via UART. In practice however, things turned out to be more difficult than initially thought.
The Hardware
One of the reasons why digitizing the waveform was difficult was because I was dealing with a new microcontroller (uC). I decided to depart from the usual family of 8-bit uCs available and chose a 16-bit uC tailored to DSP applications, the dsPIC33FJ16GS502. I chose the dsPICs in particular because I plan on running a digital filter on the geophone signal instead of having a PC do that. Granted, it *might* be better to have the more powerful PC do it but why not see what DSP uCs are capable of?
Connected to the UART lines is the humble XBee. While I do intend on using a completely different radio (namely, this one), the XBee is a great rapid prototyping radio to use.
The Firmware
At a bandwidth of 240 Hz, the Nyquist sampling frequency for the geophone is 480 Hz. The geophone datasheet recommended a sampling time of 2 ms (500 Hz) which ended up being coded into the firmware. The ADC uses Timer 1 (set to 2 ms) to trigger the ADC conversion. The result is stored in a ring buffer. A series of UART interrupts (triggered each time a byte is sent) continuously poll the ring buffer for data availability and sends a data byte if available. Ring buffers are nice for data streams and help keep the UART and ADC separate from each other, that is, if a UART transmit instruction is called each time an ADC conversion occurs, the latency might be enough so that it could increase the sampling time, thus making the data useless for DSP stages (FFT being a major one).
Next Steps
The geophone datasheet recommends a 24-bit ADC, which translates to 13.6 pm/s per LSB (ADC step) – you read that correctly, picometres/s – at 3.3 V reference. The final circuit uses a 5 V reference, meaning 20.4 pm/s per LSB. That is a much, much finer resolution than a 10-bit ADC (the uC’s ADC) which has a 0.224 µm/s resolution at Vref = 3.3 V. Because we’re not dealing with high precision here, 24 bits is overkill and probably much more susceptible to noise but hey, why not try it out?
Other than different hardware, I will be working on the software on the PC side to display the geophone output in a graph. Later I will be working on getting the data to stream online for everyone to see.