Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Analog sound and light detection module
#1
For many robotics projects, the detection of sound and/or light allows your robot to responds to real-life events. And I really wanted to output analog signals, so the program running on the (Arduino?) controller can identify significant signals above the average noise level.

The light part is trivial: By connecting a photo resistor (or LDR: Light Dependent Resistor) R6, in series with a fixed resistor R5, between the supply voltage (+5V) and ground (GND), one can read the voltage over the LDR with an Arduino analog input.

   

For the sound, I used circuits that I found on the web, with some modifications, and the result is shown in the image. The circuit is based on an electret microphone capsule (10 pieces for $1.24 at Aliexpress), a 2N3904 transistor, four resistors, two capacitors, plus a diode. An additional capacitor C1 is used to stabilize the supply voltage. The electret microphone is polarized. It is important to connect that pin to ground which is also connected to its case. The amplifier circuit is made of C1, R2, R3, and T1. The diode clips the negative part of the signal and C2 and R4 form a RC circuit that stores the peaks for a time interval equal to t=R*C, which is 0.01 sec for these choices. The "sound-out" and "light-out" outputs are directly connected to two analog inputs of the Arduino.

The microphone capsule and the photo resistor are soldered on the bottom of the circuit board on a piece of black felt which hides the circuit board through the openings for the microphone and the photo resistor.

   

While I have not finished the Arduino code, this is what I'm planning to do:
Read the sound level every 0.01 sec over an interval of 0.2 sec and store the maximum value of these twenty readings. Use these maxima to compute a rolling average. If the current maximum is significantly larger than the previous average (either: the previous average plus some constant; or the previous average times a fixed factor) then set the "sound detected" trigger.
Reply
#2
Cool, let us know how it goes! I think Savage has played with some sensing stuff too, but he hasn't posted much about it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)