How to calculate R and C for AM Demodulation envelope detection?
the cutoff frequency of RC filter is:

$$f_0 = \frac{1}{2\pi R C}$$

you make :


\$f_0 &lt;&lt; f_c\$ (carrier frequency)
\$f_0 &gt;&gt; f_d\$ (maximum data frequency)


The optimal value: 

$$f_0 = \sqrt{\left(f_c \times f_d\right)} $$

Example:

\$f_c = 20\mathrm{kHz}\$, \$f_d = 32\mathrm{Hz}\$, then:

$$f_0 = \sqrt{\left(20000 \times 32\right)} = 800 \mathrm{Hz}$$

Which can be achieved with for example \$C = 39\mathrm{nF}\$ and \$R=5.1\mathrm{k\Omega}\$.