lab2_note

.pdf

School

Harvard University *

*We aren’t endorsed by this school

Course

16B

Subject

Electrical Engineering

Date

Oct 30, 2023

Type

pdf

Pages

6

Uploaded by CorporalKnowledge12458

Report
EECS16B Designing Information Devices and Systems II Fall 2023 UC Berkeley Lab Note 2 Lab 2: Analog & Digital Interfaces Digital-to-Analog Converters (DACs) and Analog-to-Digital Converters (ADCs) are some of the most commonly used circuits today. They can be found in a wide variety of electronics, such as microcontrollers like the Arduinos we use in class, computers, phones, thermostats, etc.. This is because our computers and chips that process information from the real world, like temperature, must be stored digitally , while the information that we gather is itself an analog value. In the context of circuits, a digital value is one that is represented with 0s or 1s (a binary number), while an analog value can be anything in between (e.g. 0.5, 0.55555, etc). Taking the example of a thermostat, in order to allow the CPU chip, which can only process binary numbers (sequences of 1s and 0s), that controls it to process the measured temperature, which is an analog value (like 20.2 °C or 75.9 °F), we need to have an ADC to convert that analog temperature into the digital value the chip is expecting. In order to have a phone call, an ADC must convert your voice (an analog voltage generated by the microphone) into a digital signal to be transmitted, and a DAC must take that digital signal and convert it back into an analog voltage for the speaker on the receiving end to play your voice. As you can see, DACs and ADCs play a very important role in the electronics we use everyday, and in this lab, we will be exploring how to build our own simple DAC and ADC. Part 1: Digital-to-Analog Converters (DACs) We will first build a 3-bit DAC to convert a binary input into an analog voltage, and then we will extend it to 4 bits using the knowledge you gained from building the 3-bit DAC. The binary input will come from the Arduino’s digital I/O pins while the analog voltage will be probed with your Arduino and displayed on the serial monitor. 2 R B + V 1 2 R + LSB V 0 2 R + MSB V 2 A 2 R R R V OUT Figure 1: 3-bit DAC built from R-2R ladder We can build a DAC using only resistors in a structure called the R-2R ladder (shown in Figure 1 ). This structure takes an n -bit binary input and converts it to an analog output voltage. The bits represent whether their correspond- ing voltage source is on (some reference voltage V re f ) or off (0V), where V re f is 5V for the Arduino. In a previous homework, you have solved the R-2R ladder using KCL, nodal analysis, etc., so we will not show the full derivation of the circuit here. The general structure of the derivation involves analyzing the resulting output of each individ- ual input voltage using Thevenin equivalent circuits, then summing all of the individual contributions to get V OUT (superposition). We have done the first equivalent circuit for the LSB as an example. 1 Lab Note 2 — DAC/ADC
EECS16B Designing Information Devices and Systems II Fall 2023 UC Berkeley Lab Note 2 Part 2: 4-Bit Analog-to-Digital Converter (ADC) Given an analog voltage, an N-bit ADC converts it into an N-bit binary number in the digital domain. Digitization of a signal involves both discretization , i.e., we restrict its timesteps to being finitely small (infinitely small timesteps continuous time), and quantization , i.e., we fix a finite set of evenly spaced 2 N “states” (which can be converted to voltage values) that the signal can have at any given moment. In this case, this is the set of binary numbers between the decimal integer values of 0 and 2 N 1, inclusive. There are many different schemes or algorithms to convert an analog voltage into a digital representation. Since we have a sorted, finite set of values, one of the conceptually simplest algorithms we could use is to run a linear search: start from 0 and count up, and stop once we find the closest match to the input analog voltage we’re converting. As with any linear search, this is extremely inefficient, and there are many improvements we can make given that we have a sorted list of values, such as binary search. This leads into one of the most commonly used circuit architectures for analog-to-digital converters, the Successive Approximation Register ADC (SAR ADC), which is what we’ll be building today using the 4-bit DAC from the previous part. Brief Aside: Microcontrollers In essence, a microcontroller is as a small “computer” containing memory, processors, and I/O (input/output) that execute a predefined program. Microcontrollers are the core of embedded systems and are often used to interact with/manage other devices. Some examples of microcontrollers include the Ardunio and ESP32 but don’t include the popular Raspberry Pi which is consider to be more of a microprocessor. You can read more about the specific difference here . The specific microcontroller we’ll be using in the lab and for the rest of the class is the Arduino Leonardo. The documentation can be found on the Arduino website . The Arduino has numbered pins for I/O, which expect and output voltages between 0-5V and can be used as digital I/O for all pins and analog I/O for the pins labelled analog. Regarding power supply, you can employ the Arduino’s VIN pin to provide power to the board, accepting input voltages ranging from 6 to 20 volts. In addition, the 3V3 and 5V pins are designed to output 3.3 volts and 5 volts, respectively. Lastly, GND serves as the grounding connection for the Arduino. For more information on the Arduino’s pinout, please refer to the image below or here . The SAR ADC Algorithm The SAR ADC algorithm tries various binary “trial codes” by feeding them into a DAC to generate voltages and comparing the result with the analog input voltage using a comparator . It then uses feedback ( SAR logic ) to adjust the DAC voltage to get as close as possible to the analog voltage. The algorithm starts with the most significant bit (MSB), which is the bit with the largest binary weight (i.e. furthest to the left in a binary number). The circuit diagram of the SAR ADC is shown in Figure 2 . The comparator outputs logic high (1) when V IN V DAC and logic low (0) when V IN < V DAC . An illustration of the algorithm is shown in Figure 3 . 2 Lab Note 2 — DAC/ADC
EECS16B Designing Information Devices and Systems II Fall 2023 UC Berkeley Lab Note 2 ANALOG IN + V IN V DAC COMPARATOR N DIGITAL DATA OUT Microcontroller (SAR Logic) N N-BIT DAC V REF Figure 2: SAR ADC circuit diagram Figure 3: Flow chart of SAR ADC algorithm 3 Lab Note 2 — DAC/ADC
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

Browse Popular Homework Q&A

Q: 4.34 In the region just downstream of a sluice gate, the water may develop a reverse flow region as…
Q: find the exact solutions of this equation, in radians, that lie in the interval [0, 2π ).
Q: Before criteria like parsimony could be used to determine which tree is most likely to be true, we…
Q: 2. Discuss Autism Spectrum Disorder, what are some of the primary symptoms and how do they affect a…
Q: (a) Find the radian and degree measures of the central angle u subtended by the given arc of length…
Q: hat is the total power delivered by the 16-volt battery in the circuit below? = 16 volts, V₂ = 20…
Q: ABC Company borrowed $100,000 on January 1, 20X1.  Interest is 6% payable each December 31.  They…
Q: Bianca is conducting an experiment to determine how temperatures affect the productivity of…
Q: In a certain UHF radio wave, the shortest distance between positions where the electric and magnetic…
Q: García describes the reasons that race is considered a “discredited concept in human biology.”…
Q: According to the Sapir-Whorf hypothesis, language actually shapes the way we think. In what ways is…
Q: Data was collected for 258 randomly selected 10 minute intervals. For each ten-minute interval, the…
Q: World consumption of a certain metal is running at the rate of 359e0.02t thousand metric tons per…
Q: The per-hour output produced by a worker describes the: Group of answer choices labor force…
Q: Suppose the IRR of Machine X = 17%. The PW of Machine Y (using a MARR = 20%) is $3,679. We can…
Q: A company manufactures and sells x pocket calculators per week. If the weekly cost and demand…
Q: Find the consumers' surplus at a price level of p = $120 for the price-demand equation below. p =…
Q: A 20-gallon barrel is filled completely with pure water. Salt water with a concentration of 0.3…
Q: For the thrust bearing shown below, normal stress developed due to the loading. Please choose the…
Q: Algebra Problem Solving #6 1.) With summer winding down, Mr. and Mrs. Mallery decided to take their…
Q: There were several components in the first digital electronic computer.
Q: 1. Profit= we can rewrite the formula as Profit= firm has no variable costs, Profit would be equal…