#qi-hardware IRC log for Sunday, 2012-12-09

wpwrakhmm. given a tiny little AVR with not a lot of memory (1 kB) and an analog signal that's somewhat periodic with period ~700 samples, but in a fairly chaotic way. (it's the output of an acceleration sensor at the of of a chain) how to detect the period ? of course the chip is far too weak for, say, fft.14:46
wpwrakactually, the data is so messy that i may even be looking at the wrong axis. checking ...14:47
whitequarkwpwrak: I'd try this:18:11
whitequarkadd a table for your estimation of what the signal could be, and then for each sample compare the value at dt corresponding with predicted period with the actual value18:12
whitequarkthen adjust predicted period with something like PID based on the error18:12
kyakwhitequark: how do you suggest to predict period?18:46
wpwrakthere's an algorithm that takes two waveform and calculates something like the integral of |f(t)-f(t+x)|, varying x over the expected range of the period. the value of x that yields the smallest difference is the period.18:46
wpwrakunfortunately, the details of the difference may be tricky (for quantization errors, etc.). and it needs to store many samples and needs lots of cycles. all things that little critter doesn't have :(18:47
kyakbasically what you are suggesting is an optimization algorithm, which finds local minimum. So you must provide a good estimation (i.e. initial value)18:52
wpwraki have a range of plausible values. the underlying movement is a rotation, and it can't be too slow (or the thing doesn't work) and there are also (human) limits to how fast you can spin it18:55
wpwrakah, and when i flip axes, things look much better :)19:07
wpwrakhere's a data set: http://downloads.qi-hardware.com/people/werner/tornado/monitor-0.bz219:13
wpwrakto visualize with gnuplot: plot "<bzcat monitor-0.bz2" with lines19:13
wpwraksample rate is 2 kHz. it's from an acceleration sensor that faces towards the center of rotation, so as centrifugal force increases, the values get smaller. 512 is 0 g, 0 is 18 g. 1023 would be -18 g.19:15
wpwrakthere are basically two regimes: smooth rotation, e.g. from 20-40k or from 80-110k where the signal is a bumpy sine wave (in an ideal world, it would of course be perfectly smooth)19:17
wpwrakwhen going fast, around 40-60k, the rotation isn't so smooth anymore because the chain "jumps". so the sinusoid is overlaid with sharp kicks19:20
wpwrakthe DC component reflects the expected centrifugal force very accurate. (from 2 Hz to 3 Hz, the ratio is about 4:9). good. i have not disproven the basic laws of physics :)19:24
wpwrakwith a bit of smoothing and tweaking: http://downloads.qi-hardware.com/people/werner/tornado/mon-clk-0.png23:04
wpwraknot the greatest clock recovery but it works reasonably well. now ... tweaking the phase ...23:05
--- Mon Dec 10 201200:00

Generated by irclog2html.py 2.9.2 by Marius Gedminas - find it at mg.pov.lt!