Help with a low pass filter - There is frilly lace where there did'nt ought to
John Bond
Posts: 369
Hi Guys
Please help!
I built a quick signal generator on Sunday using an SX48 – See various Images. I used the LM386 N1 Audio op-amp. I just took G
Please help!
I built a quick signal generator on Sunday using an SX48 – See various Images. I used the LM386 N1 Audio op-amp. I just took G
Comments
Leon
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Amateur radio callsign: G1HSM
Suzuki SV1000S motorcycle
You are right, it's an Audio amp that is sometimes used as an op-amp
http://www.icmaster.com/search/Preview.do?v=1
I live in "Darkest Africa" and I'm some distance from a electronics store. The local (100 miles) ones also only have a few components so I often have to use sub-optimal parts. Post gets stolen so I restrict imports until I have a big purchase that I can go and collect from the shipping company.
Thanks fot that lead to the TI web site.
John
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
place a capacitor across pins 1 and 3 of the potentiometer feeding the
input to the LM386.
The value of the cap determines where the frequency response begins to
roll off. A 0.01 uf cap will give a 6 db/octave rolloff starting at roughly
1600 Hz, if my calculations are correct.
phil
If you create a saw-tooth, triangle, or sine wave with your setup, what is the 'fastest' frequency that you can produce? Use that frequency as your baseline for a simple RC filter set the filter roll-off at least 3X above your baseline frequency. What you are seeing is the transitional spikes between bit changes in your R2R resistor ladder. The more bits that change at a time, the larger the spike.
http://en.wikipedia.org/wiki/Low-pass_filter
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Post Edited (Beau Schwabe (Parallax)) : 7/7/2009 3:38:46 PM GMT
Your "noise" has a pattern to it, which suggests that the ramp itself is non-monotonic. This could arise either from a programming error (you need to switch all eight outputs at once, not one at a time) or from wrong values for the ladder network resistors. For an R-2R network, it's more accurate to use two "R" resistors in series for the "2R" parts (or two "2R" resistors in parallel for the "R" parts) than to try finding individual resistors with a precise 2:1 ratio.
I would try to fix the non-monotonicity first before resorting to any kind of filtering, as the latter may simply cover up a more systemic problem.
-Phil
Post Edited (Phil Pilgrim (PhiPi)) : 7/7/2009 6:08:58 PM GMT
Ordering parts in Taiwan offers similar problems. Somethings are hugely impossible to get while others are on the shelf. Americans can easily get everything, but that isn''t the global situation at all. Are people still stealing electrical transmission towers? Or is live improving?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Ain't gadetry a wonderful thing?
aka G. Herzog [noparse][[/noparse] 黃鶴 ] in Taiwan
parallel combination of the 39k and the 10k pot.
This becomes about 7.96 k.
The corresponding RC time constant, t, of the filter is then:
t = R*C
Assuming a 0.01 uf cap across the pot (pins 1 and 3),
t = 7.9 * 10^3 * 0.01 * 10^-6 = 79.6 * 10^-6 seconds
1/t = 12562 radians/sec
f_c (corner freq) = (1/t)/(2*Pi) = 12563/6.28 = 2000 Hz
You can raise or lower this by simply choosing a different size
cap. Use the smallest cap value that suppresses the switching
transients to an acceptable level.
However, be sure to first look into Phil Pilgrim's suggestion of
locating any software or ladder network problems.
phil
For example switching from 15 (%01111) to 16(%10000) or any multiple there of would cause a repeatable, but uneven current spike that could
translate into the HF noise that you see.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
There's a lot for me to think about and work through here!
1. I'd like to create a sine wave frequency from 10K to 50K to drive a small piezo speaker. I haven't worked out how many steps I'll use, maybe 128 , maybe 64.
2. At the moment, I’m only switching those bits that need to change. Maybe I should switch all bits to hi-Z then to the new pattern. Then maybe use a sample and hold circuit.
3. I am using 1K and 2K 1% metal film resistors in the ladder.
Please give a couple of days to play with all this information.
@ Herzog and theft – yes they still steel 11KV power pylons to sell as scrap metal. Herzog saw an article in Taiwan on how South African thieves steal live 11KV power cables. The latest thefts are the manhole covers in the road (pavement). There’s been another death when an automotive had its wheel ripped off. They’re also hijacking trucks with the load. How do you get rid of a 40 tonne load of stolen gas (Petrol/diesel)? That is 8500 gallons! What do you do with 40 tonne of detergent? That is 20 000 packets! About 20 trucks are stolen each month.
And South Africa was the country that first developed the commercial satellite vehicle tracking technology. If you can design the technology, you can beat the technology…
I sometimes think us people from Africa are a whole bunch of different species to those found elsewhere in the world…
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I think the sample-and-hold is a good idea, if you can't eliminate the glitches in another manner. When you say you're "only switching those bits that need to change", are you switching them one at a time, or in concert? (Doing it one at a time would definitely give you glitchy output.)
-Phil
Im reading a byte from a DATA table directly to the RC port, They should all switch similtanously. That's why I didn't think of switching glitches.
John
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sorry to hear the chaos is still going on. I see in the news today that there is a strike on the stadium work for the coming World Cup.
Filters are either active or passive. A capacitor and resistor can create a simple passive low pass or high pass. IF it works, that is the best solution. The active ones may be nicer about loss and tight cut off, but you would need an op amp or may be a high gain MosFET or Darlington.
I tried Piezoelectric speakers and they are very low wattage. Personally, I cannot enjoy listening to a digital devide that is less than 1 watt or more. So I've resolved to drive 2-3 watts for audio project. Below that seems pointless to me.
When integrated audio chips are appealing, they all seem to require odd power supplies as the transistor stages become more complex. This happens to be the same issue with building your own from transistors. I personally thing a Class D amp from a 2n2222 transistor is quite enough.
So to cut to the chase, you are likely to be able to set aside all the integrated circuits and get something useful with just good old transistors. Darlington pairs can also jump the power. After all, this is just audio bandwidth and doesn't have the impedance complexities of RF.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Ain't gadetry a wonderful thing?
aka G. Herzog [noparse][[/noparse] 黃鶴 ] in Taiwan
I want to develop a device to catch little critters that are supposed to give off a chirp at 40KHz (probably lower than this but ultrasonic anyway). I was going to use a couple of direction mics. To develop this device, I need a fairly clean ultra-sound source (of variable frequency) to simulate the critter. I thought I'd just use an SX and a small audio amp. It's turning out slightly more difficult, and I haven't even started thinking about the critter catching device yet...
The ultrasonic noise these critters put out is apparently massive but for testing purposes, I just need the ultra-sonic equivalent of 60 or 70 dBA.
Strange - Now that South Africa is aligned to China and our Communist party is in the Government coalition, Taiwan doesn't exist. You guys aren't even on the map The West's approach to Communism has changed but the Communists’ ideology hasn't changed. “The enemy of my comrade is my enemy too”.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
-Phil
Sadly, the first thing China does when it gets friendly with a nation is demand that Taiwan be considered a province of China. Slowly it looks like Taiwan is going back to the the mainland. A mainland Chinese company just bought 20% of the Taipei 101 building which is considered a national landmark. Of course, if China wants to arrest executives of Rio Tinto as spys due to driving a hard bargain in iron ore prices, we are in a very strange new world of globalized business.
One day soon I may have to decide whether to become a Chinese citizen and watch what I say, relocate to another place in Asia, or return to the USA. Certainly weird. I'd really hate to leave my dog behind.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Ain't gadetry a wonderful thing?
aka G. Herzog [noparse][[/noparse] 黃鶴 ] in Taiwan
Probably not the same "critters", but I thought I would share...
Once upon a time, several years ago,·at 3 or 4 in the morning I was working outside in my little outdoor shed doing some experiments with short distance low baud rate ultrasonic communication.
·
During an early testing stage of·simply an optimal transmitter and receiver, I had a transmitter just sending continuous non stop 40 KHz.
·
Likewise I had a receiver that I heterodyned the incoming signal with a local oscillator of 38 kHz so that I could "hear" the signal and tune my transmitter and receiver based on an audable·2kHz beat frequency.
·
Well... I kept getting what I thought was interference ... loose wire, bug in my code, something.· At some point I turned the Transmitter completely OFF and still heard “something” from the receiver that·was actually quite elegant when the transmitter was off.· Moving the receiver around to "track" where the mystery sound was coming from revealed a flying·insect.· An insect! ...that I probably had attracted with the transmitter.· The insect looked like a "stink bug" with a grayish-blue outer shell.
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
·
The problem was matching the impedance between the “SX ladder DAC” and the OP-AMP. I thought that the ADC would give a better signal into a high impedance so I gave the OP-AMP a 1 MEG input impedance. (I know very little about matching output and input impedance)
·
Phil’s comments got me thinking. I reduced the impedance the ADC feeds to 50K Ohms and the problem vanished. Reducing the impedance to 5K made no further difference, good or bad.
·
No filter needed, ·no fancy additional circuit.
·
Last night, I successfully ran it at 10K Hz, 30K Hz 40K Hz and 110K Hz. The only interesting side effect was that when I was running it at 30 K Hz, I turned up the volume and the wild cat that lives with me left the house·in a big hurry. He returned this morning is a real foul mood. I didn’t know cats could hear such high frequencies.
·
Hey this device is fun, you can quickly develop any waveform you want in Excel and then paste it into your SX program. It’s so easy and so quick, it only takes a couple of minutes!!!
The only slight negative feature of this "poor mans signal generator"·is that when you turn all bits from ON to OFF, you get an 800 mV spike. This doesn't affect me because I need a sine wave. (The spike at the top of the wave in the 3rd diagram - the signal is inverted)
Thanks again and have a great weekend
John Bond
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Post Edited (John Bond) : 7/10/2009 6:29:38 AM GMT
I still think that audio chip/op amp is nearly worthless. One could just as easily build a one-stage class A amp from a few individual components and get more output. Often a Class D amp of one transistor is all you need.
The ADC did give a better signal at high impedance, just too much real detail for your use. Detuning the impedance is your low pass filter.
You may have to provide ear plugs for your wild cat if this experimentation is to continue.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Ain't gadetry a wonderful thing?
aka G. Herzog [noparse][[/noparse] 黃鶴 ] in Taiwan
Post Edited (Loopy Byteloose) : 7/10/2009 8:03:58 AM GMT
You’re right. A quick transistor circuit would work better. I lack analogue experience so I felt the overload protection, the ability to change the gain over a wide range and the general stability was important to me.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Ain't gadetry a wonderful thing?
aka G. Herzog [noparse][[/noparse] 黃鶴 ] in Taiwan