# Computer line-in voltmeter

I'm about to make a voltmeter from computer line-in. In some strange way I can not see direct current from computer. Why does it work only with alternating current? What information does captured wave contain? Could someone please explain basic principles of how does line-in work? How does sound capturing work in particular? Sorry if this isn't the right place to ask.

• There is usually a capacitor in the input circuit which blocks DC, and very low frequencies. That is why it only works with alternating current. – pjc50 Feb 26 '14 at 14:45
• Protip: It's a bad idea to wire stuff you don't understand to things without thinking about it first. – John U Feb 26 '14 at 14:59
• @pjc50 thanks. but what about AC with DC component. will i see AC component only? – Ivars Feb 26 '14 at 15:04
• What's with the close votes? This may be a very basic question, but it is about electronics and the explanation gets into electronic design. It's also not the kind of thing you'd know unless you already know. – Olin Lathrop Feb 26 '14 at 15:04
• Enough people have answered your direct question. If you want to make something that could work, I'd suggest modulating your Voltmeter Signal on to a carrier in the audio frequency range. Amplitude or Peak modulation should work. This signal will pass through the DC blocking Cap and be available for processing in your PC. – akellyirl Feb 26 '14 at 15:10

Why does it work only with alternating current?

Line-in is for audio signals. A DC signal represents silence, whether it is 0V 0.5V or 1V. Therefore the desgners of the Line-in circuits are not interested in DC levels at all.

As pjc50 commented, technically, DC is typically filtered out using a series capacitor.

What information does captured wave contain?

Line-in is designed to be used to accept varying voltage levelswhich represent variations in air pressure over time. Typically such variations caused by spoken conversation or music near to a microphone (or indirectly from a recorder, or synthesised versions of this).

So long as the analogue signal is sampled at a high-enough frequency, the stored values can later be used to reproduce a good approximation of the analogue signal sufficient to potentially reproduce the variations in air pressure over time (using an amplified and loudspeaker/headphones/earphone).

It all resides in your sound card circuit design. As stated in the comments, there is a DC blocking capacitor mounted in series with the input.

Here is a simple schematic for a generic sound card input circuitry:

Unfortunately without directly modifying the circuit / shorting the capacitor you can't overcome this by simple means.

Also please note that shorting that capacitor could cause hum/noise/ground loops and DC offset in the Line IN, which may affect other equipment connected to it.

EDIT:

Spotted the last comment. This should work but it depends on your DC source (the measured value) and the sound card

In worst case scenario (example: the source and capacitor acting like an RC filter) you will get something like

http://www.electronics-tutorials.ws/rc/rc10.gif which is clearly undesirable for measuring a DC voltage.

Why don't you try a different approach to your problem? Like designing a circuit to supply an AC voltage to the sound card input (like a Voltage Controlled Oscillator), in order to produce a Sine wave with it's frequency strictly depending on input DC voltage. Then do the math (i.e. measure frequency) in software. You could also try to provide a constant frequency sine wave but to vary it's RMS Voltage according to your input voltage.

A simple and cheap Voltmeter should solve the problem. However if you need something like a datalogger and some precision, you should consider a dedicated one attached to RS232, USB, etc.

There is nothing strange at all. Remember that the "line input" is intended for audio. Even HiFi audio only goes down to 20 Hz, so there is nothing wrong, and it should be expected, that a audio input will block DC. That's actually a good thing for audio since DC isn't part of the desired signal, and it simplifies the DC biasing in the electronics.

• thanks. what if i apply pulsating DC (8 KHz or more)? will it work then? – Ivars Feb 26 '14 at 15:09
• Well, then it's not DC :) You'll get a signal that you can measure the magnitude of. Note that there will probably be another rolloff filter above 20kHz. – pjc50 Feb 26 '14 at 16:44
• @pjc50 sorry i put the wrong. i meant: what if i use clock generator (8 KHz) and transistor? clock generator opens and closes the transistor gate allowing my DC signal to pass through with rate of 8 KHz. that's AC i guess? – Ivars Feb 26 '14 at 17:34
• That is AC, yes. It's not quite as simple a design as that, you'll want a FET and a burden resistor. Suppose I should add an answer .. – pjc50 Feb 26 '14 at 17:48