Pulse Width Modulation (PWM) modules, which produce basically digital waveforms, can be used as cheap Digital-to-Analog (D/A) converters only a few external components.
A wide variety of microcontroller applications exist that need analog output but do not require high resolution D/A converters.
Conversion of PWM waveforms to analog signals involves the use of analog low-pass filters
In a typical PWM signal, the base frequency is fixed, but the pulse width is a variable. The pulse width is directly proportional to the amplitude of the original unmodulated signal. In other words, in a PWM signal, the frequency of the waveform is a constant while the duty cycle varies (from 0% to 100%) according to the amplitude of the original signal.
for calculating the low-pass filter, you first must know the bandwidth of the signal to be reconstructed.
And the bandwidth can be calculated frequency PWM for our application, clearly applying a multiplier K factor, while K >> 1, the resolution of the signal is greatly improved, but also must consider the resolution of the PWM Dutty.
PWM frequency with already established, it can proceed to design the low-pass filter, with the following equation.
http://e2e.ti.com/cfs-file.ashx/__key/communityserver-discussions-components-files/312/8510.forumla1.png
must be added to the output of OPAMP pass filter to provide a low impedance and good power delivery to the application.
Cardiac result signal generated by the PWM
NOTA: As can be seen the signal has a significant quality reconstructed, but has a curl, these are achieved by increasing the degree of eliminating pass filter
Heart Singal mode duty cycle |
---|
int dac[]={43,44,46,46,47,48,50,52,53,53,57,59,62,62,67,68,71,72,76,79,81,81, 85,86,89,89,90,92,93,92,93,93,94,91,91,91,90,90,87,87,86,84,82,81, 80,79,76,76,73,72,69,69,68,67,64,64,62,61,59,58,57,56,55,53,53,52, 50,49,50,48,48,46,47,45,45,43,43,44,43,40,41,41,41,39,40,40,39,39, 39,39,40,38,37,38,37,38,37,39,39,38,37,39,39,40,38,40,40,40,39,40, 41,40,39,41,41,42,41,41,43,42,43,42,43,44,43,42,43,44,44,43,45,43, 45,43,45,46,46,44,45,45,46,43,45,46,45,45,46,47,48,46,46,47,47,47, 46,47,47,46,45,46,47,47,45,47,47,48,46,47,48,48,46,47,48,49,47,48, 48,49,49,49,50,51,49,49,49,49,49,48,50,50,49,48,50,52,51,50,51,51, 52,49,49,49,48,47,47,47,48,45,45,47,47,47,45,47,47,47,46,47,48,48, 46,49,48,50,48,49,50,49,49,49,50,50,49,49,50,50,50,49,50,51,51,49, 49,47,46,41,38,33,28,22,19,19,20,23,30,37,47,55,63,74,81,85,86,89, 90,88,88,86,82,80,77,73,68,63,58,54,51,47,41,40,38,37,34,35,35,35, 33,34,35,36,34,35,36,36,37,36,38,40,39,38,39,40,41,39,42,41,42,40, 42,43,43,42,44,43,45,43,44,45,45,45,45,46,47,44,45,46,46,46,45,47, 47,46,45,46,46,46,44,45,44,46,43,43,45,45,42,43,43,44,41,41,42,42, 42,40,41,42,40,40,41,41,42,41,43,43,44,43,45,47,47,47,49}; |
Code / C++: |
---|
while(1){ for(i=0;i<=370;i++) |
Video Cardiac emulator