This post originated from an RSS feed registered with Python Buzz
by Aaron Brady.
Original Post: Measuring Frequency Response
Feed Title: insom.me.uk
Feed URL: http://feeds2.feedburner.com/insommeuk
Feed Description: Posts related to using Python. Some tricks and tips, observations, hacks, and the Brand New Things.
In my short electronics career, I’ve built headphone and power
amplifiers, including a valve amp, and a microphone pre-amp of my own
(extremely simple) design. I’ve modified others, too.
I like the sounds of these devices to a greater or lesser degree, possibly for
pretty unscientific reasons.
One thing I’ve wanted to do for a while is stick some science on it and
actually measure their frequency responses.
I recently had a good excuse because I found my microphone pre-amp and I was
going to rebuild it properly and put it in a box but I also found this SSM2019
chip that I’d received a sample of from Analog.
The SSM2019 is effectively a pre-amp on a chip, only requiring power, signal
and a 10K variable resistor to control gain. Its datasheet promises a
flat frequency response past 20KHz, which is about as good as human hearing
range
There was no point in rebuilding my basic LM348N-based amp if the SSM was
going to be better and even simpler.
As a happy coincidence, Hackaday recently ran an article called “Controlling
Your Instruments From A Computer: Doing Something Useful”. In it, Jenny
List measured a filter she designed against the simulation (and found the real
one wanting). She used a Rigol oscilloscope for the readings and a Raspberry Pi
as a signal generator. I have both of those! This was all going to be a walk in
the park!
Nope.
I checked out her fork of freq_pi and used the Rigol to verify that
GPIO4 on the Pi was outputing some very stable square waves. Then I found
it’s only capable of generating waves from 61KHz to 250Mhz. (Well, I say
only. That’s incredibly useful, just not for me).
It was time to completely switch tack.
Last Christmas I was given an Analog Devices ADALM1000. This is a
combination two channel signal generator / oscilloscope aimed at the
educational market.
The basic idea is that you build some filters or op-amp designs and have one
channel generate a signal, and then measure it with the other channel.
That sounds great for testing an amplifier too, and it’s capable of generating
a sine-wave from 1Hz to 20KHz, so it perfectly matches the range I’d like to
test.
This is everything held together with crocodile clips. This photo actually
shows me testing my NP100v12 valve amp, but the basic set up is the
same.
I connected channel A to the ground and input of the pre-amp and channel B to
ground and output. I powered the amp from a 9V battery to avoid introducting
any mains hum.
This is the Alice software for the ADALM1000. It’s all written in
Python and pretty hackable. It’s not as polished as the Pixelpulse
software which is also available from Analog, but once you get used to
it this software is far easier to control accurately.
In this screen shot I’ve set channel A to be AWG (arbitrary waveform
generator). The shape is sine (you can’t see that, it’s hidden under the
shape menu). Input amplitude is from 0 to 0.1V, and we’re generating a 100Hz
wave as a test.
Channel B is measuring voltage. It’s set to display the waveform as
well as the peak voltage (Vmax – 1.01V here). Our gain (G)
here is 10.
By changing the frequency I created a table of Hz vs. Vmax:
Hz
Vmax
10
1.03
50
1.03
100
1.01
500
1.005
1000
1.015
2500
1.00
5000
0.98
10000
0.92
15000
0.84
20000
0.75
This isn’t very clear, although even I can see the drop-off starting after 5000Hz.