low pass filter for SPWM speech synthesiser  - Page 1
Forum section: electronics / projects

author: hussamaldean
author_rank: Unknown
timestamp: October 26, 2018, 09:27:05 am
content: 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 amplifierwhich approach shall I use ?passive or active LPF ?DIY class D or just buy a pre-made one ?looking forward for your help

author: hussamaldean
author_rank: Unknown
timestamp: October 28, 2018, 06:19:53 am
content: up up up

author: Buriedcode
author_rank: Super Contributor
timestamp: October 28, 2018, 06:01:48 pm
content: 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.pdfhttp://www.ti.com/lit/an/spraa88a/spraa88a.pdfhttps://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.

author: hussamaldean
author_rank: Unknown
timestamp: October 29, 2018, 05:34:29 am
content: Quote from: Buriedcode on October 28, 2018, 06:01:48 pmthank you for ur feedbackthe 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 SPWMI am thinking about using it to validate the results before moving to create Class D audio Amplifierthx in advance

author: Buriedcode
author_rank: Super Contributor
timestamp: October 29, 2018, 08:55:25 pm
content: 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.

author: hussamaldean
author_rank: Unknown
timestamp: October 31, 2018, 06:39:00 am
content: Quote from: Buriedcode on October 29, 2018, 08:55:25 pmHere is the schematicsI am not sure about the values of the L&C for the LPFVcc of the speaker is 12V

author: Buriedcode
author_rank: Super Contributor
timestamp: October 31, 2018, 07:18:06 am
content: 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).

author: hussamaldean
author_rank: Unknown
timestamp: October 31, 2018, 07:26:00 am
content: Quote from: Buriedcode on October 31, 2018, 07:18:06 amI am using the following topic from instructableshttps://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

author: Buriedcode
author_rank: Super Contributor
timestamp: October 31, 2018, 09:36:40 am
content: Quote from: hussamaldean on October 31, 2018, 07:26:00 amThis 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

author: hussamaldean
author_rank: Unknown
timestamp: October 31, 2018, 10:14:42 am
content: Quote from: Buriedcode on October 31, 2018, 09:36:40 amI 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

author: Buriedcode
author_rank: Super Contributor
timestamp: October 31, 2018, 11:07:38 am
content: Quote from: hussamaldean on October 31, 2018, 10:14:42 amNow 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).

author: hussamaldean
author_rank: Unknown
timestamp: October 31, 2018, 12:09:00 pm
content: Quote from: Buriedcode on October 31, 2018, 11:07:38 amI used LM358 as voltage follower and basic RC LPFI used 1KOhm resistor with 10nF capacitor which should me give around 17KHzhere is the schematicsOP-AMP is lm358

author: Buriedcode
author_rank: Super Contributor
timestamp: October 31, 2018, 07:26:51 pm
content: 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.