Berkeley Electronic Interfaces Course – Robot Module 3.2 – Amplifier

by Fuyang

3.2_GoldenRulesThe Golden Rules

Basically by using the golden rules shown above, one can approximately calculate or analysis the amplifier circuit to know the output gain of a specific amplifier setup.

Microphone Front End

3.2_ADC

Then let’s use the circuit designed above to make a microphone front end, together with an on board ADC we can verify the microphone readings via a on board LED. So the signal flow looks like this.

3.2_SignalFlow

Bill of Materials:OPA2344PA

  • resistors: 2.7k, 10k (x3), 100k
  • electret microphone
  • ceramic disk capacitor (1 microfarad)
  • OPA2344 (or equivalent dual op amp chip)

3.2_MicrophoneFrontEnd

Specially changed parts for my case due to the microphone I bought is not sensitive enough:

  • Rs change from 2.7K Ohm to 300 Ohm
  • Microphone is powered by 3.3V instead of 9V (it seems no difference for me but I changed it anyway hoping to save some power consumption)

Single-Supply Circuit 

Since we are working with a single battery voltage source (the op amp rails are connected to 3.3 V and ground, rather than +3.3 V and -3.3 V, we have to carefully consider our reference. The voltage divider at the op amp’s non-inverting input sets the circuit’s reference to 1.65 V.

In this way, an AC input with minus and plus, will have an output oscillating at 1.65V, up to 3.3V and down to 0V. This is called Single-Supply Circuit.

For our example, let’s set Rf = 100kOHM and Rs=2.7kOHM, Vcc=3.3V. Using the golden rule number 2 we know the DC voltage at both the inverting and non-inverting terminal of the op amp is Vcc/2. Also note because of the capacitor, the DC voltage at the conjunction of capacitor and Rs, (which is also the input of end of the amp) is Vcc/2 as well.

By using golden rule number 1 and do KCL at the node of inverting terminal of the amp, we get:

i_{R_s} = i_{R_f}3.2_MicrophoneFrontEnd

which means the current going to Rs equals Rf. By Ohm’s law we get:

{{V_{cc} / 2 + V_{in} - V_{cc} / 2} \over R_s }={ {V_{cc} / 2 - V_{out}} \over R_f }

V_{out} = {V_{cc} / 2 - {R_f \over R_s} V_{in}}

so in our case that

V_{out} = {1.65 - 37 V_{in}}

So that’s it, with the code loaded to MSP430G2 controller we can use the green LED to to show whether the microphone has heard something or not.

Course info:

EE40LX teaches the fundamentals of engineering electronic interfaces between the physical world and digital devices. Students can expect to cover the material of a traditional first circuits course with a project-based approach. We start with essential theory and develop an understanding of the building blocks of electronics as we analyze, design, and build different parts of a robot from scratch around a microcontroller. This course uses the Texas Instruments MSP430G2 LaunchPad, but you are welcome to bring whichever development board or microcontroller you like!”

//***************************************************************************************
// EE40LX
// Sketch 3.6
//
// Description; the MSP430 reads the output of the microphone circuit at P1.5 and
// decides whether or not to flash on an LED based on the sound level
//
// Tom Zajdel
// University of California, Berkeley
// July 27, 2015
//
// Version 1.1 July 27, 2015 - Added curly brackets to conditional statements
// - No longer declaring value in global scope
// 
//***************************************************************************************

int MICINP = A5; // set MICINP as P1.5 alias
int GRNLED = P1_6; // set GRNLED as P1.6 alias

void setup()
{
 // start the serial monitor
 Serial.begin(9600);
 
 // set GRNLED as output pin
 pinMode(GRNLED, OUTPUT);
 
 Serial.println("Setup complete!");
}

void loop()
{
 int value; // declare variable value to store result of analogRead
 value = analogRead(MICINP); // get the voltage from the microphone
 Serial.println(value); // write digitized value to serial monitor

 if (value >= 515) // if digitized value is above 560, (here I changed to 515 to make it more sensitive)
 {
 digitalWrite(GRNLED, HIGH);// turn on the LED...
 }
 else
 {
 digitalWrite(GRNLED, LOW); // ...else turn off the LED
 }
 
 delay(1); // delay in between reads for stability
 
}

In order to use analog input pins, we use the “AX” as an alias. All pins in Port 1 may be used as analog input pins (see http://energia.nu/Guide_MSP430LaunchPad.html for more information).

To read the voltage at this pin in the main loop, we use the analogRead() function, which converts the voltage to a 10-bit integer. We also print this value to the Serial monitor and use it to determine whether or not to turn on the green LED.

The value 560 corresponds to a voltage of 3.3 V \cdot {560 \over 1023} = 1.806 V. That is, the LED turns on whenever this voltage (the output of the microphone amplifier) exceeds 1.806 V.

http://www.cui.com/product/resource/cmc-5044pf-a.pdf

http://www.farnell.com/cad/460032.pdf