wpwrak | hmm. 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 |
---|---|---|

wpwrak | actually, the data is so messy that i may even be looking at the wrong axis. checking ... | 14:47 |

whitequark | wpwrak: I'd try this: | 18:11 |

whitequark | add 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 value | 18:12 |

whitequark | then adjust predicted period with something like PID based on the error | 18:12 |

kyak | whitequark: how do you suggest to predict period? | 18:46 |

wpwrak | there'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 |

wpwrak | unfortunately, 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 |

kyak | basically 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 |

wpwrak | i 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 it | 18:55 |

wpwrak | ah, and when i flip axes, things look much better :) | 19:07 |

wpwrak | here's a data set: http://downloads.qi-hardware.com/people/werner/tornado/monitor-0.bz2 | 19:13 |

wpwrak | to visualize with gnuplot: plot "<bzcat monitor-0.bz2" with lines | 19:13 |

wpwrak | sample 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 |

wpwrak | there 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 |

wpwrak | when going fast, around 40-60k, the rotation isn't so smooth anymore because the chain "jumps". so the sinusoid is overlaid with sharp kicks | 19:20 |

wpwrak | the 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 |

wpwrak | with a bit of smoothing and tweaking: http://downloads.qi-hardware.com/people/werner/tornado/mon-clk-0.png | 23:04 |

wpwrak | not the greatest clock recovery but it works reasonably well. now ... tweaking the phase ... | 23:05 |

--- Mon Dec 10 2012 | 00:00 |

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