How to measure voltage using my sound card?

7 views (last 30 days)
Adelaide
Adelaide on 16 Mar 2014
Commented: Adelaide on 19 Mar 2014
I want to measure the voltage signal over a coil using my sound card in real-time. I am using my microphone to input the signals but i'm not sure how to display the signal. I was using dsp.SpectrumAnalyzer to view the signal in dB.
Any help with how to convert and monitor this will be greatly appreciated.

Answers (1)

Walter Roberson
Walter Roberson on 16 Mar 2014
If you are using winsound, then check
ai = analoginput('winsound');
out = daqhwinfo(ai);
out.InputRanges
if the output is
-1 1
then that is the most common case. In such a case, -1 corresponds to the most negative voltage the line can carry and +1 corresponds to the most positive voltage the line can carry, and absolute voltage is
Sample * Greatest_Positive_Voltage
  1 Comment
Adelaide
Adelaide on 19 Mar 2014
Hi, I have a 64 bit system so i cannot use the Data Acquisition toolbox.
I am trying a different approach now:
fs = 44100; % Sampling frequency in Hz
nbits = 16; % Number of bits
acq_ch = 2; % Acquisition channels (stereo)
secs2rec= 1; % Duration of recording
object_setup = audiorecorder(fs, nbits, acq_ch);% creating object for recording
recordblocking(object_setup, secs2rec)
%play(object_setup);
Recorded_data = getaudiodata(object_setup,'int16');
plot(Recorded_data(:,2));
hold on;
plot(Recorded_data(:,1),'r')
I know with the 'int16' data type the range is -32768 to 32767.
Will this similarly represent the most positive and negative voltages?

Sign in to comment.

Categories

Find more on Audio I/O and Waveform Generation in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!