Audio Frequency Sampling PSOC4

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

 Hi to all,

   

I want to know how to sample Audio Frequency signal ranges from 2 Hertz to 40 Hertz i.e. stereo output from laptop by PSOC4 inbuilt SAR ADC.

   

ADC output want to display on 16 x 2 LCD.

   

Stereo having 3 pins - Right, Centre and Left.

   

I need support from all of you to begin this project correctly.

   

Thanks in advance,

   

Nityam.

0 Likes
7 Replies
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Questions -

   

 

   

1) is that 2 Hz to 40 Khz ? or 40 Hz as you stated ?

   

2) What is it that you want to display on LCD ? Frequency, amplitude, other ?

   

3) Sampling rate has to be at least Nyquist, is that 2 x 40 Khz ?

   

4) Do you want to filter the audio ? If so what do you want filter to do ?

   

 

   

 

   

Regards, Dana.

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Something like this -

   

 

   

   

 

   

The Opamp can be replaced with a PGA if you need gain.

   

 

   

The mux can be replaced with a HW mux if you need it to be HW controlled rather

   

than SW controlled for channel selection.

   

 

   

Keep in mind inputs must be limited to Vdd >= Vin >= Vss

   

 

   

If you need to offset some methods -

   

 

   

www.dropbox.com/s/k1yn4m7heaixvmg/ADinput%20negative%20inputs.zip

   

 

   

Regards, Dana.

0 Likes
ToVa_285016
Level 5
Level 5
100 replies posted 50 replies posted 50 questions asked

 Hi,

   

I am not sure exactly what you are looking for, but I use the MSGEQ7 for a seven band frequency sampling for use in an equalizer.  It is very simple and powerful if that is what you need.

   

https://www.sparkfun.com/datasheets/Components/General/MSGEQ7.pdf.

   

Regards,

   

Tom

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Dear All,

   

Good morning. Sorry for delay in responding to you all.

   

1) is that 2 Hz to 40 Khz ? or 40 Hz as you stated ? Answer : yes 2 Hertz to 40 KHz.

   

2) What is it that you want to display on LCD ? Frequency, amplitude, other ? Answer : As sound signal changes frequency also get change to represent Bass, Treable etc in ADC output and in binary same i will display on 16x2 LCD.

   

3) Sampling rate has to be at least Nyquist, is that 2 x 40 Khz ? Answer : Correct PSOC4 42series have 1MSPS sampling rate from which i will use 100KSPS only which satisfy nyquist theorem.

   

4) Do you want to filter the audio ? If so what do ypou want filter to do ? Answer : no filteration required just Voltage follower for amplification is enough as per me. Advice me if filteration needed.

   

Mr. Dana what you mean by below your statement : Keep in mind inputs must be limited to Vdd >= Vin >= Vss .......

   

In sort in this project output of laptop stereo jack i want to display in binary format on 16x2 LCD.

   

Regards,

   

Naintech.

0 Likes
azcypro1
Level 3
Level 3
10 replies posted 5 replies posted Welcome!

Vdd >= Vin >= Vss  means that the instantaneous input voltage may not be above Vdd (or Vdda) or below Vss (cannot be less than zero, or negative).  Since you don't need gain, Dana wonders whether your signal is of large amplitude and where it is centered.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

May turn out to be a hard job running on a PSoC4. To extract information from the audio-stream concerning frequencies (Bass etc.) you will need something like FFT. At a data-rate of 100kHz and a 48MHz CPU clock (assuming no wait-states)  you end up in 480 instructions per data-item. This seems quite a few, but you'll have to spend some thoughts into your algorithms.

   

Since writing to LCD should occur at a rate of not more than 0.1s (or you'll not be able to read much) an approach could be to sample for a short period, calculate FFT and display the result, all withn 1/10th of a second.

   

 

   

Bob

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Here is an FFT implementation on PSOC 4.

   

 

   

japan.cypress.com/

   

 

   

Here is a mish mash of FFT stuff -

   

 

   

www.dropbox.com/s/zwtcrcqeqcm91pd/FFT.zip

   

 

   

You could look into a comb filter solution, in assembler, that might

   

have some possibility. Since you do not care about phase it could

   

be implemented in a fast IIR solution. The M0 core has a single

   

cycle multiplier in it.

   

 

   

    

   

          https://en.wikipedia.org/wiki/Comb_filter

   

 

   

Or a tunable BIQuad solution using the muliplier, the key consideration

   

(one of them) being settling time for real low freqs.

   

 

   

Regards, Dana.

0 Likes