1
\$\begingroup\$

I want to generate a sine wave without an offset voltage. I generated a sine wave from 0 to 3.3 V and it has a 1.65 V offset. I need a sine wave from -1.65 V to 1.65 V using an MCU. How can I do that?

\$\endgroup\$
5
  • 3
    \$\begingroup\$ DC-block it with a cap? \$\endgroup\$ Jan 24, 2023 at 6:29
  • 2
    \$\begingroup\$ connect the CPU to +1.65 and -1.65 supplies \$\endgroup\$ Jan 24, 2023 at 6:48
  • 2
    \$\begingroup\$ DC shift with an opamp? \$\endgroup\$
    – winny
    Jan 24, 2023 at 7:01
  • 1
    \$\begingroup\$ Buy a function generator on Ebay for $20 \$\endgroup\$
    – Kyle B
    Jan 24, 2023 at 7:09
  • 1
    \$\begingroup\$ Generate the complement on another GPIO pin and read the voltage between pins. \$\endgroup\$
    – PStechPaul
    Jan 24, 2023 at 8:45

1 Answer 1

4
\$\begingroup\$

I generated sine wave from 0 to 3.3V and its has a 1.65V offset value. I need a sine wave from -1.65V to 1.65V using MCU.

Use a coupling capacitor (a.k.a. DC blocking capacitor):

schematic

simulate this circuit – Schematic created using CircuitLab

RL represents the input impedance of the load. For technical explanation purposes I put 10k but can be anything depending on the application. CX is the coupling capacitor.

Note that this RC network forms a high-pass filter with a cut-off frequency of

$$ f_c=\frac{1}{2\pi \ R_L \ C_X} $$

So, CX should be selected such that the frequency of the waveform that MCU generates stays in pass band. To guarantee this, I personally recommend you to select a cut-off frequency of less than half the minimum frequency of the sine that MCU generates. For example, if the minimum frequency will be 50 Hz then a cut-off frequency of 20 Hz should be enough. This makes CX = 800 nF but 1 uF can be used.

One thing worth to note here is the value of RL. I chose it low enough so that some other equipment (e.g. AC voltmeter or oscilloscope) can be connected. If you put higher values then the CX can be reduced accordingly but anything connected in parallel with RL will reduce the effective load resistance which results in distortion or amplitude reduction on the waveform. So anything between 1k to 10k should be alright.

\$\endgroup\$
2
  • \$\begingroup\$ Actually it's a pretty simple idea. A series capacitor block a dc voltage. Output of the capacitor is a pure sine wave. Thank you very much Mr. Rohat Kılıç. \$\endgroup\$ Jan 25, 2023 at 11:15
  • \$\begingroup\$ @AliBuğraÇETİN never ignore what comes after DC blocking capacitor. \$\endgroup\$ Jan 25, 2023 at 11:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.