carlynorama

the blog

Eagle 30/30 No. 20 – Hand-Gun Sensor Mic and the Ground Plane (LM386 v0.1.b)

by Carlyn Maw on June 21, 2011, no comments

There is this succinct tutorial from Muzique.com. TL;DR and Notes from me
  • Use the polygon tool on the copper layer you want the plane to be on. It can be bigger than your board outline, Eagle will trim it.
  • Name the polygon GND or whatever your ground net is called with the name tool
  • It will be just an outline until you hit the Ratsnest button, can undo that by “ripping up” the polygon
  • The next time you open the file it will be hollow again. Add the RATSNEST *; command to your eagle.scr file if that bothers you. (ripup @; if the reverse bothers you)
  • Change the default “isolation” setting for the polygon (in the Info panel) to give traces some extra room. I use the same width as the traces I’m routing, but 0.012 is a good minimum
  • To hide power wires while routing everyone else RATSNEST ! GND VCC  (if those are what you called those nets )   
  • RATSNEST * to make sure everyone is showing again (check out HELP RATSNEST for more fun tricks)

There is some talk that OpAmp / Power Amp circuits don’t like ground planes in some circumstances… I’m not sure if this is one of them. Some articles say they are good for amplifiers, lots of discussion boards with smart people seem to say the opposite.  I actually put my signal wire on the bottom copper, poured the ground plane, ripped up the signal wire and rerouted it on the top. The problem is that this doesn’t hold from one day to the next (see bullet 4). Putting some wire lines on brestrict (layer 42) would keep the plane from pouring there. However, this may be exactly what I shouldn’t do.  I clearly need to read more. Henry Ott seems to be ‘the man’ for the Grounding of Mixed Signal PCBs subject and Mr. Ott says no slots!

Second:  Where did this circuit and the component values come from? How do you use it?

This circuit came from:

This table is to try to help clarify a little bit about the part values in the circuit. In this circuit VCC is a regulated 5V supply. That is not always the case with amplifiers, it is just that this one is for using a mic as a sensor for an Arduino.

Component

Phys Comp

Prac. Inv.

Evil Genius

Notes

R1

1K Ohm

N/A

N/A

Will change depending on the mic a bit. Think voltage divider with a low impedance mic on one side of it (the data sheet of the MD9745APZ-F says 2.2K Ohm, Mnf Page: Knowles) ) 

C1

4.7 uF

N/A (10uF in other amp circuits)

2.2 uF

None in the Smokey,as low as 0.01uF in other lil amps. This is the coupling capacitor, it passes AC while filtering out an DC background noise. It is also an initial signal noise filter, so keep that in mind if looking at a particular frequency range.

VR1

10K Ohm

10K Ohm

10K Ohm

Volume

R2

10K Ohm

10K Ohm

10K Ohm

R2 and C2 together change the gain from the default of 20 to basically whatever you want between 20 and 200. This is the 200 version. 

 

C2

10 uF

10 uF

10 uF

C3

N/A

0.1uF

0.05 uF

C3 & R3 together “Output Sound Shaping”

 

R3

N/A

10 Ohm

10 Ohm

C4

N/A

to GND

0.01 uF

Pin 7, the great mystery. Seen everything from this 0.01 uF to 47 uF in the Smokey Amp. This seems to be the the way to create pass filters for the data (big caps for low pass/bass, little caps for high pass/treble) Audiophiles use this pin for Hum Reduction

C5

220 uF

250 uF

220 uF

Also a filter – Up for more bass, down value for less bass. Also a coupling capacitor whose value technically should be 1/(2πƒR) where R is the load Resistance and ƒ is the cuttoff frequency (Prac. Elec. p 622)

R4, R5

100K

N/A

N/A

These two are shifting the line level back to the middle of the Arduino’s 5V range. 

C6

N/A

N/A

N/A

1000 uF is seen on Amp power supplies a lot. Including the SparkFun board. Depending on the rest of your circuit it may be overkill. If you don’t have one you can try with 33 uF or 100 uF…

IC1

LM386-1

LM386

LM386

If this to be used for the Arduino, must be a model that works with only 5V supplied to it.  The can be less noisy, though, the more power they are getting.  If you are thinking of using a different IC read this Electronix Express write up on Audio Amplifier Basics.

Secondly, interpreting the signal data. In one of the links I posted yesterday the writer rectified the output to make the coding easier. This will loose data as each of those diodes has a voltage drop associated with it. Better to fix it in software. 

The signal of the microphone is AC so the values the chip’s ADC sees will swing “wildly” across the midpoint determined by the line leveling part of the circuit (R4 & R5). Determine what the midpoint is (around 512-ish) and either ignore values below it or check for either amplitude extreme: 

s = analogRead(A0);
if (s > 700 || s < 300) { do(the_thing) };  

There are other things besides threshold checks that can be done, like frequency counting, etc, but just checking the amplitude data will get the “Did someone clap?” question answered.  Changing the capacitors on some of the filters might make it more of a “Did someone whistle?” or “Did it thunder?” but audio circuits are not my strength.