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.
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
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.
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.
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.