lab4_note

pdf

School

University of California, Berkeley *

*We aren’t endorsed by this school

Course

16B

Subject

Electrical Engineering

Date

Feb 20, 2024

Type

pdf

Pages

4

Uploaded by SargentWorldDog35

Report
EECS 16B Designing Information Devices and Systems II Spring 2024 UC Berkeley Lab Note 4 Lab 4: Sensing Part 1 In the previous lab, you built the S1XT33N’s legs: the motor controller circuits that enable it to move around and the encoder circuits to sense how far and fast S1XT33N has moved. However, you might have noticed that the range of motion is quite limited when we are using the lab station’s DC power supply to power our circuits. We need a portable way to power your circuits so that S1XT33N can freely roam on the ground. This is why in the previous lab you also built voltage regulator circuits that enable us to power our circuits with batteries (a portable voltage source). That way, S1XT33N’s legs were able to move on their own. Our end goal is to have S1XT33N be voice-controlled, and in order to do that, we need a way for S1XT33N to listen to what you’re saying. Today we will be building S1XT33N’s “ears”: the mic board circuit that will pick up your voice and convert it into an electrical signal, as well as the surrounding biasing circuits that the mic board requires to function as desired for our circuit. We will also be fine-tuning S1XT33N’s ears by building a low-pass filter, which will remove unwanted noise. The goals of this lab are as follows: • Build the biasing circuit with the mic board • Tune the mic board and measure the frequency response • Build a low pass filter to help the micboard attenuate high frequencies that can be picked up as noise Part 1: Mic Board Circuits Our biasing 1 circuits will provide signals for the OS1 (DC Offset) and OS2 (Level Shift) pins of the mic board so that the mic board can function properly. Before we build the biasing circuit with the mic board, let’s discuss the mic board’s circuit below (this is the schematic of what is on the mic board PCB, or printed circuit board): There are a few key stages and components to the mic board: Microphone Gain: The electret microphone behaves as a variable current source depending on the size of the sound waves hitting it. Current signals are generally more difficult to work with than voltage signals, so we turn that into a voltage signal using the resistor in the Mic Gain part of the circuit. If you would like to learn more about these electret microphone after doing the lab, please read the (optional) extra lab reading note . 1 “Biasing” a circuit means establishing predetermined voltages or currents at various points of the circuit in order to construct the proper operating conditions for the components [ Wikipedia ]. 1 Lab Note 4 — Sensing Part 1 (v4.1)
EECS 16B Designing Information Devices and Systems II Spring 2024 UC Berkeley Lab Note 4 Buffer: This buffer helps keep the amplifier and the capacitor from loading (affecting) the microphone by preventing the rest of the circuit from drawing current from the Mic Gain stage. It looks a little different from the buffers we usually use (there’s a resistor in the feedback loop, whose purpose is beyond the scope of this class), but it functions just the same. Remove Mic Drift: A capacitor placed between one circuit stage and the next is usually called a coupling cap . Think about the impedance of a capacitor: What happens as ω hits 0? What happenns to the impedance? You might notice that the impedance goes to infinity, which means that signals with 0 frequency, or DC signals, are blocked. The microphone naturally has a lot of low frequency drift that is hard to predict, so we use this coupling cap to remove any DC offset and low frequency noise. This allows us to ignore whatever DC value the mic gain stage had, and add in a suitable DC value in the next stage. To add in a DC offset, we cannot directly connect the output of the buffer to the DC value since these two voltages are not equal but would be in the same node - hence why we need the coupling cap. DC Offset: For this project, you will not have a negative power source , since the Arduino cannot take negative voltage inputs. If you center your signal around ground, then you will lose the negative half of the signal as soon as you send it through the op-amp because your op-amp won’t be able to output those negative voltages (since all your op-amps’ V SS pins will be set to ground). To get around this problem, we want to center our signal in the center of our available voltage range which is 2.5V. Here is where we will connect OS1 from our biasing circuit via a 100 k resistor in order to accomplish this goal. The reason the resistor is 100 k is because we create an unintentional high pass filter with this resistor and the coupling capacitor in the previous stage. In order to minimize the effects of this unwanted high pass filter, we set the resistor value to 100 k so that the filter’s cutoff frequency is 10 rad/s, or 1.59 Hz, effectively passing virtually all of the signals we pass into the mic board without attenuation. Note that you will have to be careful and remember that a DC offset exists or it could become troublesome later on in the amplifier stage of the mic board. Think of a 0.1V DC signal. Now put that signal through a non-inverting op-amp with a gain of 100 and a reference voltage of 0V. Suddenly that 0.1V DC signal becomes 10V! Level Shift: When we introduce the DC offset at OS1, we have to adjust our amplifier to expect signals centered around that offset. We will explain this further when we discuss the off-board biasing circuit below. Amplifier: Finally, the mic board uses a non-inverting amplifier (with a potentiometer) to amplify the micro- phone signal. Note that OS2 is on the inverting terminal of the op-amp - we use this to help us deal with our DC offset problem. Now, let’s move off the mic board and onto our biasing circuits. The schematic is reproduced below for your convenience. OS1: DC Offset Because we need our signal to be centered in our target range (0 - 5 V), we will need to set the DC offset to the midpoint of this range: 2.5 V. This can easily be accomplished with a voltage divider of two equal resistors from the 5 V rail to ground. 2 Lab Note 4 — Sensing Part 1 (v4.1)
EECS 16B Designing Information Devices and Systems II Spring 2024 UC Berkeley Lab Note 4 OS2: Level Shift When we introduce the DC Offset, we will encounter a problem when the signal passes through the non-inverting amplifier: that DC offset will be amplified along with the rest of the signal! This is because the amplifier will amplify the signal as referenced from ground . This is the key problem here. If we want to avoid amplifying the DC offset, what value should we use for the amplifier’s reference voltage? If you guessed 2.5 V, congratulations! This is the key idea to a level-shifter. We connect OS2 to 2.5V when building the mic board circuits - this is how we tell the non-inverting amplifier to use 2.5V as a reference. If you would like a review of how to add a reference/virtual ground to an amplifier circuit, see lab note 1 . Part 2: Frequency Response of the Speaker-Microphone System The system you are building in this lab consists of the microphone on the mic board as well as the speaker you’re using to play music. You must consider the ability of your speaker to reliably reproduce the desired frequency at a volume large enough to excite the microphone, and the ability of your microphone to pick up and record the desired frequency. Ideally, your speaker will be able to play all frequencies at the same volume, and your microphone will pick up all frequencies equally. However, due to the physical limitations of your speaker and microphone, for some frequency ranges, the signal your speaker-microphone system generates will be highly attenuated. You will be filtering the output of the mic board circuit to partition the frequency spectrum for this and next week’s lab and to extract specific frequency ranges to better sample voice commands later in the project, so you must consider the non-ideal frequency response when designing your filters. How can I add gain to some frequencies and not others? Which frequencies should I choose? In order to design effective filters, we must answer these questions, and to do so, we must first identify the speaker-microphone system’s frequency response. We will do this empirically: as detailed in the lab ipynb, you will play a range of frequencies on your speaker and record the peak-to-peak of the microphone’s received wave at that frequency. Part 3: Low-Pass Filter Some definitions that you should familiarize yourself with for this lab are: Gain : The ratio of the output signal to the input signal. In the case of the low pass filter, the ratio between the output at the capacitor to the input before the resistor. Cutoff Frequency : When plotting the AC response, the cutoff frequency is defined as the frequency where the magnitude of | H ( j ω ) | is at 1 2 . For a first-order RC filter, the cutoff frequency is always at 1 2 π RC . In lab, we will be working in Hertz, rather than radians. Angular frequency : Angular frequency is given in radians, while frequency is given in hertz. To convert between the two, use the formula ω = 2 π f , where ω is the angular frequency and f is the frequency in hertz. Generalizing the first-order filter The general first-order (or bilinear , since it is linear in both the numerator and denominator) transfer function is as follows. Transfer functions convert us from the time domain to the frequency domain, and are used in circuit analysis when we have sinusoidal / non-DC inputs: H ( j ω ) = a 1 j ω + a 0 j ω + ω 0 You might see transfer functions written in terms of H ( s ) , which is the general form of transfer functions across the entire complex frequency spectrum in the context of Laplace Transforms (out of scope for EECS 16B) where 3 Lab Note 4 — Sensing Part 1 (v4.1)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
EECS 16B Designing Information Devices and Systems II Spring 2024 UC Berkeley Lab Note 4 s = σ + j ω . In this class, we are focused on steady-state frequency domain analysis, so we substitute s = j ω and ignore the real part. Think: What is the gain at j ω = ? What about at j ω = 0 ? The gain at j ω = 0 is the DC gain, and the gain at j ω = is the high frequency gain. In this case, the high-frequency gain approaches a 1 , and the DC gain is a 0 / ω 0 . The coefficients a 0 and a 1 determine what kind of filter we have. As an exercise, think of the relationships among the numerator coefficients that result in different kinds of filters. The first filter you will build in this lab will be a first-order low-pass RC filter to isolate the frequencies below the desired cutoff frequency, as detailed in the lab ipynb. In addition to serving as part of the color organ filter in next week’s lab, this filter will eventually be used to better sample voice commands in later phases of the project. This is because human speech is typically below 2500 Hz, so the filter would pass through frequencies corresponding to human speech while attenuating higher frequency noise. Let’s try to build a RC Low-pass filter using the knowledge we have. You may also refer to Example 1, AC response of an RC, from lecture 4b for the derivation of the phasor response seen in the image below. References Original Project Part 1 notebook written by Nathaniel Mailoa and Emily Naviasky (2016). Horowitz, P. and Hill, W. (2015). The Art of Electronics . 3rd ed. Cambridge: Cambridge University Press, ch 4. Horowitz, P. and Hill, W. (2015). The Art of Electronics . 3rd ed. Cambridge: Cambridge University Press, ch 2. Sedra, A. S. and Smith, K. C. (2015). Microelectronic Devices and Circuits . 7th ed. Oxford: Oxford University Press, ch 3. Sedra, A. S. and Smith, K. C. (2015). Microelectronic Devices and Circuits . 7th ed. Oxford: Oxford University Press, ch 6. Written by Mia Mirkovic (2019) Edited by Steven Lu, Yi-Hsuan Shih (2021). Version 2.0, 2021. Edited by Megan Zeng, Steven Lu (2022). Version 3.0, 2022. Edited by Jessica Fan (2023). Version 4.0, 2023. Edited by Venkata Alapati, Ryan Ma, Junha Kim (2024). Version 4.1, 2024. 4 Lab Note 4 — Sensing Part 1 (v4.1)