0
\$\begingroup\$

I'm currently traveling and only have access to basic parts (soldering iron, an arduino nano and a breadboard!) but I'm able to buy parts from local suppliers. for a project I need to be able to create some waveforms and verify the output of the circuit (I tend to only do it for about 10 to 100Hz, so nothing high frequency!).

I think I can use an instrumentation amplifier followed with a summing amplifier to adjust DC offsets (add or remove) and another inverting amplifier to get the original signal, which is finally fed into the MCU ADC input and sampled as fast as possible, then displayed on the PC using a serial monitor program.

I'm having some doubts about the audio output of my PC however. I'm not sure if it's bipolar (i.e goes below ground as well) or if it's unipolar with a certain amount of DC offset? I did some googling but couldn't find anything and I'm not sure how I can verify that.

The signals will be created using this website:

https://www.szynalski.com/tone-generator/

which gives quite a lot of options for the output waveform except anything for DC offset!

obviously the ADC on the arduino works only in the 0-5 range and is unipolar. I try to take a picture of my current schematic and upload it, in case that's relevant information.

\$\endgroup\$
  • \$\begingroup\$ It's not clear to me what your actual question is. \$\endgroup\$ – brhans Jul 13 at 14:36
  • 1
    \$\begingroup\$ Most computer soundcards are AC-coupled with a series capacitor. This means that while internally they have a DC offset, you don't see that on the connector and the average of the voltage over time would be zero unless externally biased. It also mean that there's some roll-off attenuation of low frequency signals. You would need to re-inject an offset if you need one, with bias resistors or an op-amp. \$\endgroup\$ – Chris Stratton Jul 13 at 14:39
2
\$\begingroup\$

Your PC's audio output is really neither bipolar nor DC-biased – it's pretty certainly AC coupled, i.e. there's a capacitor in series with it! (In effect, a headphone port would be centered around ground potential, due to the headphone being connected to ground on its other end.)

That means you can just AC couple it yourself (I recommend doing that to avoid any stray DC current, although the AC output coupling technically renders that redundant) to a biasing of any desired DC voltage, e.g.:

schematic

simulate this circuit – Schematic created using CircuitLab

Although I called it optional, you pretty much always want to have an output voltage buffer in a signal generation setting, so add this block to the output of whatever you build – I've omitted it below for clarity's sake. Good thing: even local dealers will stock multi-unit opamps with at least two opamps per IC, so this isn't even any extra component effort.

none of these component values are really critical: A soundcard can drive much larger loads than a couple kΩ; choose the resistor or capacitor larger and get a lower lowest frequency you can pass through.

In a simple case, you could just use a voltage divider to bias your signal:

schematic

simulate this circuit

If you need adjustable bias, that can be easily done with a microcontroller like your arduino. Use the PWM unit to generate a specific duty cylce:

schematic

simulate this circuit

\$\endgroup\$
  • \$\begingroup\$ my circuit is a bit more complicated. I want to use two external pots (both 1k) as a fine and coarse adjust for the DC offset, which allows me to set it anywhere between 0 and 5V. for my input, I will use a 4.7uF capacitor + a 100K resistor which should be good enough for the 10 to 100Hz range. but thanks for the info. I create the actual circuit and test a few different options for biasing using op amps. \$\endgroup\$ – OM222O Jul 13 at 14:49
  • \$\begingroup\$ Just use one of the pots between 5V and GND in place of the PWM – problem solved. The R1=100kΩ is large enough the ensure the pots aren't loaded, but function as unloaded voltage div. I'd recommend using a single multi-gang pot instead of coarse/fine of the same value. \$\endgroup\$ – Marcus Müller Jul 13 at 15:07
  • \$\begingroup\$ it won't be coarse and fine of the same value :D I will use a 10K resistor in series with the wiper of one, and a 100Kohm for the other, then join the free ends of the resistors together. this gives the coarse 0 to 4.5V range and the fine 0 to 0.5V range. although the output impedance is horrible, I will follow that with a voltage follower op amp and a capacitor to reduce pot noise. \$\endgroup\$ – OM222O Jul 13 at 15:12
  • \$\begingroup\$ the cap alone won't be good at reducing noise; add a full RC filter at the output of the voltage follower (or, even, multiple; potentiometers in movement really ring a whole lot). \$\endgroup\$ – Marcus Müller Jul 13 at 15:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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