Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sampling with two channels #21

Open
AlessioCarnemolla opened this issue Nov 20, 2024 · 10 comments
Open

Sampling with two channels #21

AlessioCarnemolla opened this issue Nov 20, 2024 · 10 comments

Comments

@AlessioCarnemolla
Copy link

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
Copy link
Owner

FilipDominec commented Nov 20, 2024

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
Copy link
Author

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
Copy link
Author

AlessioCarnemolla commented Nov 20, 2024

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
Copy link
Owner

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
Copy link
Author

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
Copy link
Author

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.

@FilipDominec
Copy link
Owner

I am very busy now, but I will try to replicate & fix it until Friday. Thanks for understanding.

@AlessioCarnemolla
Copy link
Author

Thank you a lot, for your avaliability.

@FilipDominec
Copy link
Owner

Hi, so I confirmed example_ADC_async.py works exactly as expected with the fresh firmware from git. Here is the tested device with a simple low-pass filter for making a nice example waveform (2kΩ resistor from GPIO2 to GPIO26, and 1μF capacitor from GPIO26 to ground). GPIO2 has a ~160Hz PWM output just for demonstration.

20241129_114723
snap_rp2_pwm

@FilipDominec
Copy link
Owner

Since you are using the previous release 0.2.0, I downgraded the firmware and run a similar script from the release's directory. And I got basically the same result. I guess there might be some hardware trouble with your device?

snap_rp2-0_2_0_pwm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants