FilipDominec / rp2daq

Raspberry Pi Pico firmware for universal hardware control & measurement, along with a user-friendly Python frontend
MIT License
27 stars 4 forks source link

Sampling with two channels #21

Open AlessioCarnemolla opened 5 days ago

AlessioCarnemolla commented 5 days ago

I tried to sample two different signals with two channels (GPIO26, GPIO27) using example_ADC_async.py. One of them was linked to a Function Generator and the other was linked with a Jumper to GP2. Processing the two signals it came out they are the same signal and, doing the FFT, it shows they have same peak frequency. I didn't modify any line of the code. Is there something I have to add? How can i record two different signals precisely?

FilipDominec commented 5 days ago

Hi, thanks for reporting. I will check it on my side. But first I must ask:

  1. Did you use the stable release 0.2, or the latest github version of rp2daq?
  2. What script did you use, was it example_ADC_async.py or example_ADC_sync_plot.py or just the short snippet from the README?
  3. Are the results really 1-to-1 numerically the same (i.e. doubled values), or is there some little random difference (i.e. ADC properly sampling the same analog signal)?
  4. Is there anything else that seems weird to you, e.g. 1.0 V input voltage possibly not mapping somewhere close to values 1220-1250 at ADC?
AlessioCarnemolla commented 5 days ago

Hi, I used the latest release of rp2daq. I used the 'example_ADC_async.py' code. There are some difference between the values of the signal but the shape is the same, the mean value is almost the same and the peak frequency is precisely the same. Here the graphs and the post processing done by Matlab. Thanks a lot for your avaliability.

Figure_1 GPIO26 GPIO26FFT GPIO27 GPIO27FFT

AlessioCarnemolla commented 5 days ago

The peak Frequency of the signal is 190Hz, the frequency of the wave generated on the GP2. The Function Generator produced a wave of 20Hz. The GPIO 26 is connected with GP2, the GPIO27 is connected with the FG.

FilipDominec commented 5 days ago

Puzzling indeed.

But what you show is some 20mV pk-pk signal atop of some 80mV background - this is fairly weak. What we see may even be some voltage noise picked by disconnected high-impedance pins.

What do you get when you connect e.g. 1 V DC signal to one of the pins?

AlessioCarnemolla commented 5 days ago

Now the FG produces a wave of 17Hz Peak and 3V pk-pk on GPIO27. GPIO26 is still connected to GP2. This is what I get (peak frequency in the graphs corresponds to 17Hz). Figure_1 GPIO26 GPIO26FFT GPIO27 GPIO27FFT

AlessioCarnemolla commented 4 days ago

It seems that the code detects only one frequency from the two channel, printing one of them for both, casually. May it be a hardware problem? I tried with different jumpers.