Page 1 of 1

Measuring relative timing/phase of fast analog signals

Posted: Sat Mar 31, 2018 3:29 pm
by pythoncoder
I've raised a PR which adds this capability to the firmware, and also written a guide to how to install and use the patch (follow the link in the README). A phase sensitive detector is described with a guide to the theory of operation and a code sample.

I am intrigued by the application possibilities of this. I'm already using it in my electrical network analyser to measure the relative phase of sinewaves up to 36KHz. This can be done with about 10° accuracy at that frequency. Other applications that have struck me as interesting are ultrasonic range finders and sonars, but I'm sure there are numerous other uses.

Firmware V1.9.4 includes this patch.

Posted: Sun May 13, 2018 6:05 am
by pythoncoder
The ADC now supports read_timed_multi enabling multiple ADC instances to be read on each timer tick almost simultaneously (the gap between readings is about 1.8μs).

With compensation for this gap, accurate (on the order of +-5°) phase measurements can now be performed on signals up to 50KHz. See this guide to quadrature phase detection.

Re: Measuring relative timing/phase of fast analog signals

Posted: Mon Nov 19, 2018 6:40 am
by Kip
Hi,

I'm a little lost on how to install the patch so I can use read_timed_multi() on pyboard v 1.1. I clicked the link to the guide and couldn't find it. Could you please point me in the right direction?

Thanks,

Kip

Re: Measuring relative timing/phase of fast analog signals

Posted: Mon Nov 19, 2018 6:45 am
by pythoncoder
This was incorporated into mainline some while ago: I suggest you flash the current firmware build.

Code: Select all

MicroPython v1.9.4-479-g828f771 on 2018-08-20; PYBv1.0 with STM32F405RG
Type "help()" for more information.
>>> from pyb import ADC
>>> a = ADC(1)
>>> dir(a)
['__class__', 'read', 'read_timed', 'read_timed_multi']
>>> 

Re: Measuring relative timing/phase of fast analog signals

Posted: Mon Nov 19, 2018 7:16 am
by Kip
Ah, great. Updating the firmware was very easy!

https://github.com/micropython/micropyt ... are-Update

Thanks!