The Godfather talking
You can run, but you can't hide.
Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
December 06, 2016, 05:03:07 17:03


Login with username, password and session length


Pages: [1]
Print
Author Topic: PWM filtering  (Read 1981 times)
0 Members and 1 Guest are viewing this topic.
Delillusions
Newbie
*
Offline Offline

Posts: 17

Thank You
-Given: 3
-Receive: 2


« on: June 21, 2013, 12:14:44 12:14 »

Hi!
Sorry for bothering everyone, but I would like to ask some help/guide!

I have a high resolution (16bit) PWM signal (3.3V Vpp, ~5mA), but the signal frequency is only around ~240Hz. The problem is that I have to filter this low frequency signal, to make it more like an analog signal. Even an active Low Pass Filter by itself doesn't help much. In some later stages I can filter out the higher harmonics of the filtered PWM, but the low freq can still be measured even on other stages.

Decreasing the resolution at some extend can work and I can solve the filtering in that case, but I would like to know if someone knows a way, to help the original signal.

From time to time I have to change the output, but not every millisecond, but I have to change it almost accuracy of milliseconds.

Thank you for help!
« Last Edit: June 21, 2013, 12:22:13 12:22 by Delillusions » Logged
Catcatcat
Active Member
***
 Warned
Offline Offline

Posts: 117

Thank You
-Given: 89
-Receive: 258



WWW
« Reply #1 on: June 21, 2013, 12:35:40 12:35 »

Without the filter does not work, try a variant on the MAX7404 3V, 8th-Order, Lowpass, Elliptic (r = 1.5), Switched-Capacitor Filter, Clock-Tunable Corner Frequency (1Hz to 10kHz)
Logged
Delillusions
Newbie
*
Offline Offline

Posts: 17

Thank You
-Given: 3
-Receive: 2


« Reply #2 on: June 21, 2013, 01:11:33 13:11 »

Catcatcat!

Thank you for your help!
Actually I thought about filter ICs like this (not actually this one, but similar), and there is a problem with these. It's true, that I forgot to mention, that I don't have only just one PWM signal. Actually I have at least 8 independently controlled PWM (at least 14 bit, but they prefer 16 bit) signals.

This method will increase the price of the whole BOM list. (Actually the filters would cost more, that everything else together). And I'm not sure the University I have to make this is going pay for it that much. It would be much better, but I'm not going to buy it from my money.

I know, that making this ~240Hz PWM into a perfect analog signal is not possible, but I would like to get rid of most of the ~240Hz noise.

Anyway, thank you again!
« Last Edit: June 21, 2013, 01:51:01 13:51 by Delillusions » Logged
h0nk
Active Member
***
Offline Offline

Posts: 120

Thank You
-Given: 89
-Receive: 83



« Reply #3 on: June 21, 2013, 03:55:12 15:55 »

Hello,

since You want an analog signal there are many options.
- Make it simple: Take DAC's.
- Use a controller with a better (faster) PWM.
The TI-Piccolo-family offers High-Resolution-PWM with 150 ps resolution per step.
- Use FPGA's/CPLD's for PWM-generation. 8 Channels of 16 bit PWM would fit even in very small and cheap FPGA's.


Best Regards
Logged
Delillusions
Newbie
*
Offline Offline

Posts: 17

Thank You
-Given: 3
-Receive: 2


« Reply #4 on: June 21, 2013, 05:07:26 17:07 »

h0nk!
Thank you for your ideas!

#1 DAC: The problem is similar like with the integrated filters.
#2 MCU with faster PWM: The university are not going to buy a whole programmer and I'm not going to do it for just one job, so I have to stick to the MCUs, that I can program. The University doesn't want premade development board for copyright reasons, so I have to design and make every PCB. I have quite a few programmer for different MCUs, but TI is not one of them.
#3 FPGA/CPLD is not an option, since the cheapest in my country is Xilinx and it's almost X3 or X4 times more expensive, that the MCU I'm using. Not to mention that for FPGA I need extra memory, to store the firmware, multiple voltage levels are needed and firmware development would be hard, which means I have to ask more money, which I'm not going to get from them. (I have a programmer for Xilinx FPGA/CPLD, but I'm still learning using those ICs).

I know, that all of this sound unreasonable, but my old University was always like this. (Thank God that I already graduated from there!  Cool Even after delivering the product I still have to wait and fight for months until they will pay me.  Shocked  )
If I'm not going to be able to filter out the 16bit PWMs, then I have to lower the resolution, to an accepted level, which I can filter out without a problem. So I already have a way to solve the problem, but now I'm searching for a way to solve it in a better way.


Anyway, thank you for your help and tips!
« Last Edit: June 21, 2013, 05:10:19 17:10 by Delillusions » Logged
solutions
Hero Member
*****
Offline Offline

Posts: 1446

Thank You
-Given: 590
-Receive: 851



« Reply #5 on: June 21, 2013, 10:04:56 22:04 »

What are you trying to do with this analog signal?

Why not external DACs as was suggested?


It's a university project, not a consumer design. $10 doesn't matter.

I also don't understand the copyright remark. Most eval boards from semiconductor companies are welcomed to be integrated into a system design.

I think you've made up your mind, and closed it off to suggestions - a bad design habit.
Logged
Mentor
Newbie
*
Offline Offline

Posts: 20

Thank You
-Given: 58
-Receive: 3



« Reply #6 on: June 22, 2013, 01:36:54 01:36 »

Exactly how much filtering do you need? With 1 opamp you can make a 2nd order active filter, that's probably 12dB for decade. With 2 opamps you can go for a 4th order with about 24dB for decade attenuation. That's a lot of attenuation! Smiley

But I see a problem when you say that the PWM frequency is 240Hz, but you may have to adjust the signal within miliseconds. So, for me it seems that you can modulate the PWM signal with a frequency of ~1Khz, and any low pass filter for the pwm signal will kill this signal as well.

Logged
Delillusions
Newbie
*
Offline Offline

Posts: 17

Thank You
-Given: 3
-Receive: 2


« Reply #7 on: June 22, 2013, 09:07:59 09:07 »

Solutions!

This equipment is will be part of a research in the University and there are a lot of thing, that I'm not allowed to say because of the contract with the University. The device is quite complex, the PWM is just a little fraction of it. The PWMs will drive the output stages.
DACs are not good, and the reason is the price. For 1 DAC 10$ is not much, but I need 8 of them it's 80$, which comes from my pocket. I don't understand the copyright either, but it's in the contract. I'm not allowed to use any kind of premade board by a third party. Everything has to be made/designed by me. The PCB is an exception. I can order the designed PCB.

14 bit is acceptable by the contract and I already made a prototype for it and the University is quite happy with it. I'm way ahead of schedule, so I have a lot of time to fine tune it, so now I'm looking for ways how to improve the PWM part and the others too. I'm also searching for ways to make some parts cheaper, so I will have money for the DACs or Filter ICs. I closed those suggestion off since mostly everyone in different places suggested these methods. I though about them too, but they still doesn't fit into the budget. So know I would like to hear something new, So I wouldn't call it a bad habit. I just don't want to hear everything over again. Now I trying to cut the component expenses elsewhere, but until I'm not done with that, then the previous methods are not good.

Mentor!
Thank you too!
I made some test ( I don't like calculating so I test out everything I can on real HW if possible, calculating in theory and measuring in HW can give different results) and I need around ~35dB, but I need to use precision OP-AMPs (low drift, off-set,... etc.) and they are not the cheapest. This budget is hilariously small. This causes me the most headache.

Look like you misunderstood me. I have to change the PWM signals Duty-Cycle from time to time. I can do that very accurately (1-2 milliseconds), which is not a problem. The problem is I can measure the ~240Hz of the PWM in the output, and that is what I have to get rid of. With 14 resolution I can get rid of the PWM frequency. So I can say, that I'm done the job, but I want to improve it as long as I have time.
Logged
Ichan
Hero Member
*****
Offline Offline

Posts: 840

Thank You
-Given: 312
-Receive: 387



WWW
« Reply #8 on: June 22, 2013, 11:26:51 11:26 »

Objective: clean analog output, 16 bit resolution, updated every milisecond.

R2R DAC, if the pcb area is not restricted then it will do this cheaply - serial to parallel shift register (or even a PIC connected by SPI/I2C) followed by some resistor network.

Can be as low as 1 buck.

-ichan
Logged

There is Gray, not only Black or White.
h0nk
Active Member
***
Offline Offline

Posts: 120

Thank You
-Given: 89
-Receive: 83



« Reply #9 on: June 22, 2013, 01:01:24 13:01 »

Some time ago i have built a R2R-DAC with selected 1% resistors and a 74HC595.
Selected means: the same value measured with a 3 1/2-digit multimeter.
It was good for 8 bit resolution :-)

Best Regards
Logged
Delillusions
Newbie
*
Offline Offline

Posts: 17

Thank You
-Given: 3
-Receive: 2


« Reply #10 on: June 22, 2013, 03:31:10 15:31 »

Not a bad idea an R2R-DAC. I'm not really a fan of controlling 8 serial communication devices in parallel with critical timing, but it's not impossible. I have a few Serial->parallel ICs on stock all I need is the resistors, so I will make some test.

Thank you for the idea Ichan & h0nk!
« Last Edit: June 22, 2013, 03:52:14 15:52 by Delillusions » Logged
Gallymimu
Hero Member
*****
Offline Offline

Posts: 579

Thank You
-Given: 101
-Receive: 151


« Reply #11 on: June 22, 2013, 04:40:32 16:40 »

what prevents you from increasing your PWM frequency?  Certainly going up an order of magnitude on your PWM freq would make filtering much easier.  I assume you are going as fast as you can with your current controller?!  240Hz is pretty slow, even for a software bit bang PWM.  What processor are you using?
Logged
nordiceng
Newbie
*
Offline Offline

Posts: 30

Thank You
-Given: 0
-Receive: 11


« Reply #12 on: June 22, 2013, 08:56:05 20:56 »

If you are trying to use this 8 PWM signals in design a two single phase bridge inverter the motor coil can work as low pass filter
Logged
solutions
Hero Member
*****
Offline Offline

Posts: 1446

Thank You
-Given: 590
-Receive: 851



« Reply #13 on: June 23, 2013, 03:50:40 03:50 »

Solutions!

This equipment is will be part of a research in the University and there are a lot of thing, that I'm not allowed to say because of the contract with the University. The device is quite complex, the PWM is just a little fraction of it. The PWMs will drive the output stages.
DACs are not good, and the reason is the price. For 1 DAC 10$ is not much, but I need 8 of them it's 80$, which comes from my pocket. I don't understand the copyright either, but it's in the contract. I'm not allowed to use any kind of premade board by a third party. Everything has to be made/designed by me. The PCB is an exception. I can order the designed PCB.

14 bit is acceptable by the contract and I already made a prototype for it and the University is quite happy with it. I'm way ahead of schedule, so I have a lot of time to fine tune it, so now I'm looking for ways how to improve the PWM part and the others too. I'm also searching for ways to make some parts cheaper, so I will have money for the DACs or Filter ICs. I closed those suggestion off since mostly everyone in different places suggested these methods. I though about them too, but they still doesn't fit into the budget. So know I would like to hear something new, So I wouldn't call it a bad habit. I just don't want to hear everything over again. Now I trying to cut the component expenses elsewhere, but until I'm not done with that, then the previous methods are not good.

Mentor!
Thank you too!
I made some test ( I don't like calculating so I test out everything I can on real HW if possible, calculating in theory and measuring in HW can give different results) and I need around ~35dB, but I need to use precision OP-AMPs (low drift, off-set,... etc.) and they are not the cheapest. This budget is hilariously small. This causes me the most headache.

Look like you misunderstood me. I have to change the PWM signals Duty-Cycle from time to time. I can do that very accurately (1-2 milliseconds), which is not a problem. The problem is I can measure the ~240Hz of the PWM in the output, and that is what I have to get rid of. With 14 resolution I can get rid of the PWM frequency. So I can say, that I'm done the job, but I want to improve it as long as I have time.

8x 24 bit DACs is actually $12 if you really want to get picky (and I didn't look very hard...I'm too busy on my own stuff right now to save you $2 elsewhere or to look for a cheaper part...$12 is close enough to make my point) - the $10 was off the top of my head (because I recalled an old Burr Brown 16 bit stereo SPI DAC that used to be about $1.75):

http://www.mouser.com/ProductDetail/Cirrus-Logic/CS4338-KSZ/?qs=sGAEpiMZZMswix2y39yldTSCGOvncVDSXaz7V%2fhwpJI%3d

24 bits, $12 TOTAL....too much accuracy?

96kHz...too fast?

$2 over budget?

I'll bet you'll still find an excuse to do it PWM because there's some kind of insane academic "cool" factor in using it.

 Tongue

-Solutions

p.s. - there's no shame in saying it's for your thesis, instead of this "contract" nonsense. Anyone putting those kinds of constraints, if it is a contract, is an idiot
Logged
Delillusions
Newbie
*
Offline Offline

Posts: 17

Thank You
-Given: 3
-Receive: 2


« Reply #14 on: June 23, 2013, 08:28:50 08:28 »

Gallymimu!
The only thing prevents me from using higher frequency is the resolution. I already solved it by lowering the resolution to 14bit, where the freq is above 1kHz. I can filter it and it works. Now I'm trying to find a way to use q higher resolution.

nordiceng!
The output is not a motor.


solutions!
You're right! It's no shame in saying it's for my thesis. But I'm not going to since it's not true. I graduated from the Technology department, now I'm doing this job for the Chemical department of my old University. And I'm already swallowed a big part of my pride, since I'm asking for help.
The one who set most of the requirements and budget barely know anything about electronics and the prices, he only know about chemistry.
There's no "cool" factor. I don't like PWMs, since they generate noise, but they cheap for now.

The Mouser is out of the question for the Delivery Charges into my country. But using a Stereo Audio DAC is not a bad idea so I ill look into that too.
« Last Edit: June 23, 2013, 08:37:42 08:37 by Delillusions » Logged
solutions
Hero Member
*****
Offline Offline

Posts: 1446

Thank You
-Given: 590
-Receive: 851



« Reply #15 on: June 23, 2013, 09:31:48 09:31 »

If he only knows about chemistry, there's no harm telling him he doesn't know what he is doing and the better way to do it is xxx...in fact, you SHOULD, IMO.

But - up to you. It's your neck and wallet at risk, not mine
Logged
Delillusions
Newbie
*
Offline Offline

Posts: 17

Thank You
-Given: 3
-Receive: 2


« Reply #16 on: June 23, 2013, 12:08:52 12:08 »

I already DID in the early stages of designing.
Answer:
NO! You do it, or someone else will.

The budget is fixed, since most of it was already spend and not much left. (Corruption Sad )
P.S.: The main reason I'm still doing this is because later it will look good in my CV.
Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC