0
\$\begingroup\$

I wan't to read a signal using my Arduino Pro Micro. The signal is produced from a sound file on my phone, the output from the phone passes through an offset circuit to lift it to be read by the Arduino. My Arduino is set to sample at 200Hz (fixed), but my audio signal has a 1000 Hz sampling frequency. How is reading the 1000 Hz signal using 200 Hz sampling frequency going to affect my data? I've noticed that the time measurement is out of order (1000 samples don't mean 5 secs anymore from the received data from Arduino). Can someone help me understand this point?

My signal's max frequency is 80 Hz, so I think 200 Hz is okay. My concern is the received sampling frequency. I send the time of the sample with every sample so that I verify the sampling frequency. When I used real sensors with this same Arduino and 200 Hz fs, I got the right fs received, but know it's different. I mean 1000 samples should have 5 seconds worth of data if fs=200 Hz but I got 2.558 seconds. That's what I need to understand.

Thanks

\$\endgroup\$
9
  • 8
    \$\begingroup\$ You're going to have major aliasing problems. You generally need to sample at twice the rate of the highest frequency in the signal \$\endgroup\$
    – Makoto
    Commented Apr 17, 2017 at 9:45
  • 1
    \$\begingroup\$ What kind of signal you are generating with your phone? \$\endgroup\$ Commented Apr 17, 2017 at 9:46
  • 2
    \$\begingroup\$ Why not just pass the data to the Arduino instead of doing analog conversion in the middle? \$\endgroup\$ Commented Apr 17, 2017 at 10:53
  • 1
    \$\begingroup\$ If you can ensure that the signal is band-limited to < 200 Hz (i.e. your signal is between 950-1050 Hz), you can theoretically construct the signal when sampled at 200 Hz. However, that may be more in-depth DSP than you want to get into. \$\endgroup\$
    – uint128_t
    Commented Apr 17, 2017 at 15:46
  • 1
    \$\begingroup\$ "1000 samples should have 5 seconds worth of data if fs=200 Hz but I got 2.558 seconds." - that makes no sense. The Arduino will 'record' the analog signal at whatever sampling rate it is set to. If you record for 5 seconds you must have 5 seconds worth of data! So either it wasn't recording at 200Hz, or some of the data has gone missing. \$\endgroup\$ Commented Apr 18, 2017 at 6:38

1 Answer 1

3
\$\begingroup\$

How is reading the 1000 Hz signal using 200 Hz sampling frequency going to affect my data?

Unless the bandwidth of the data is really really low compared to the sampling frequency, it is most likely going to destroy the integrity of the data.

As Makato said in the comments, you need to sample at at least twice the frequency of the highest frequency in the signal. So if your 1000 Hz signal has data at 1000 Hz, you need to sample it at at least 2000 Hz.

However, if your audio signal's sampling rate is unneccesarily high - in your case by a factor of 10 compared to the highest data-carrying frequency in the signal - you might be in luck.

See Nyquist–Shannon sampling theorem for a less simplified explanation.

\$\endgroup\$
4
  • 2
    \$\begingroup\$ Tbf... Unless the signal is perfectly band-limited (ie possible...) You want to sample at 10x. Read Nyquist theorem again \$\endgroup\$
    – user16222
    Commented Apr 17, 2017 at 12:31
  • \$\begingroup\$ Yes my frequencies are at most 160 Hz, so 200 is okay. I tried it with real sensor data (breathing and heartbeat) and it was working. But when recorded data is used (we don't have the right subject at the moment) the time vector is now different. I'm sending the time with each sample to make sure that the sampling frequency is correct and to display it. Now 1000 samples should give 5 secs if fs=200 Hz, instead it's 2.558 secs, that's what I'm trying to understand, so I related it to the different original fs \$\endgroup\$
    – Isra
    Commented Apr 18, 2017 at 4:08
  • 1
    \$\begingroup\$ @Isra your frequencies are at most 160 Hz so 200 is not okay because 200 is not at least twice 160. It won't work and you won't be able to get it to work. \$\endgroup\$ Commented Apr 18, 2017 at 4:17
  • \$\begingroup\$ I'm sorry I meant 80 Hz, so 160 is (2*80) my max, I'll fix it in the question. \$\endgroup\$
    – Isra
    Commented Apr 18, 2017 at 4:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.