Hello, I am trying to capture the analog signal from two pins.
From one channel, I could get a signal with up to a 2kHz sampling rate.
However, the problem is, I couldn't see the clean signal if I added one more channel.
The sampling rate that I can make from 2 channels was about 50~100Hz.
If I make a higher sampling rate, I can see the ruined signal.
So from the 2-channel recording, when I set the sampling rate as 50Hz and see the data after recording, the frequency looks fine (not for the shape of the signal but frequency looks fit).
However, if I set the sampling rate as 500hz, 1khz, and 2khz, I should set the sampling rate as around 200Hz on Matlab when I recover the signal to see the frequency correctly.
What I am guessing here is since recording with a specific sampling rate is essentially dividing the clock with a certain ratio, this could result from a mismatch of the timing of the signals being recorded. This leads to the loss or corruption of some parts of the signals, causing poor signal integrity.
So issue with the poor signal integrity that I am observing might be due to the timing of the shifting analog input pins when recording signals from multiple channels.
Do you think this makes sense?
Is there any idea to fix my situation?
This is the main code that I used to record the signal with one analog channel.
and other codes that handle recording and Bluetooth communication or extra setting
and the code that I changed to make 2 channel recording
Do you think there is any line that has to be fixed or a suggestion so that I can make 2 channel recording with a 1kHz sampling rate?
The image of the channel recorded signal is below (they suppose to be s perfect sine wave)
Please let me know if there is something else I can provide to fix this...
Or there is any codes or samples that I can make as references.