Author Topic: low pass filter for SPWM speech synthesiser  (Read 2767 times)

0 Members and 1 Guest are viewing this topic.

Offline hussamaldeanTopic starter

  • Supporter
  • ****
  • Posts: 266
  • Country: iq
low pass filter for SPWM speech synthesiser
« on: October 26, 2018, 09:27:05 am »
Hi all,
I am currently building arduino based speech synthesiser and the results are perfect. however, I am having issues with low pass filter for such application and designing class d audio amplifier
which approach shall I use ?
passive or active LPF ?
DIY class D or just buy a pre-made one ?

looking forward for your help :D
 

Offline hussamaldeanTopic starter

  • Supporter
  • ****
  • Posts: 266
  • Country: iq
Re: low pass filter for SPWM speech synthesiser
« Reply #1 on: October 28, 2018, 06:19:53 am »
up up up
 

Online Buriedcode

  • Super Contributor
  • ***
  • Posts: 1685
  • Country: gb
Re: low pass filter for SPWM speech synthesiser
« Reply #2 on: October 28, 2018, 06:01:48 pm »
I think the reason you don't have any replies is lack of info.

LPF for PWM - audio or otherwise generally depend on the requirements.  Bit depth, sample rate, PWM frequency, "acceptable" noise, cost, PCB area etc...  Simply saying "what LPF do I use?" is like asking "what circuit do I use for audio?".

The first few hits from google:

http://ww1.microchip.com/downloads/en/appnotes/00538c.pdf
http://www.ti.com/lit/an/spraa88a/spraa88a.pdf
https://www.allaboutcircuits.com/technical-articles/low-pass-filter-a-pwm-signal-into-an-analog-voltage/


Edit: I'll add that one trick I've used many times is to use two PWM modules (driven by the same counter, same resolution) to split the resolution across two waveforms and mix the two with resistors.  This means you can get 12-bit resolution, with two 6-bit PWM's, meaning each can run 2^6 = 64 times faster.  This pushes up the PWM frequency giving greater attenuation for a given filter - or relaxing the filter requirements meaning a 2nd order sallen key  with a dual opamp is generally fine.
« Last Edit: October 28, 2018, 06:08:53 pm by Buriedcode »
 

Offline hussamaldeanTopic starter

  • Supporter
  • ****
  • Posts: 266
  • Country: iq
Re: low pass filter for SPWM speech synthesiser
« Reply #3 on: October 29, 2018, 05:34:29 am »
I think the reason you don't have any replies is lack of info.

LPF for PWM - audio or otherwise generally depend on the requirements.  Bit depth, sample rate, PWM frequency, "acceptable" noise, cost, PCB area etc...  Simply saying "what LPF do I use?" is like asking "what circuit do I use for audio?".

The first few hits from google:

http://ww1.microchip.com/downloads/en/appnotes/00538c.pdf
http://www.ti.com/lit/an/spraa88a/spraa88a.pdf
https://www.allaboutcircuits.com/technical-articles/low-pass-filter-a-pwm-signal-into-an-analog-voltage/


Edit: I'll add that one trick I've used many times is to use two PWM modules (driven by the same counter, same resolution) to split the resolution across two waveforms and mix the two with resistors.  This means you can get 12-bit resolution, with two 6-bit PWM's, meaning each can run 2^6 = 64 times faster.  This pushes up the PWM frequency giving greater attenuation for a given filter - or relaxing the filter requirements meaning a 2nd order sallen key  with a dual opamp is generally fine.
thank you for ur feedback
the SPWM frequency is about 64KHz and when I am using 20KHz LPF either RC or LC, the output remains zero and there is no analog value at all(Confirmed by oscilloscope and multimeter )
also, I tried active LPF with same results and I am feeling hopeless for this project despite when using loud speaker made by JBL the sound is perfect with little noise due to SPWM
I am thinking about using it to validate the results before moving to create Class D audio Amplifier

thx in advance
 

Online Buriedcode

  • Super Contributor
  • ***
  • Posts: 1685
  • Country: gb
Re: low pass filter for SPWM speech synthesiser
« Reply #4 on: October 29, 2018, 08:55:25 pm »
Post a schematic of what you're using. It's hard to know what you're doing or whats wrong without a schematic of your setup.
 

Offline hussamaldeanTopic starter

  • Supporter
  • ****
  • Posts: 266
  • Country: iq
Re: low pass filter for SPWM speech synthesiser
« Reply #5 on: October 31, 2018, 06:39:00 am »
Post a schematic of what you're using. It's hard to know what you're doing or whats wrong without a schematic of your setup.
Here is the schematics
I am not sure about the values of the L&C for the LPF



Vcc of the speaker is 12V
 

Online Buriedcode

  • Super Contributor
  • ***
  • Posts: 1685
  • Country: gb
Re: low pass filter for SPWM speech synthesiser
« Reply #6 on: October 31, 2018, 07:18:06 am »
Ahh so tahts a pure class D. 

I'm confused, you said you wanted to "validate results before moving to a class D amp" yet you're posted a class D amp.  I thought you meant you had prototyped an active LPF (or passive!) and you had no output form it.  Is this schematic that has no output?  Those are quite beefy MOSFETs, what kind of audio output power are you aiming for?

Sorry for the questions, but I don't understand exactly what the problem is (could be a language thing, could be I'm just dense today).
 

Offline hussamaldeanTopic starter

  • Supporter
  • ****
  • Posts: 266
  • Country: iq
Re: low pass filter for SPWM speech synthesiser
« Reply #7 on: October 31, 2018, 07:26:00 am »
Ahh so tahts a pure class D. 

I'm confused, you said you wanted to "validate results before moving to a class D amp" yet you're posted a class D amp.  I thought you meant you had prototyped an active LPF (or passive!) and you had no output form it.  Is this schematic that has no output?  Those are quite beefy MOSFETs, what kind of audio output power are you aiming for?

Sorry for the questions, but I don't understand exactly what the problem is (could be a language thing, could be I'm just dense today).

I am using the following topic from instructables 
https://www.instructables.com/id/DIY-Class-D-Audio-Amplifier/

the LPF filter circuit is just traditional one and the input is connected to the arduino and the output is connected to JBL speaker and oscilloscope
 

Online Buriedcode

  • Super Contributor
  • ***
  • Posts: 1685
  • Country: gb
Re: low pass filter for SPWM speech synthesiser
« Reply #8 on: October 31, 2018, 09:36:40 am »
the LPF filter circuit is just traditional one and the input is connected to the arduino and the output is connected to JBL speaker and oscilloscope

This is what I'm asking about.  What LPF? a simple RC? opamp active?  Your previous schematic had the Arduino directly driving a class D amp, with a passive LC filter on the output for  the speaker.  If this filter is the problem you are having, then we need to know more about it.  I'm still unsure what the problem is  :-//
 

Offline hussamaldeanTopic starter

  • Supporter
  • ****
  • Posts: 266
  • Country: iq
Re: low pass filter for SPWM speech synthesiser
« Reply #9 on: October 31, 2018, 10:14:42 am »
the LPF filter circuit is just traditional one and the input is connected to the arduino and the output is connected to JBL speaker and oscilloscope

This is what I'm asking about.  What LPF? a simple RC? opamp active?  Your previous schematic had the Arduino directly driving a class D amp, with a passive LC filter on the output for  the speaker.  If this filter is the problem you are having, then we need to know more about it.  I'm still unsure what the problem is  :-//
I used passive RC, LC and active RC LPF with cut-off frequency of 20KHz directly on the output pin of the uC. when the filter is used, the output of the filter is zero regardless the input voltage i.e. the output is attenuated beyond usable range
 
 

Online Buriedcode

  • Super Contributor
  • ***
  • Posts: 1685
  • Country: gb
Re: low pass filter for SPWM speech synthesiser
« Reply #10 on: October 31, 2018, 11:07:38 am »
I used passive RC, LC and active RC LPF with cut-off frequency of 20KHz directly on the output pin of the uC. when the filter is used, the output of the filter is zero regardless the input voltage i.e. the output is attenuated beyond usable range

Now we're getting somewhere.  Post a schematic of that filter you use - the "active RC LPF with cut-off frequency of 20KHz".   And the parts you used would be helpful (like the opamp part number).

If in doubt, the web has quite a few applets/design tools that can help: http://sim.okawa-denshi.jp/en/OPseikiLowkeisan.htm (scroll down for getting part values for a given cut-off frequency).
 

Offline hussamaldeanTopic starter

  • Supporter
  • ****
  • Posts: 266
  • Country: iq
Re: low pass filter for SPWM speech synthesiser
« Reply #11 on: October 31, 2018, 12:09:00 pm »
I used passive RC, LC and active RC LPF with cut-off frequency of 20KHz directly on the output pin of the uC. when the filter is used, the output of the filter is zero regardless the input voltage i.e. the output is attenuated beyond usable range

Now we're getting somewhere.  Post a schematic of that filter you use - the "active RC LPF with cut-off frequency of 20KHz".   And the parts you used would be helpful (like the opamp part number).

If in doubt, the web has quite a few applets/design tools that can help: http://sim.okawa-denshi.jp/en/OPseikiLowkeisan.htm (scroll down for getting part values for a given cut-off frequency).
I used LM358 as voltage follower and basic RC LPF
I used 1KOhm resistor with 10nF capacitor which should me give around 17KHz
here is the schematics

OP-AMP is lm358
 

Online Buriedcode

  • Super Contributor
  • ***
  • Posts: 1685
  • Country: gb
Re: low pass filter for SPWM speech synthesiser
« Reply #12 on: October 31, 2018, 07:26:51 pm »
Given there are no capacitors in series with the input (that block DC) I'm surprised you get "no output" at all from that.  As a LPF it should pass DC.  How are you powering the LM358?  Its input can only sense within ~1.5V of the top rail (and same with its output) but as I said, you should still get some output with the input > 0V.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf