Sound Detector Hookup Guide

Similar documents
INA169 Breakout Board Hookup Guide

APDS-9960 RGB and Gesture Sensor Hookup Guide

ZX Distance and Gesture Sensor Hookup Guide

Using the VM1010 Wake-on-Sound Microphone and ZeroPower Listening TM Technology

Rotary Switch Potentiometer Hookup Guide

555 Morse Code Practice Oscillator Kit (draft 1.1)

TV Remote. Discover Engineering. Youth Handouts

LT Spice Getting Started Very Quickly. First Get the Latest Software!

Capacitive Touch Sensing Tone Generator. Corey Cleveland and Eric Ponce

EE283 Electrical Measurement Laboratory Laboratory Exercise #7: Digital Counter

MAINTENANCE MANUAL AUDIO MATRIX BOARD P29/

Getting started with the SparkFun Inventor's Kit for Google's Science Journal App

Electronics. RC Filter, DC Supply, and 555

Pi Servo Hat Hookup Guide

IPR LA-3 KIT last update 15 march 06

// Parts of a Multimeter

AN-1106 Custom Instrumentation Amplifier Design Author: Craig Cary Date: January 16, 2017

Rowan University Freshman Clinic I Lab Project 2 The Operational Amplifier (Op Amp)

DEPARTMENT OF ELECTRICAL ENGINEERING AND COMPUTER SCIENCE MASSACHUSETTS INSTITUTE OF TECHNOLOGY CAMBRIDGE, MASSACHUSETTS 02139

9DoF Sensor Stick Hookup Guide

DEPARTMENT OF ELECTRICAL ENGINEERING AND COMPUTER SCIENCE MASSACHUSETTS INSTITUTE OF TECHNOLOGY CAMBRIDGE, MASSACHUSETTS 02139

Touch Potentiometer Hookup Guide

11. Audio Amp. LM386 Low Power Amplifier:

1 Second Time Base From Crystal Oscillator

Adafruit 16-channel PWM/Servo Shield

AD8232 EVALUATION BOARD DOCUMENTATION

CI-22. BASIC ELECTRONIC EXPERIMENTS with computer interface. Experiments PC1-PC8. Sample Controls Display. Instruction Manual

nrf24l01+ Transceiver Hookup Guide

For the filter shown (suitable for bandpass audio use) with bandwidth B and center frequency f, and gain A:

UNIVERSITY OF UTAH ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT ELECTROMYOGRAM (EMG) DETECTOR WITH AUDIOVISUAL OUTPUT

Electret Mic Breakout Board Hookup Guide

Week 8 AM Modulation and the AM Receiver

EE43 43/100 Fall Final Project: 1: Audio Amplifier, Part Part II II. Part 2: Audio Amplifier. Lab Guide

BME 194: Applied Circuits Lab 04: hysteresis

ECE3204 D2015 Lab 1. See suggested breadboard configuration on following page!

MAS.836 HOW TO BIAS AN OP-AMP

EE320L Electronics I. Laboratory. Laboratory Exercise #2. Basic Op-Amp Circuits. Angsuman Roy. Department of Electrical and Computer Engineering

Adafruit 16-Channel Servo Driver with Arduino

Pulse Sensor Individual Progress Report

Adafruit 16-channel PWM/Servo Shield

AS726X NIR/VIS Spectral Sensor Hookup Guide

Heating Pad Hand Warmer Blanket

Adafruit 16-Channel PWM/Servo HAT & Bonnet for Raspberry Pi

University of Utah Electrical Engineering Department ECE 2100 Experiment No. 2 Linear Operational Amplifier Circuits II

Blackaddr Audio. GTA Pro (PCB Rev 2/A) User Guide v1.0

University of North Carolina-Charlotte Department of Electrical and Computer Engineering ECGR 3157 Electrical Engineering Design II Fall 2013

The B7 Discrete Operational Amplifier Author: Tamas G. Kohalmi 7/5/2004

3 Circuit Theory. 3.2 Balanced Gain Stage (BGS) Input to the amplifier is balanced. The shield is isolated

Designing Microphone Preamplifiers. Steve Green 24th AES UK Conference June 2011

LBI-30398N. MAINTENANCE MANUAL MHz PHASE LOCK LOOP EXCITER 19D423249G1 & G2 DESCRIPTION TABLE OF CONTENTS. Page. DESCRIPTION...

EE 233 Circuit Theory Lab 3: First-Order Filters

The Infinity Bug. This is an amazing project... Order kit Fully assembled version $199 Order Infinity Bug

EXPERIMENT 2.2 NON-LINEAR OP-AMP CIRCUITS

B.E. SEMESTER III (ELECTRICAL) SUBJECT CODE: X30902 Subject Name: Analog & Digital Electronics

Sweep / Function Generator User Guide

Bill of Materials: General Purpose Alarm, Pulsed PART NO

Adafruit 16-Channel Servo Driver with Arduino

Simon Tilts Assembly Guide

ERICSSONZ LBI-30398P. MAINTENANCE MANUAL MHz PHASE LOCKED LOOP EXCITER 19D423249G1 & G2 DESCRIPTION TABLE OF CONTENTS

Electronic Components

A2 Electronics Project: DARPS: A Digital Audio Recorder and Playback System. Name: Andrew Cottrell Year: 2011

Digital Applications of the Operational Amplifier

N3ZI Kits General Coverage Receiver, Assembly & Operations Manual (For Jun 2011 PCB ) Version 3.33, Jan 2012

JCM W GUITAR AMPLIFIER. User s Manual

Adafruit 16-Channel PWM/Servo HAT for Raspberry Pi

Adafruit 16-Channel Servo Driver with Arduino

JCM W GUITAR AMPLIFIER. User s Manual

RadiØKit Μ CW HAM RADIO TRANSCEIVER KIT. Assembly and operating manual

Maintenance Manual ERICSSONZ LBI-31552E

Analog Effect Pedals. EE333 Project 1. Francisco Alegria and Josh Rolles

PowerAmp Design. PowerAmp Design PAD117A RAIL TO RAIL OPERATIONAL AMPLIFIER

Grounded Grid Plus Vacuum Tube Preamplifier User Manual. Analog Metric

Designing Information Devices and Systems I Spring 2015 Homework 6

Musical Pencil. Tutorial modified from musical pencil/

DynaMutt Driver Board for the Dynaco ST-70

VERSATILE AUDIO AGC CIRCUIT Dave Kenward G8AJN

SIMPLE DIRECT DRIVE DESULPHATOR/ DESULFATOR KIT INSTRUCTIONS

100UF CAPACITOR POTENTIOMETER SERVO MOTOR MOTOR ARM. MALE HEADER PIN (3 pins) INGREDIENTS

LED S METER CONSTRUCTION MANUAL. LED S meter Construction Manual Issue 1.0 Page 1

Operation and Maintenance Manual

LBI-31807D. Mobile Communications MASTR II REPEATER CONTROL PANEL 19B234871P1. Maintenance Manual. Printed in U.S.A.

ENGN/PHYS 207 Fall 2018 Assignment #5 Final Report Due Date: 5pm Wed Oct 31, 2018

LABORATORY EXPERIMENT. Infrared Transmitter/Receiver

Congratulations on your purchase of the SparkFun Arduino ProtoShield Kit!

Continuous Rotation Servo Trigger Hookup Guide

Threeneuron's Pile o'poo of Obsolete Crap

Final Project Stereo Audio Amplifier Final Report

Hearing Aid Redesign: Test Plans ELECTRICAL TESTING

For this exercise, you will need a partner, an Arduino kit (in the plastic tub), and a laptop with the Arduino programming environment.

ECE 511: FINAL PROJECT REPORT GROUP 7 MSP430 TANK

Op-amp characteristics Operational amplifiers have several very important characteristics that make them so useful:

LogicBlocks & Digital Logic Introduction a

50 ma, High Voltage, Micropower Linear Regulator ADP1720

Bend Sensor Technology Electronic Interface Design Guide

Effects of Initial Conditions in a DRSSTC. Steven Ward. 6/26/09

6. HARDWARE PROTOTYPE AND EXPERIMENTAL RESULTS

Polyphase network kit

VM2000. Low-Noise Bottom Port Piezoelectric MEMS Microphone Data Sheet Vesper Technologies Inc. Differential Analog Output

Main improvements are increased number of LEDs and therefore better temperature indication with one Celsius degree increments.

USER MANUAL SERIAL IR SENSOR ARRAY5

Transcription:

Page 1 of 12 Sound Detector Hookup Guide Introducing The Sound Detector The Sound Detector The Sound Detector is a small board that combines a microphone and some processing circuitry. It provides not only an audio output, but also a binary indication of the presence of sound, and an analog representation of it s amplitude. Covered in This Tutorial This tutorial will guide you through hooking up and using the Sound Detector. It will examine how the circuit works, explain some details about getting the best performance from the Sound Detector, then present two different projects that demonstrate how to use it. Suggested Reading How to Use a Breadboard Analog vs. Digital The Wikipedia article on sound. Quick Start To get started with the Sound Detector, simply connect it to a power supply. (Sound Detector Power Supply ) GND Supply Ground. VCC Power supply voltage between 3.5 and 5.5 Volts. 5 Volts is ideal. In a quiet room, power the board up, and then speak into the microphone. You should see the red LED on the board blink in response to your voice.

Page 2 of 12 With it s 3 outputs, the board itself is a lot more flexible. To explore that flexibility, read on. Looking Closer Three Outputs? The Sound Detector has 3 separate outputs. It s easiest to see what each is doing with a graph. The following illustrates how the sound detector responds to a series of sound pulses. Sample Sound Detector Output This shows the output voltages over time. The dark green trace is the audio output of the sound detector. The audio voltage directly from the microphone is found at this output. The light green trace is the envelope output. This analog voltage traces the amplitude of the sound. Of particular interest, notice that the third pulse gets noticeably louder as it goes. Finally, the red line is the gate output. This output is low when conditions are quiet and goes high when sound is detected. How It Works Having examined the outputs, lets also take a quick walk through the schematic, to gain an understanding of how each stage works. First Stage The first section of the circuit is an electret microphone capsule. This

Page 3 of 12 portion of the circuit borrows from the Electret Microphone breakout board. Microphone and Preamplifier The capsule is biased by the supply voltage through R1, and it outputs an AC voltage that is riding a DC offset of approximately ½ the supply voltage. The output from the capsule is an extremely small voltage, so the signal from the capsule is amplified by IC1G1, an operational amplifier stage. By default, the preamplifier has an arithmetic gain of 100 (20 db), and the gain can be adjusted by populating R17 (which we ll examine in detail on the next page). The audio output is DC coupled, riding one half the supply voltage, so it can be directly connected to the ADC of a microcontroller. In perfectly quiet conditions, it will ideally read ½ full scale, or 512 on a 10-bit converter. Second Stage The second stage of the circuit is an envelope follower. Envelope Follower IC1G3 forms an opamp-based precision rectifier. This stage implements the equation if(vin > 0) Vout = 0; else Vout = Vin 2.2 The opamp inverts and amplifies the signal. When it s output swings high, D2 turns on, and charges C1. When the opamp output is high or not swinging, D2 is turned off, and C1 discharges through R9. Thus, C1 tracks the peaks of the input signal. IC1G4 is a buffer amplifier, so external loads on the envelope pin won t change the C1 s charge/discharge behavior. This results in a signal that tracks the peak amplitude of the input signal. A louder sound will result in a higher voltage on the Envelope pin. As with the audio pin, the envelope can be connected to the ADC of a microcontroller. Third Stage The final stage implements a thresholded switch on the envelope signal.

Page 4 of 12 Schmitt Trigger The Schmitt trigger watches the envelope signal, and toggles the output when the threshold is exceeded. A Schmitt trigger is a comparator that adjusts it s threshold voltage when the output switches, requiring a higher voltage to switch on than to switch off. This allows it to ignore some ripple in the input signal, like the ripple present in the output of the envelope follower stage. The output of the Schmitt trigger is found on the Gate pin. You can connect it to a digital input. We ll use it to trigger interrupts in the software example. Outputs Each of the three output signals is present on the.1" header at the edge of the board. They are active simultaneously. If you aren t using one in your particular application, simply leave that pin disconnected. Configuration Care and Feeding Of The Capsule The heart of the Sound Detector is the electret microphone capsule without it, we couldn t convert acoustic energy into electrical energy. These capsules have a couple of quirks that we need to understand in order to apply them successfully. Inside the capsule is the diaphragm, which is actually one plate of a small capacitor. That capacitor forms a voltage divider with the external bias resistor. The diaphragm moves in response to sound, and the capacitance changes as the plates get closer together or farther apart, causing the divider to change. Since capacitors are sensitive to loading, it s internally buffered with a JFET (junction field-effect transistor). Due to the mechanical and electronic tolerances involved, some capsules are more sensitive than others. Also, the JFET is rather sensitive to noise on the power supply. Both of these factors need to be accounted for when deploying the Sound Detector. Power Supply The Sound Detector is an analog circuit, and as such, it s more sensitive to noise on the power supply than most digital circuits. Since the capsule is effectively a voltage divider sitting across the power rails, it will transcribe any noise on the supply lines onto the capsule output. The next circuit in the chain is a high-gain amplifier, so any noise on the supply will then be amplified. Therefore, the Sound Detector may require more careful power supply configuration than many circuits. In testing with various supplies, a significant degree of variability was discovered - some supplies are less noisy than others. One exhibited as much as 30 mv ripple on the supply output, an as a result, the the Sound Detector was rather sensitive and unstable. You can check how clean a power supply is by checking it with an oscilloscope or volt meter, set to the AC Volts (or, if provided, the AC millivolts) range. A truly clean supply will show 0.000 VAC. Based on the supplies used in testing, ripple of more than about 10 mv is problematic.

Page 5 of 12 Powering my Arduino with a 9V external supply, which allows the onboard regulators to function, the Arduino s 5V output was sufficiently clean. However, powering it from the 5V available on the USB port on a PC, the regulators are bypassed, and the results were somewhat less usable, and vary greatly between different ports on different PCs. A powered USB hub will probably provide cleaner power than the ports on the PC itself. If all else fails, three 1.5V batteries in series make a nice, clean source of 4.5V. Amplitude Calibration The Sound Detector comes set for moderate sensitivity - speaking directly into the microphone, or clapping your hands nearby should cause the gate output to fire. If you find that it doesn t work well in a specific application, you can change the circuit to be more or less sensitive. The gain is set by changing the feedback resistors in the preamp stage. The resistors are marked in the silkscreen on the PCB. Resistor Closeup R3 is a surface mount part, with 100K Ohm populated by default. R17 is an unpopulated position for a through hole resistor. Lowering The gain It s most likely that you ll find the detector to be too sensitive. In testing the board for this writeup, noisy air conditioning and music in the next office were enough to set it off. To make the board less sensitive, you can lower the preamplifier gain by populating R17 in parallel with R3. R3 Value R17 Value Arithmetic Gain Gain (db) 100K - 100 40 100K 100K 50 33 100K 47K 32 30 100K 22K 18 25 100K 10K 9 19 100K 4.7K 4 13 100K 2.2K 2 6 Raising The Gain If you want to make the sound detector more sensitive, so that it will be activated by quieter sounds, you can remove R3, and populate R17. R17 Value Arithmetic Gain Gain (db) 100K 100 40 220K 220 46 470K 470 53 1Meg 1000 60 Lights Out

Page 6 of 12 In some applications, the onboard LED may be distracting or undesirable. To disable it, simply use a solder sucker or wick to remove the solder blob from the jumper near the LED. Physical Considerations The electret capsule on the Sound Detector is also sensitive to mechanical vibration and wind noise. The Sound Detector will pick up handling noise. Mounting it with a resilient material can help absorb vibration placing it on a piece of open-cell foam helped reject vibration conducted through the testing workbench. Other resilient mounting strategies would include suspending it using rubber bands, or building shock absorbers using #4 machine screws and heatshrink tubing. Wind noise is caused when blasts of air enter the capsule. Examples would be a windy day, or the sharp exhalation that often accompanies syllables such p, b and t. The capsule come with a thin fabric covering, but it may not be enough to prevent stronger blasts. You can craft a more robust windscreen with open-cell foam or synthetic fur (like the covering that sneaks into the frame when a boom mic accidentally enters a film scene). Software Example Now that we understand how to configure the board, let s hook it to an Arduino and see what it can do. Materials In addition to the Sound Detector, you ll need the following parts. Sound Detector Arduino Example SparkFun Wish List Jumper Wires Premium 12" M/F Pack of 10 PRT-09385 This is a SparkFun exclusive! These are 12" long jumper wires termin Break Away Male Headers - Right Angle PRT-00553 A row of right angle male headers - break to fit. 40 pins that can be cu RedBoard - Programmed with Arduino DEV-11575 At SparkFun we use many Arduinos and we're always looking for the Connections We snapped a 5-pin section off the header, and soldered it to the Sound Detector. Then we took the jumper wires and made the following connections. (Sound Detector Arduino ) GND Supply Ground

Page 7 of 12 VCC Power supply voltage between 3.5 and 5.5 Volts Gate Pin 2 Envelope A0 Additionally, as described on the calibration page, a 33K Ohm resistor was soldered into position R17. R3 was left in place, so the gain was lowered from 40 db to about 28 db.

Page 8 of 12 / sound_detector_demo.ino Sound detector sample sketch Byron Jacquot @ SparkFun Electronics February 19, 2014 https://github.com/sparkfun/sound_detector This sketch demonstrates the use of the Sparkfun Sound Dete ctor board. The Sound Detector is a small board that combines a microph one and some processing circuitry. It provides not only an audio outpu t, but also a binary indication of the presence of sound and an analog re presentation of it's amplitude. This sketch demonstrates two different modes of usage for t he Sound Detector. The gate output (a binary indication that is hig h when sound is present, and low when conditions are quiet) is used to f ire a pin change ISR, which lights an LED when the sound is present. The en velope output (an analog voltage to rises to indicate the amplitude of th e sound) is sampled in the loop(), and it prints an indication of the l evel to the serial terminal. For more details about the Sound Detector, please check th e hookup guide. Connections: The Sound Detector is connected to the Adrduino as follows: (Sound Detector > Arduino pin) GND GND VCC 5V Gate Pin 2 Envelope A0 Resources: Additional library requirements: none Development environment specifics: Using Arduino IDe 1.0.5 Tested on Redboard, 3.3v/8MHz and 5v/16MHz ProMini hardwar e. This code is beerware; if you see me (or any other SparkFu n employee) at the local, and you've found our code helpful, please buy us a r ound! Distributed as is; no warranty is given. / // Define hardware connections #define PIN_GATE_IN 2 #define IRQ_GATE_IN 0

Page 9 of 12 #define PIN_LED_OUT 13 #define PIN_ANALOG_IN A0 // soundisr() // This function is installed as an interrupt service routine for the pin // change interrupt. When digital input 2 changes state, thi s routine // is called. // It queries the state of that pin, and sets the onboard LED to reflect that // pin's state. void soundisr() { int pin_val; pin_val = digitalread(pin_gate_in); digitalwrite(pin_led_out, pin_val); } void setup() { Serial.begin(9600); // Configure LED pin as output pinmode(pin_led_out, OUTPUT); // configure input to interrupt pinmode(pin_gate_in, INPUT); attachinterrupt(irq_gate_in, soundisr, CHANGE); // Display status Serial.println("Initialized"); } void loop() { int value; // Check the envelope input value = analogread(pin_analog_in); // Convert envelope value into a message Serial.print("Status: "); if(value <= 10) { Serial.println("Quiet."); } else if( (value > 10) && ( value <= 30) ) { Serial.println("Moderate."); } else if(value > 30) { Serial.println("Loud."); } // pause for 1 second delay(1000); } This code simultaneously demonstrates two different operating modes of the Sound Detector.

Page 10 of 12 First, using the external interrupt facility, the Arduino observes the gate output, and sets the onboard (pin 13) LED to follow the gate status. Second, in the loop() routine, it uses an analog input to periodically sample the envelope signal. That value is interpreted into a message indicating the current loudness via a series of thresholds. Analog Example As a purely analog circuit, the Sound Detector isn t limited to strictly being a peripheral for a microcontroller. To illustrate an alternate application, we ve wired up a completely analog example. We ve tied the envelope output to an LM3916 VU bar-graph LED driver, to make a visual sound level meter. For this application, the Sound Detector is configured with no resistor for R17, and the default 100K in position R3. Materials Again, we start with the Sound Detector, then add the following parts. Sound Detector Analog Example SparkFun Wish List Breadboard - Classic PRT-00112 Your first exposure to electrical engineering - the bread board. Who k Wall Adapter Power Supply - 12VDC 600mA TOL-09442 This is a high quality AC to DC 'wall wart' which produces a regulated 10 Segment LED Bar Graph - Red COM-09935 These 10 segment bar graph LEDs have many uses. With a compact Resistor Kit - 1/4W (500 total) COM-10969 Resistors are a good thing, in fact, they're actually crucial in a lot of ci Voltage Regulator - Adjustable COM-00527 This is the LM317TG voltage regulator, a three-terminal positive regul (2) Electrolytic Decoupling Capacitors - 10uF/25V COM-00523 Low-profile electrolytic decoupling capacitors 10uF/25V. These capac Dot/Bar Display Driver - LM3916 (VU Taper) COM-12695 This is the LM3916 Dot/Bar display analog-controlled LED driver that Schematic We connect those parts as follows. Which translates thusly onto a solderless breadboard.

Page 11 of 12 The assembled, operational version looks like this. Listening to The Lonely Bull by the Ventures Sound picked up by the microphone is now translated onto the bar graph. The louder the sound is, the more LEDs light up! A few of notes about the circuit. It uses two power supply rails. An external supply was used as a source of 13 VDC. The 13V is further regulated down to 5V using an LM317 adjustable regulator. This provides the recommended minimum of 12V for the bar-graph driver, and a stable source of 5V for the Sound Detector. The 5V is connected to the + rail at the top of the breadboard. It is used to power the Sound Detector, and as the anode supply for the LEDs. The 13V is on the lower + rail, and is the power supply for the LM3916. The 100K Ohm resistor between pins 6 and 7 of the LM3916 sets the reference for the scaling of the bar graph. If the meter seems to be too sensitive, it can be reduced to 10K or lower. Pin 6 of the LED bar graph is at one of the covered-over positions on the power rail. The leg was folded over to make contact with pin 5. Pin 9 of the LM3916 sets the chip for dot or bar modes. As shown above, tied to the 13V rail, the chip is in bar mode. If pin 9 is left unconnected, the chip will be in dot mode. Resources and Going Further A few parting thoughts. Troubleshooting: If the Sound Detector is misbehaving, try the following steps. Double check that the power supply is clean, preferably with an oscilloscope. Irregularities on the supply will likely be present on the output. The gain configuration is easier to tame with the higher headroom offered by higher supply voltages. Providing the Sound Detector with a stable 5V supply, and translating output down to 3.3V will yield better results than powering the detector directly from 3.3V.

https://learn.sparkfun.com/tutorials/sound-detector-hookup-guide?_ga=1.235516865.193... Page 12 of 12 11/17/2015 Finally, listen to the audio output. AC-couple the audio output using a 10 uf electrolytic capacitor, with its + leg to the sound detector, and connect a small speaker or headphone. Simply listening to the output often yields clues as to what s wrong. You ll be able to hear whether unexpected noises, such as wind and vibration, are being picked up. If the audio output is distorted, the gain may need to be reduced. If the audio output is really quiet, the gain may need to be increased. If there is a constant tone on the audio output, double-check that the power supply is suitably stable. Switch-mode power supplies often introduce oscillations on the power rails. Documentation Design files for the Sound Detector are in the corresponding GitHub repository. This includes the Eagle files, and the Arduino example and Fritzing example we explored above. Additionally, there are SPICE simulations of the circuit for LT Spice. One of those simulations, sound_detector wav.asc actually analyzes the contents of a wav file (which was used to generate the diagram on page 2 of this tutorial), though you ll have to modify the file path to analyze a wav file if your own. Finally, the Sound Detector has been added to the sensors category in the Sparkfun Fritzing Library. See Also The Wikipedia page for electret microphones LM3914/5/6 Dot/Bar Display Driver Hookup Guide