Hi everyone. Basically, i am generating a ".wav" file using the code below in MATLAB
Fs = 14400;
duration = 20;
t = linspace(0 , duration , duration*Fs );
m = cos(2*pi*10*t);
A = 1.5;
f_c = 200;
s = (A + m).*cos(2*pi*f_c*t);
plot(s)
s = s / max(s);
% sound(s, Fs);
audiowrite("deneme.wav", s, Fs);
I have a voltage divider circuit to shift this waveform. I am giving the ".wav" file as an input to this circuit, and getting an shifted output from A0 pin of the arduino. And using arduino USB cable and the following code, I am sending it to the computer, using the arduino code below.
Thanks for your reply. Before seeing your comment, I changed the resistors in my voltage divider circuit from 100 ohm to 100k ohm, and the problem has been resolved. Then this is now what the wave looks like:
Normally, as long as identical resistors are used, resistance value shouldn't matter. I don't know what the reason is. What is your opinion?
Nobody can give a good opinion without seeing your circuit schematic. "identical resistors" in a completely unknown circuit, is completely meaningless.
Since you used small valued resistors, the time constant becomes very small, and capacitor charges and discharges very fast. Therefore, ac coupling cannot be done efficiently.
I think the problem has been resolved. Thank you all.
Yes it matters very much. Not for the division ratio but for the over all impedance of the load that the potential divider presents to the voltage source.
Using such low values means that the voltage source has to supply a lot more current to the divider than it would have to do if the absolute values were to be a lot higher.
Say you'd used 0.000000001 ohm resistors - would you expect that to work too? I hope not...
You were simply overloading your amp, whatever that was, and greatly reducing the amplitude to a few LSBs of the ADC, giving a steppy output.
Ironically you didn't post any details of the hardware so we'd not have been able to figure things out for you (that's why posting everything (code, hardware details, circuit, photo) is a great idea if you want a quick solution - many eyes over everything usually spot the problem).
In low voltage solid state circuitry 100 ohms is generally thought of as low, 1M is high, and the normal range is 1k..100k for many purposes (opamps, pullups, voltage dividers, etc). The underlying reason is that as you get below 100 ohms or so power dissipation becomes important, and above 100k noise-pickup starts to become important.
However at higher frequencies things change, much RF stuff is 50 ohms and 1k is a high value!