Just thought I'd share an interesting project going on at the AGHR club here in LA with our telemetry train (now version 2.0).
Intro:
At the AGHR club in LA we've built a stock car with an RPI3 embedded host computer and a bunch of telemetry sensors which we call the "Telemetry Train". While some of the train's system are focused on troubleshooting power signals, DCS, and TMCC control signals (not the focus of this post), one of the other aspects is we've been exploring is using MEMS accelerometers to measure defects and kinks in the track rails as the train rolls along.
------------------------------------------------------------------------------------
Block Diagram of Telemetry Train's Motion Processing
------------------------------------------------------------------------------------
To implement the motion tracking we use a raspberry Pi3 Computer (features the Broadcom ARM BCM2837) powered by a small Lithium Ion Battery. We leverage the AXDL 337 motion sensor from analog devices to do the actual sensing of motion: ADXL337 and then read it's analog outputs with a high speed delta-sigma ADC (typically running 50-100 Hz). Generally you want good dynamic range for motion capture applications which is why a high resolution ADC is necessary, so we went with a nice MCP3424 from Microchip (http://www.microchip.com/wwwproducts/en/MCP3424) that has about 80 dB of spur and distortion free dynamic range. The MCP also has an I2C bus so it's very easy to interface with the Pi3.
As you can see in the setup picture, we have the AXDL MEMs sensor tucked into the wheel truck of the stock so that any of the bumps we hit along the layout are captured.
Capture Software:
Software wise we just have a C script that reads the I2C bus at 60 Hz or so and writes down the X,Y and Z acceleration from each sample into a csv file. The script needs to be simple in order to support the fastest possible sample rate, so it's not even conditional, we just have a for loop that runs for n increments and we tune n based on the layout length and sample rate. Samples are loaded into a large array of doubles, and then the entire array is written at the end (again file ops on each loop would be too slow for 60 Hz sampling).
Back end Signal Processing:
Finally we drag that csv into matlab and just do a vector magnitude calculation R = sqrt (X^2+Y^2+Z^2) and do some basic linear scaling from the sensor datasheet to get the true force in Newtons. The timescale is also pretty trivial, we just scale the axis by the sample rate.
In general MEMs data is noisy, so we apply a smoothing function and just tune the span (typically we use 3-5 point span). On one hand you want to capture the violent discontinuities, but on the other you don't want to have to physically investigate every peak in 5 min of data sampled at 60 Hz. Additionally in matlab we wrote an .m script to auto align track data from multiple passes (basically a maximum cross correlation vs. time shifting function) so that we can do some basic statistics. We then adjust the confidence interval (a given feature has to show up in n out of m track traces in order to be considered a real track issue). This dramatically cuts down on the false alarms and reduces time inspecting the track.
------------------------------------------------------------------------------------
Trial Run in the Lab Environment
------------------------------------------------------------------------------------
As a first test we ran the train over the same section of track twice in the lab when pulled by a locomotive at 5 SMPH. In the first pass the track was normal, while in the second pass a gap of 1mm was intentionally created to show the sensitivity of the sensor. As seen in the data the MEMs sensor captures the vibration with a large force vector magnitude as the wheel truck encounters the discontinuity, and the oscillations as the train resumes its rest position is also visible.
------------------------------------------------------------------------------------
Trial Run on the Layout
------------------------------------------------------------------------------------
Finally we ran the telemetry train around the club layout (takes 5 min and 29 seconds per pass) and collected 4 sets of data over 4 passes. This data was collected at a much higher speed of 34 SMPH, (I plan to investigate the effect of speed on the system sensitivity later on). Of course a large layout has vibration and bumps from track switches, so the first step was to mark those onto the captured data traces. The remaining peaks in force magnitude are then investigated physically (time correlates to train position in the layout). What we do is take a photo of where the train is at 0,30s,60s,... and use that to know what section of the layout the data corresponds to. We then evaluate kinks or other discontinuities in the rails and make repairs as necessary.
Overall it's a pretty elegant way to manage a large layout. One of the next steps I want to look at is having multiple telemetry trains coordinate to reduce the acquisition time at slow speeds through large layouts. This is mostly just more DSP work to correlate end-points and stitch the data.
Anyways hope someone finds this interesting!
Adrian J Tang