Measuring Ambient sound Levels
Is it possible to use a microphone with a R-C circuit and an RCTIME command to measure ambient sound levels easily with a BS2? I am thinking about using this in a robot.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Giggly Googley!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Giggly Googley!

Comments
I am working on a project that monitors classroom noise levels. You are going to need to amplify the sound.
Part of it depends on what volume levels you want to measure. Take a look at op amps. A couple to llok at would be LM386, single supply and LM741, dual supply. Both of those can be had at RatShack.
Jonathan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Giggly Googley!
For me, I am intersted in the range whispering to ordinary speech volume. To do this effectivly, I used an electret mic run through 2X 741's, fed to a 12 bit ADC.
Try an electret mike, bias it with a 10k and run it into a LM386. See if that works for ya.
Jonathan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Giggly Googley!
Jonathan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
I haven't tried it yet, but I can post how it works when I get around to it.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--DFaust
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Giggly Googley!
The ADC produces an 8-bit binary value (0-255). You can easily convert it to decimal for display purposes. Internal to your program, it's just a number.
The "Basic Analog and Digital" tutorial in the Stamps in Class series has plenty of information on these ADC including sample programs. Download a copy from the Parallax website.
The LM386 is a medium power amplifier used to drive headphones or small speakers. It's not really suitable for this type of low level audio circuit. The LM741 is really a cheap, basic, buy anywhere type of op amp that will work well in this circuit.
All good questions... And I have to mention here that I have no formal training in electronics at all, so take what I say with a grain of salt. However, I did just make a very similar circuit and it is working so...
OK, a couple of things to remember in a circuit like this. The 741 in the picture you linked is being used as a single supply amplifier. This means that with no input, the output voltage will be 2.5 volts. The maximum voltage out will be around 4V. So, you have around 1.5V of swing.
The ADC shown is 8 bit. That means it will make a number between 0 and 255. It will read around 127 with no input. It will read about 204 at max voltage. So, you will have about 77 ADC counts in your full range.
Actually, that isn't quite true. It will be a little less because of the voltage drop across the diode. Use a Schottkey type diode to minimize the voltage drop to about .7V.
The level of amplification is set by the resistor between the output and the +input of the 741.
If this is good enough resolution for your needs, great. If not, there are ways to increase the resolution. You can get an ADC with more bits. You can get an ADC that has + and - Vref inputs so you can narrow the range. You could opt for a dual power supply (-5V/gnd/+5V) and get a greater swing from the op-amp. You can cascade the output from one op-amp into another and amplify it again. A lot depends on what you want to do. Tell us more about what you want it to do.
Jonathan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Giggly Googley!
Sorry if I got it all complicated. It's not as bad as I made it sound. The code part is easy, don't worry.
OK, lets talk just distinguishing noisy from quiet. Instead of using an ADC, another way is to use two 741's. One is used as an amplifier as we have discussed. The other is used as a comparator. There are many tutorials on comparators out there, so I'll just say that the comparator allows you to set a voltage (sound) level at which the comparator will either turn on or off, as you configure it. You can monitor the output of a comparator with a Stamp pin. In this setup, you set the volume threshold with a pot.
Second way is to use the 741 as an amplifier, and then use RCTIME to monitor the voltage. This will allow you to set the threshold in code instead of physically with a pot.
Trying these two ways first will allow you to see if a simple setup will do what you want, and cost less than 10-20 bucks, all parts available at ratshack. If it isn't adequate, all the parts you bought will still be used trying a more complex system.
Go to ratshack or similar and get:
2 X LM741 Maybe get 3 in case you burn one.
A pack of 1/4 watt resistors of varying values
A pack of misc. electrolytic caps
small 10k, 50k, 100k pots
couple of LEDs
If you have a breadboard, wires etc, that should get you going. Mess about with amplifier and comparator circuits.
Jonathan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Giggly Googley!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Giggly Googley!
Yup, the highlighted are is what to use. You can put an LED where you indicate, but it will drop the voltage. Try sending the signal directly to your RCTIME circuit.
If you want an LED to indicate volume level, you can run the ouput into a comparatot circuit. You can do botyh at the same tim, meaning the output of the op-amp goes to both the RCTIME circuit and the comparator. If you really want the LED to indicate volume, not just when it hits a threshold, look at using a 741 as a current follower. This will allow you to use the LED and not effect the output of the op-amp.
HTH,
Jonathan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
Could you post your STAMP code you used with the ADC you mentioned in the thread?
·
'{$STAMP BS2e}
' {$PBASIC 2.5}
time VAR Word
DO
'HIGH 9
PAUSE 3
RCTIME 9, 3, time
DEBUG HOME, DEC time
LOOP
and I'm using the area circled in red from that previous post. What am I doing wrong?? I don't have capacitors as low as the values on the schematic, so I am substituting the .047uf for different values (.1uf, .01uf, 3uf) and NONE of them work. The debug window just says "1", and the status light (the red one that blinks when the BS2e is sending a message to the debug terminal) flashes EXTREMELY fast.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Giggly Googley!
The RCTIME command does not function in the way that you are trying to use it.
By using an additional pin connected to the POWER supply of your MIC and 741, you MIGHT be able to use configuration "A" ... (untested)
Your best results will come from using an external ADC as your·schematic indicates.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Giggly Googley!
Here is the product page for it: http://www.projectsunlimited.com/audioproducts/movieclips/products/audioDetailPrint.asp?CATEGORY=4&PARTNUMBER=PUM-5050P-2-R&Guid={7210F803-61A1-45A8-AA08-1ADB762CD219}
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--DFaust
That circuit that you posted, the part circled in red, has no means to reset the voltage on the capacitor. Once a sound occurs, the capacitor will hold the voltage "forever" until a louder sound comes along, which will only increase the voltage on the capacitor. You could add a resistor in parallel with the capacitor, so that it self-discharges. Several megaohms. That will be important if you use an ADC. The circuit might have worked as it is, but that would be just an accident of having enough leakage. Another thing about that circuit. The diode is not inside the feedback loop, so the circuit will not respond to low level signals. If the diode is moved inside the feedback loop, the output could follow the sound down to low levels. (Google peak detector) Increase the circuit gain if necessary. The gain as it stands is only x2, and that does not seem like enough to me for an electret, unless the electret itself has a preamp with voltage gain.
That circuit responds to the instantaneous peak sound level. It is possible to make circuits like this that respond to the average (integrated) sound level. What type of sound are you trying to detect?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Giggly Googley!
·
I have attached a derivative of your original schematic... (TESTED)
·
You can substitute, try experimenting and see what values you come up with (smaller values will give you better resolution though)... and C2 and C3 are not electrolytic ... regular ceramic disc capacitors should work fine.
·
The circuit that I have included uses the diode(s) in a way that will be·sensitive to low level signals.
·
In your original Circuit, Gain can be calculate by dividing R4 by R9... 200k / 100k = 2
·
In the circuit that I provided, Gain can be calculated by dividing R4 by the sum of R9 and R10.· Since R10 is a 100K Potentiometer, and R4 is 1 Meg, you can adjust the Gain from x10 to x1000.
If you need more gain than that, you can replace R4 with a 10Meg resistor... Gain = x100 to x10,000
·
Notice that I have added a SQUELCH adjustment... this is actually a Voltage reference that ideally should be at 2V, but because of differences in the diodes, output of the Op-Amp, and I/O pin supplying Power(not right at 5V),·adjustments are required·so that the normal noise floor from the microphone is·at the threshold level of the I/O which is about 1.4Volts.· This works out so that a 2Volt reference minus a Diode voltage drop(0.6V) places you right at about 1.4Volts·....· In other words, when the RCSOUND.BS2 program is running, you adjust the SQUELCH until you "just" see where the value fluctuates·between a "1" and·some low value·returned number.
·
·
The·operation of the design is as follows....
·
1) Make the·POWER_PIN HIGH providing power·to the Microphone, Op-Amp, and Vref portion of the circuit.
··· Note:
··········· While the Power Pin is·HIGH D3 blocks the ability for C2 to discharge
············During·the period that you make the pin HIGH, the circuit acts like a·Peak Detector and stores·the maximum voltage value in C2 for that period.· (wait at least 1mS for the sample duration).
··········· Subsequent periods will reset the "Peak Detector".
·
2) After a determined·"sample" duration, make the POWER_PIN LOW and use·the RCTIME command to·detect the amount of time it takes C2 to discharge.
··· Note:
··········· Since the POWER_PIN is now·LOW,·C2 is now allowed to·discharge through D3 and R11.· Experiment with different values for R11 and C2 for different RC time constants.
··········· The returned value here is proportional to the detected volume level.
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Post Edited (Beau Schwabe (Parallax)) : 11/12/2007 4:47:08 PM GMT
If you really want to know the volume level, keep pursuing the ADC and RCTIME circuits. You'll figger it out. Any chance of getting access to a 'scope? Parallax sells a little USB scope, and there are many other out there. Or perhaps a school might let you use one. Thenyou could see exactly what is going on with your circuit.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
The peak detector is the second half of the circuit. The first section of the circuit provides the voltage gain. I don't know how much voltage your electret mic puts out, but I tested a little Knowles mic capsule I have here, and it put out around 100 millivolts peak when I clapped right next to it. The peak died out rapidly to a longer lower level, all together about two milliseconds. So a gain of 10 or 20 would be fine for that, but more gain would be necessary for the more distant sound. This really might be better with a nonlinear amplifier (compressor).
Dual op-amps like the LM358 are more modern than the '741. The LM358 has both op-amps in one 8 pin package and it operates off a single supply of 0 and 5 volts. I think Parallax stocks the LM358. It is a "jellybean" and is available even at the Rat Shack.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
Thank you! That was EXACTLY what I was looking for! One last thing: I have been seeing "(x)V Ref" (reference) in shcematic recently, but I never knew what it means. What does that mean? Do I just simply connect it to 2V?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Giggly Googley!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Giggly Googley!
In his usual clever fashion, Beau has turned a shortcoming of the op-amp into a feature of the circuit. The LM741 op-amp is usually characterized for +/-15 volt power supplies, not for operation on a single 5 volt supply as it is here. One factor is how far the input and output voltages can swing. Outside that range the op-amp ceases to operate as an amplifier. For the LM741 on 5 volt supplies, the typical input range would be 1 volt centered on 2.5 volts. If the input is below 2 volts or above 3 volts it won't work. The output too has limits that are typically a swing of 3 volts on a 5 volt supply, so the output can't be made to go below 1 volt or above 4 volts. By setting the Vref to around 2 volts, you are finding the threshold voltage for your op-amp, and if you put it a tiny bit below the threshold, it will "squelch" unwanted noise. See, how Beau turns a drawback into a feature!?
Furthermore, those figures for the input and output swing are "typlcal" as listed on the data sheet, so they will be a little different on every LM741, and that is why the threshold has to be adjustable. The data sheet gives both typical values and also worst case values for the swing. If your LM741 happened to be one with the worst case characteristics, the circuit won't work at all on the 5 volt supply. That very unlikely, but possible. It is a stretch to extrapolate 5 volt characteristics from a data sheet that only gives characteristics at +/- 15 volt power supplies. A true single supply (rail to rail) op-amp would not have those issues.
The way the diode is connected at the output also provides some "squelch" (as Beau also observed). The output signal has to overcome the 0.6 volt forward drop of the diode before it starts to charge the output sampling capacitor. Sounds below a certain level won't pass that threshold.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
Post Edited (Tracy Allen) : 11/14/2007 5:38:11 PM GMT
http://store.qkits.com/moreinfo.cfm/MK115
http://store.qkits.com/moreinfo.cfm/K4304
http://store.qkits.com/moreinfo.cfm/K4306
on the 10 led kit you can merge every 2 leds to bring the outputs down from 10 to 5 outputs
you then just poll those outputs using count command for each of the 5 pins
and then do whatever logic you want to do
basically dont reinvent the wheel
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Brilliant! I didn't know it worked like that. Now THATS ingenuitive thinking!! Thank you all very much. You opened up a wide window for me! Now I just need to get some pots., and I'll start building! Here's the code so far if anyone wants to take a look at it:
' {$STAMP BS2e} ' {$PBASIC 2.5} pingtime VAR Word ' distance measurement from Ping))) cdstime VAR Word ' main photocell rctime leftcdstime VAR Word ' left photocell rctime rightcdstime VAR Word ' right photocell rctime pulsecount VAR Word ' pulse counter for servos dropoffircounter VAR Byte ' This is to prevent interference between IR modules 'average VAR Word ' for CdS 'difference VAR Word ' front cells ' -----[noparse][[/noparse] Navigation Variables/Constants ]--------------------------------------------------------------------------------- ' generic values i VAR Byte ' loop counter, whatever tmp VAR Word ' temporary holder seed VAR Word ' random number seed ' these are for the servo routines LEFT CON 13 ' left wheel port RIGHT CON 12 ' right wheel port SACT CON 5 ' times through act routine drive VAR Word ' wheel command combo ldrive VAR drive.BYTE1 ' left wheel command rdrive VAR drive.BYTE0 ' right wheel command aDur VAR Byte ' duration of pulse left 'avDir VAR Word 'avDur VAR Nib ' servo drive commands fd CON $6432 ' forward (left = 100 ((16*6)+4), right = 50 ((16*3)+2)) rv CON $3264 ' reverse (left = 50 ((16*3)+2), right = 100 ((16*6)+4)) st CON $4b4b ' STOP (left = 75 ((16*4)+11), right = 75 ((16*4)+11)) tr CON $644b ' turn right (left = 100 ((16*6)+4), right = 75 ((16*4)+11)) tl CON $4b32 ' turn left (left = 75 ((16*4)+11), right = 50 ((16*3)+2)) rr CON $6464 ' rotate right (left = 100 ((16*6)+4), right = 100 ((16*6)+4)) rl CON $3232 ' rotate left (left = 50 ((16*3)+2), right = 50 ((16*3)+2)) ' wander values 'wstate VAR Byte 'shared Byte wDir VAR Word 'wander value wDur VAR Byte 'wander duration ' -----[noparse][[/noparse] Initialization ]------------------------------------------------------------------------------------------------- wDur = 0 'clear wander duration aDur = 0 'clear act loop counter 'wstate = 0 ' initial wander state FREQOUT 5, 1000, 2900 PAUSE 1000 GOTO Main ' -----[noparse][[/noparse] Main Program ]--------------------------------------------------------------------------------------------------- Main: GOSUB wander GOSUB Check_CDS GOSUB avoid GOSUB act GOTO Main Check_CDS: HIGH 0 PAUSE 3 RCTIME 0, 1, cdstime 'DEBUG HOME, "cdstime = ", DEC5 cdstime IF cdstime > 4500 OR cdstime = 00000 THEN HIGH 11 ' ELSEIF cdstime > 10000 THEN 'GOSUB escape ELSEIF cdstime > 4500 AND cdstime < 10000 THEN FREQOUT 5,200,5000 PAUSE 100 FREQOUT 5,100,1000 PAUSE 100 FREQOUT 5,250,4000 PAUSE 1000 ELSE LOW 11 ENDIF IF cdstime > 6000 AND cdstime < 5950 THEN FREQOUT 5,200,5000 PAUSE 100 FREQOUT 5,100,1000 PAUSE 100 FREQOUT 5,250,4000 PAUSE 1000 ENDIF RETURN avoid: ' The following IF statement requires a counter variable to prevent interference between the GP2D12's, and the ' standard IR module. FREQOUT 10, 1, 37500 ' send frequency pulses of 41,500KhZ to the IR LED IF IN9 = 1 THEN ' if no floor is detected, then dropoffircounter = dropoffircounter + 1 ' add to the counter ELSEIF IN9 = 0 THEN ' if the floor is detected, then dropoffircounter = 0 ' reset the counter ENDIF IF dropoffircounter > 5 THEN ' if detection threshold for dropoff IR is reached, FOR pulsecount = 0 TO 110 ' then back up PULSOUT 13, 620 PULSOUT 12, 850 NEXT FOR pulsecount = 0 TO 220 ' ...and rotate right ~180 degrees (turn around) PULSOUT 13, 820 PULSOUT 12, 850 NEXT dropoffircounter = 0 ENDIF IF IN6 = 1 THEN ' if left IR detects something, PULSOUT 13, 820 ' rotate right PULSOUT 12, 850 ENDIF IF IN8 = 1 THEN ' if right IR detects something, PULSOUT 13, 620 ' rotate left PULSOUT 12, 650 ENDIF ' The following IF statement is to prevent from getting stuck in tricky places IF IN6 = 1 AND IN8 = 1 OR IN6 = 1 AND IN8 = 1 AND pingtime < 600 THEN ' if left IR and right IR detect something, or if left IR and right IR and ping detect something all at once, FOR pulsecount = 0 TO 220 ' then rotate right ~180 degrees PULSOUT 13, 820 PULSOUT 12, 850 NEXT ELSEIF IN6 = 1 AND pingtime < 600 THEN ' if left IR and ping detect something all at the same time, FOR pulsecount = 0 TO 110 ' then rotate right ~90 degrees PULSOUT 13, 820 PULSOUT 12, 850 NEXT ELSEIF IN8 = 1 AND pingtime < 600 THEN ' if right IR and ping detect something all at the same time, then FOR pulsecount = 0 TO 110 ' rotate left ~90 degrees PULSOUT 13, 620 PULSOUT 12, 650 NEXT ENDIF PULSOUT 15, 5 PULSIN 15, 1, pingtime IF pingtime > 600 THEN avdone IF pingtime < 600 THEN avdo RETURN avdo: LOOKUP i, [noparse][[/noparse]rr, rl, drive], tmp drive = tmp i = 0 'clear history avdone: RETURN 'Check_Busy: 'PAUSE 1 ' allow busy to activate 'DO WHILE (Busy = Yes) : LOOP ' wait until not busy 'RETURN wander: ' randomly wander around IF wDur > 0 THEN wDone1 RANDOM seed ' random direction i = seed & %111 ' mask off for 0-7 only LOOKUP i,[noparse][[/noparse]fd,tl,fd,fd,fd,fd,tr,fd],wDir 'chose direction seed = seed + i wDur = (seed & %111111) + 20 ' mask for 64 choices of duration wDone1: wDur = wDur - 1 'decrement wander counter drive = wDir 'get direction RETURN 'completed 'wander: 'BRANCH wstate,[noparse][[/noparse]wcDir,wcDur] ' state 2 immed. follows 'wDur = wDur - 1 'IF wDur > 0 THEN wDone1 'drive = wDir ' get direction 'wstate = 0 ' reset state 'wDone1: 'RETURN ' completed 'wcDir: ' choose direction 'RANDOM seed ' random direction 'i = seed & %111 ' mask off FOR 0-7 only 'LOOKUP i,[noparse][[/noparse]tr,fd,fd,fd,rr,fd,fd,tl],wDir ' chose direction 'wstate = 1 ' next state 'RETURN 'wcDur: ' choose duration 'RANDOM seed ' random direction AND duration 'wDur = (seed & %111111) + 20 ' mask FOR 64 choices 'wstate = 2 ' next state 'RETURN act: ' moves servo motors IF aDur > 0 THEN aDec ' already doing one, got here aDur = SACT ' times through this one PULSOUT LEFT,ldrive * 10 PULSOUT RIGHT,rdrive * 10 aDec: ' decrement stuff aDur = aDur - 1 aDone: RETURN 'escape: 'DO 'GOSUB Test_Photoresistors 'GOSUB Average_And_Difference 'GOSUB Navigate 'LOOP UNTIL cdstime < 4000 'return 'Test_Photoresistors: 'HIGH 3 'PAUSE 3 'RCTIME 3,1,leftcdstime 'HIGH 2 'PAUSE 3 'RCTIME 2,1,rightcdstime 'GOTO Average_And_Difference 'Average_And_Difference: 'average = rightcdstime + leftcdstime / 2 ''difference = average / 6 'GOTO Navigate 'Navigate: ' Shadow significantly stronger on left detector, turn right. 'IF (leftcdstime > rightcdstime + difference) THEN 'PULSOUT 13, 820 'PULSOUT 12, 850 ' Shadow significantly on the right detector, turn left. 'ELSEIF (rightcdstime > leftcdstime + difference) THEN 'PULSOUT 13, 650 'PULSOUT 12, 650 ' Shadows in same neighborhood of intensity on both detectors. 'ELSE 'PULSOUT 13, 820 'PULSOUT 12, 650 ' ENDIF 'IF IN6 = 1 THEN 'PULSOUT 13, 820 ' rotate right 'PULSOUT 12, 850 'elseIF IN8 = 1 THEN 'PULSOUT 13, 620 ' rotate left 'PULSOUT 12, 650 'ELSEIF pingtime < 600 THEN 'PAUSE 10 'GOTO escape ENDAnything that is commented out is either not being used, or I am unable to figure out how to properly utilize it. Unfortunately, I am using a standard IR detector (3-pin; on pin 9) from Parallax for drop-off detection. This may not be the wisest thing to do at the moment, but it is all I have. Soon, I'll get a Sharp GP2D12 IR sensor for that. They really are great for the price, power consumption, and ease of use, and are virtually immune to noise/interference. Pins 6 & 8 are connected to two Sharp GP2D12's.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Giggly Googley!