EECS 373 - Fall 2026 - Lecture 13: "Overview: Analog Signals" — Transcript
Full transcript
- 0:28All right, let's get started.
- 0:30Can you guys hear me? Okay. Y
- 0:33Okay. So, today we're going to be
- 0:35talking about uh analog signals.
- 0:38Quick announcement. If you haven't
- 0:40already put your team into that Google
- 0:43forms, if you could do that, I think we
- 0:45still have a couple teams that haven't
- 0:47done it. So, go ahead and get registered
- 0:49today. That's due today.
- 0:52Okay. So we're going to be talking about
- 0:54uh analog signals and how they uh
- 0:57interact with embedded systems or why we
- 0:59need them for embedded systems. Uh so
- 1:01today we're just going to do kind of an
- 1:03overview and then next week I don't
- 1:06think you guys have lecture. After that
- 1:07you'll learn more about the specific
- 1:10analog to digital converters, the
- 1:12different versions that we have and then
- 1:14digital to analog converters, all the
- 1:17different kinds we have for those. But
- 1:19today is just kind of like an overview
- 1:20on how all that works.
- 1:24So uh why is this important? So digital
- 1:29systems they need to kind of interact
- 1:31with the real real world. So the real
- 1:33world is analog, right? So there's a lot
- 1:35of things that we need to inter uh
- 1:37interact with like sensors and maybe
- 1:40some sounds that are analog. Okay. And
- 1:43in embedded systems, a lot of these
- 1:45embedded systems, you're you're
- 1:46interacting with them quite a lot. If I
- 1:49was designing maybe a server in the
- 1:51cloud, maybe I don't care that much
- 1:53about that being able to interact with
- 1:56analog. But for embedded systems, analog
- 1:59is really important. And it's important
- 2:00that our microcontrollers, for instance,
- 2:03have those analog to digital converters
- 2:05or those digital to analog converters.
- 2:10So, uh, we want to potentially measure
- 2:13analog signals, but there's also
- 2:14scenarios where maybe we want to control
- 2:17analog signals. Um, so maybe we want to
- 2:20generate sound. That would be an
- 2:22example.
- 2:23So, to to measure analog signals, we use
- 2:27something called an analog to digital
- 2:29converter. And that's basically going to
- 2:31take some kind of signal, usually a
- 2:33voltage, and it's going to convert it
- 2:35into a digital value. Okay. The the most
- 2:39go-to example is a microphone. Okay, a
- 2:42microphone is going to take sound waves.
- 2:44It's going to vibrate and it's going to
- 2:46create this analog voltage. If we hook
- 2:49that up to, for instance, a
- 2:50microcontroller, we would use an analog
- 2:52to digital converter inside the
- 2:54microcontroller to convert that to a
- 2:56digital value. And then I could, for
- 2:57instance, record an MP3 file. Okay.
- 3:01Other things that we might want to use
- 3:03an ADC for, um, a bunch of different
- 3:07sensors. Basically, any sensor out
- 3:08there, whether it's like a temperature
- 3:10sensor or a light sensor, it's going to
- 3:12output some kind of analog value. Okay.
- 3:15So, if we want to interface with those
- 3:17sensors, we need to use an ADC.
- 3:22All right. Going the other way around,
- 3:23let's say I have an audio file, an MP3
- 3:26file, and I want to listen to that,
- 3:28right? How am I going to do that? Well,
- 3:30I'll use a digital to analog converter.
- 3:32It'll take that MP3 file, and then
- 3:34convert it into a voltage, maybe like a
- 3:37sine wave, and then we could put that
- 3:39onto a speaker, and then we would hear
- 3:41that. Um, does does everyone know how a
- 3:43speaker works? I find that a lot of
- 3:45people don't know this. So, a speaker is
- 3:47like a coil wrapped around a magnet.
- 3:50They call it a voice coil. And then that
- 3:52coil is connected to a diaphragm. And
- 3:54when you put voltage through that coil,
- 3:56it'll shake back and forth. that
- 3:58diaphragm will move back and forth and
- 4:00then you'll hear that audio. Okay,
- 4:01that's kind of how it basically works.
- 4:03But we first need to start with that
- 4:04voltage in order for that thing to work.
- 4:06And so that's where a digital to analog
- 4:09converter comes in. Um radio
- 4:12transmitters that might be another
- 4:13scenario or another use case where we
- 4:15might need a DAC if we want to generate
- 4:18radio frequencies use those are often
- 4:20done with DAXs.
- 4:23Does that kind of make sense why these
- 4:24are important for embedded systems?
- 4:29So, you guys have already used an ADC in
- 4:31a DACK in lab. So, the oscilloscope,
- 4:34that's a good example of an ADC. It's a
- 4:36pretty fancy ADC. Um, it has really low
- 4:40noise. It can also measure a bunch of
- 4:42different voltage ranges. That's kind of
- 4:44the unique thing about an oscilloscope.
- 4:47Um, or function generator. That's how
- 4:50that works is it has a DAC inside of it
- 4:53and it takes some digital value. Let's
- 4:55say you're trying to generate a sine
- 4:56wave. It takes the digital
- 4:58representation of that and converts it
- 5:00into an analog signal that's outputed uh
- 5:03on the output jack. Okay.
- 5:08Okay. So sampling rate. So if we had a
- 5:11sine wave for instance
- 5:13um and we wanted to capture that there's
- 5:16infinite amount of points on that on
- 5:19that sine wave, right? So we can't store
- 5:22infinite data. So what we have to come
- 5:24up with is a way to sample that and we
- 5:26have to come up with a reasonable
- 5:27sampling rate. So how often are we
- 5:30actually going to measure that analog
- 5:32voltage? That's what we call sampling
- 5:34rate.
- 5:36Um okay an example might be a CD. Uh who
- 5:41knows what a CD is?
- 5:44Raise your hand. Okay. Who has listened
- 5:46to a CD?
- 5:48Okay. A couple. Okay. A decent amount. I
- 5:50thought it was going to be less. Um, I
- 5:52think the I the iPod came out what in
- 5:552001. So that that predates everyone
- 5:57here, right? I think um doesn't predate
- 6:00me obviously. Well, maybe not obviously.
- 6:02[laughter]
- 6:03Okay. Who here has listened to Spotify?
- 6:07Okay. I think that's everyone. I think
- 6:09that's a better example.
- 6:11So, if you were to go to Spotify's
- 6:14website and you looked at the audio
- 6:16qualities that they support, if I sp if
- 6:19I pay for Spotify premium
- 6:22um and I I put my audio quality to the
- 6:24max quality, they call it lossless. So,
- 6:27that means that um it has all of the
- 6:29audio data there that would be in the
- 6:32original file. They have these little
- 6:34specs here and we can see it says 24bit.
- 6:37That's going to be our resolution. And
- 6:39we'll talk about that a little bit
- 6:40later. And then this right here, we have
- 6:4344.1 kHz. Okay, that is our sampling
- 6:46rate. Okay, why did they pick that
- 6:50number? Does anyone have any idea why
- 6:52they picked 44.1 kHz?
- 6:58What can our ears hear like in air? If
- 7:02there's a sound sound waves coming, at
- 7:05what frequency can we no longer hear
- 7:07beyond that? Do you guys know? Yeah,
- 7:09>> it's 20 kHz.
- 7:11>> Yeah, it's 20 kHz. Yeah, it's about 20
- 7:13kHz. Younger people are are higher,
- 7:16older people are or lower. Um, okay. So,
- 7:20based on that, so 20 kHz, why did they
- 7:22kind of double that and go to 44 kHz to
- 7:25represent audio? Yeah.
- 7:27>> Um, in order to recreate a signal from
- 7:30sampling, you have to sample at the
- 7:32frequency, which is double um like sort
- 7:34of the maximum
- 7:36frequency. So, The maximum frequency is
- 7:3820.
- 7:40>> Yep. Exactly. And we'll talk about that
- 7:42in the next slide, but you're right.
- 7:44It's Nyquist and they did 44 because
- 7:46they wanted to go a little bit higher
- 7:48than 40 uh because there's you're going
- 7:51to have some filters in there and we
- 7:52kind of give want to give some headroom
- 7:54for those filters. We can talk about
- 7:55that later as well, but that's where
- 7:57that 44 kHz comes from.
- 8:00Okay, this is on the slide. I'm not
- 8:03really sure what medium quality sampling
- 8:05rate means, but there you go. 22 kHz is
- 8:08medium sampling. And then phone
- 8:11sampling. Um, who here has talked on a
- 8:14landline?
- 8:17Okay, most of you. Okay. [laughter]
- 8:20Um, so back in the days when we had
- 8:22landlines all over the place, those were
- 8:24at like 8 kilhertz. Okay. Um, nowadays
- 8:28if you're doing a call over 5G, it's
- 8:31actually sampled at like 48 kilhertz. So
- 8:34quite it sounds pretty good nowadays,
- 8:36but back in my day it didn't sound as
- 8:38good. If you guys have called like um a
- 8:42company and they put you on hold and
- 8:44they have that that on hold music
- 8:46playing and it sounds like like crap,
- 8:49it's because it's being sampled so low.
- 8:51That's what's going on there.
- 8:53Why when they were, you know, making
- 8:55these landlines, why did they decide
- 8:57that, okay, we're going to use 8 kHz as
- 9:00a sampling rate when we really need like
- 9:0340 kHz in order to actually represent
- 9:05the audio that you can hear? Why did
- 9:07they pick 8,000?
- 9:10Does anyone have an idea why they did
- 9:11that?
- 9:14So, yeah, go ahead.
- 9:19>> Yeah. Yeah, that's the idea behind it.
- 9:21So our voices, most of the the sound
- 9:24that our voices are making are below 8
- 9:27kHz or probably below 4 kHz. And so they
- 9:32decided, okay, 8,000 is enough to convey
- 9:35people's voice. And and if they went
- 9:37higher, that would use more data. Their
- 9:40the phone lines would have to be faster.
- 9:42So that's how they came up with 8,000
- 9:44kHz. Okay. So does sampling rate kind of
- 9:47make sense? This is all talking about
- 9:49audio, but we could obviously sample
- 9:50things that are a lot faster. Um, but
- 9:54yeah, so let's go on to Nyquist.
- 9:57Okay, so this is a theorem, Nyquis
- 10:00Shannon sampling theorem. And the
- 10:02theorem is is that if we want to
- 10:05replicate a signal that we have sampled,
- 10:08we have to sample it at twice or more
- 10:11than twice the maximum frequency that
- 10:14we're sampling. Okay, that's the only
- 10:16way that we can reconstruct that signal.
- 10:21Okay, and if we don't do that, there's
- 10:23something that happens called al-isting.
- 10:26And this is some error. And we'll kind
- 10:28of show some examples of what that would
- 10:29look like. But if if we have some
- 10:31signals in the signal that we're
- 10:34sampling that are at a higher frequency
- 10:36than our Nyquis rate, then we'll have
- 10:38alysine and it would cause issues.
- 10:43Okay? And it'll it'll make it look like
- 10:45we're actually sampling different
- 10:46frequencies instead of what we are
- 10:48actually sampling.
- 10:51And this theorem assumes that there's no
- 10:54noise and there's no clock jitter. Okay?
- 10:57So noise would be like if there's some
- 10:59high frequency noise in the background,
- 11:01we need to make sure we filter that out
- 11:03before we do our sampling. Otherwise,
- 11:05it's going to screw up this whole thing
- 11:06and we won't be able to reproduce the uh
- 11:09the signal that we recorded. And then
- 11:11clock jitter. That's how precisely we're
- 11:14taking these measurements. Like we need
- 11:16the time between each measurement to be
- 11:19very precise. Otherwise, it screws up
- 11:22Nyquis. Okay? So that's why if you were
- 11:25for instance uh measuring some kind of
- 11:27signal with an ADC, you probably want to
- 11:30put a timer into that ADC to basically
- 11:33tell it, okay, exactly at this time,
- 11:35this is when you're going to do that
- 11:36sampling. Okay.
- 11:42All right. So if we look at this this
- 11:45signal here, this has been sampled. What
- 11:48is the sampling rate of this signal? So
- 11:51why don't you guys spend like 20 seconds
- 11:53thinking about that and let me know.
- 12:10>> [clears throat]
- 12:13>> Does anyone have a guess?
- 12:17>> Yeah.
- 12:20>> What' you say?
- 12:21>> It's not 3 kHz. It's close. You're close
- 12:24though. Maybe you counted slightly
- 12:25wrong. Yeah.
- 12:27>> Yeah, it's 2 kHz.
- 12:29Um, yeah. So, we're That's how many
- 12:31That's how often we're taking these
- 12:32samples. How far apart these these
- 12:34points are. What is the signal? If you
- 12:36kind of just connect the dots,
- 12:39what would the What do you think the
- 12:40signal that we're measuring here, what
- 12:43frequency is that at?
- 12:55>> Yeah,
- 12:56>> I think it's 200.
- 12:58>> Yeah, it's 200 kHz.
- 13:00Okay. So, that's that's what we were
- 13:03that was the signal, right? that sine
- 13:04wave right there that was a signal. We
- 13:06took some samples along that point and
- 13:09then we can easily just reconstruct it.
- 13:12Okay, so if I were to output this, it
- 13:15would clearly be a sine wave. Okay, so
- 13:17this is where Nyquis works out. We did
- 13:19everything right. We sampled at a fast
- 13:21enough rate and it's really easy for us
- 13:24to uh reproduce this signal.
- 13:28Okay, what's going on here?
- 13:30What if I told you there was a sine wave
- 13:33somewhere in there? What What's going
- 13:35on? What's going wrong here?
- 13:41Is it that maybe we're not sampling
- 13:43quick enough? Right. So here, let's kind
- 13:46of look at what's going on.
- 13:49You can see there is a sine wave in
- 13:52there, but we're only we're sampling
- 13:53where it's at that crossover point,
- 13:55right? So the problem is is we are
- 13:58sampling at exactly
- 14:00twice what the frequency is. So this is
- 14:03a I have it here in my notes. This is a
- 14:072000
- 14:08or no are oh we're just sampling a 2000
- 14:10hertz signal at 2000 hertz. Okay. And so
- 14:14then that that's what happens there.
- 14:16Okay. So we can't actually reproduce
- 14:18that because we weren't sampling fast
- 14:20enough.
- 14:23All right. What about this? This looks
- 14:24very similar to the one that we looked,
- 14:26In fact, I think it's identical to the
- 14:28one we looked at uh two slides ago. But
- 14:31what's actually going on here? Well, we
- 14:33really screwed up here. We are sampling
- 14:36way too slow. And this 2,200
- 14:40hertz signal looks more like a 200Hz
- 14:43signal because we weren't sampling it
- 14:46fast enough. Okay, does that all kind of
- 14:48make sense? What's going on with this?
- 14:52All right.
- 14:55All right. Do we think that this we were
- 14:59sampling fast enough for this plot here?
- 15:03Yes. No. Maybe. Any guesses?
- 15:12So, let's look at what this actually is.
- 15:15So, that that's actually what the signal
- 15:17was. And this is a valid. This is some
- 15:19signal that you could have actually been
- 15:20sampling. In this example, what we have
- 15:23here is we have 100 hertz on top of 400
- 15:26htz on top of 1,600
- 15:29hertz. Okay. Um, and I believe, yeah,
- 15:33and this is sampled at 4,000 hertz. So,
- 15:36we're way above the the Nyquis rate. And
- 15:38we were able to accurately reproduce
- 15:40what was going on here. This is what
- 15:42like if I was recording someone's voice,
- 15:44this is kind of what it would look like.
- 15:46So we have something called a
- 15:48fundamental frequency and that's how
- 15:50fast our vocal cords vibrate. It's
- 15:53somewhere be between like 100 and 200
- 15:55hertz. But to actually like make that
- 15:58tone into like words that actually make
- 16:01sense, you have something called
- 16:02harmonics, which are actually higher
- 16:04frequencies that your mouth makes and
- 16:07your tongue makes. And that's how you
- 16:09can actually make voice, right? Or a a
- 16:12voice that you can understand. And so
- 16:14those harmonics, those are those higher
- 16:16frequencies in here that get overlaid on
- 16:18top of that fundamental frequency. Okay?
- 16:21So if you ever look at like a waveform
- 16:23of someone's voice, it's going to look
- 16:25really messy. It's not going to be
- 16:26really clear what frequencies are going
- 16:28on. Uh but we could use Nyquis and we
- 16:31could figure out exactly what those
- 16:32frequencies are.
- 16:35Okay.
- 16:38All right.
- 16:41What's wrong with my slides?
- 16:44Okay, this is a a theorem that I think
- 16:46professor sample came up with and it's
- 16:48called the oscilloscope sampling. His
- 16:51his last name is sample. So he's he came
- 16:53up with his own um his own theorem
- 16:56called the oscilloscope sampling
- 16:58theorem. And the idea behind this is
- 17:02Nyquis is like ideal like if everything
- 17:04is perfect, there's no noise, everything
- 17:06is working out well, then we can do
- 17:08double uh we can just we just have to
- 17:11double it. But in reality, if you really
- 17:13want something to look like what it is,
- 17:16five times is um what you really want to
- 17:20do. Okay? And that's kind of what
- 17:21oscilloscopes do. So let's kind of look
- 17:23at this spec right here. So if you look
- 17:27at any oscilloscope, it's probably going
- 17:28to have a number at the top of it. And
- 17:30it's and for instance, this one, it says
- 17:32200 megahertz. Does anyone know what
- 17:34that number means?
- 17:39That's basically the limit that you can
- 17:41use this oscilloscope. Like that's the
- 17:43max frequency that you can measure with
- 17:45this oscilloscope. But underneath that
- 17:48there's this other thing um called 5
- 17:53GASA
- 17:56uh over S. Can anyone guess what that
- 18:00stands for? Yeah.
- 18:03>> Yeah. Giga samples per second. So here
- 18:05we have five giga samples per second. Um
- 18:08and this is a 4 channel uh oscilloscope.
- 18:13Uh if for instance this oscilloscope let
- 18:16me measure a signal on one of the
- 18:19channels at 5 giga samples per second.
- 18:22Some of them don't. Some of them will
- 18:23actually spread all those samples across
- 18:25all of those channels. But let's assume
- 18:27that it could do that. In this example,
- 18:30this oscilloscope would be oversampling
- 18:33the signal like a 200 megahertz signal
- 18:35by like 25 times. Okay? And so the the
- 18:39faster you can sample it, the more
- 18:40accurate those signals are going to
- 18:42look. Does that make sense?
- 18:46All right.
- 18:48Okay. So, we talked about sampling.
- 18:50That's like the time between the
- 18:52measurements. But how do we actually uh
- 18:54turn those measurements into values that
- 18:57are digital? Um again you know we have
- 18:59that that problem where a a signal is
- 19:02has infinite values okay and we we don't
- 19:05have infinite bits to store that. So we
- 19:07have to do something called quantizing
- 19:10and that's where we convert those
- 19:11voltages to uh like basically round them
- 19:14to the nearest value that we can
- 19:16represent.
- 19:18Okay. And so in this example let's say
- 19:22we're using only three bits to represent
- 19:25a voltage. That means we can basically
- 19:28uh store eight different values uh when
- 19:31we're measuring something. And so if we
- 19:33were trying to measure the sine wave and
- 19:34we were taking samples, you can see that
- 19:37there's kind of big step. It's like
- 19:38there's steps there, right? And that's
- 19:40because we just don't have many bits to
- 19:42store that information. Okay? If we
- 19:45added more and more bits, this blue
- 19:48stair stair step would look more and
- 19:50more smooth as we uh add more of those
- 19:52bits. And so a potential issue with that
- 19:56is let's say we have this voltage right
- 19:59here.
- 20:01Well, it's going to be represented as a
- 20:03four. But that four could mean somewhere
- 20:06between 1 volt and 1.25 [snorts]
- 20:09volts. Okay. And so that is a limitation
- 20:12we have. We have to decide how many bits
- 20:15we want to use to to represent this
- 20:17data.
- 20:20All right. And that's that's called
- 20:21resolution. And the way that we can
- 20:23calculate that often when um when
- 20:27engineers talk about the resolution of
- 20:29an ADC, they're going to just say, "Oh,
- 20:32this ADC is 8 bits." Okay, but that's
- 20:34technically not what the resolution of
- 20:37the ADC is.
- 20:39Um
- 20:42this is actually the formula u that it
- 20:46is. Well, not quite. We we'll we'll see
- 20:48why that isn't quite this. uh but it
- 20:51kind of makes intuitive sense. You have
- 20:53to first take the reference voltage and
- 20:56that's the voltage that's the voltage
- 20:58range that you're measuring at. So in
- 21:01this example, we're measuring between 0
- 21:03volts and 5 volts. Okay? So that's an
- 21:06important input into this equation. So
- 21:09that this voltage reference would be 5
- 21:11volts here. And then we'd be dividing it
- 21:13by the number of steps we have which is
- 21:152 to the n. n is three. So this would be
- 21:17basically 5 over 8. And that's how wide
- 21:20each each of these steps is. But if we
- 21:23actually look at this and we count how
- 21:26many steps there are for this voltage
- 21:28range, let's just count it out. We got
- 21:30one here, 2, 3, 4, 5, 6, 7. We don't
- 21:35actually have eight. And so that's why
- 21:37the equation has to be 2 the n minus
- 21:40one. But a lot of the times if you look
- 21:42in data sheets, they're just going to
- 21:43use this equation right here. um just
- 21:46because once we get to bigger bit sizes
- 21:49it really doesn't matter and if we kind
- 21:52of do that math if we have a 12bit ADC
- 21:55for instance
- 21:57if we do the math there the the
- 21:59difference in resolution between one or
- 22:01the other this equation or this equation
- 22:04is 0.1
- 22:06molts which is like basically nothing um
- 22:10so like for instance the ADC on your XMC
- 22:144700 it has a 12 bit ADC and so this
- 22:18would be kind of the difference between
- 22:19these two equations. Okay, the problem
- 22:22with this is see this 5 volts here. The
- 22:25only way that we can represent
- 22:27one one or the only uh voltage that will
- 22:30actually result in this code here 111 is
- 22:34if we have exactly 5 volts. Okay, but
- 22:37all these other steps like there's a big
- 22:39voltage range where it would result in
- 22:42this value. So it's very it'd be like
- 22:43almost impossible that we would actually
- 22:45get to this this value right here 111.
- 22:49So that's kind of an issue. Let's kind
- 22:51of talk about um how we could
- 22:54potentially fix that. Before we do that,
- 22:57let's look at how we actually take um a
- 23:02voltage and figure out what the code
- 23:04would actually be. So this is the
- 23:06equation we can use to take a voltage
- 23:09value and convert it into a digital
- 23:11value. Okay? And I'd encourage you to
- 23:15not memorize these. You should be able
- 23:18to once you kind of understand how this
- 23:19all works, you should be able to just
- 23:21kind of infer what the equation should
- 23:23be. Okay? Maybe right now an equation is
- 23:26good to kind of understand how this
- 23:27works. But as we talk about it more, you
- 23:30should be able to just kind of come up
- 23:31with this equation. Like I don't have
- 23:33these memorized, but if someone were to
- 23:35ask me how do I convert uh this voltage
- 23:38to this value on an ADC, I'd be able to
- 23:41do it. So what is this equation actually
- 23:44talking about here? Well, we have these
- 23:45things called RL and RH. These are our
- 23:49reference voltages. In this example, our
- 23:52reference voltage, our low reference
- 23:55voltage is zero and our high is 5 volts.
- 23:58But we'll find out later when we talk
- 24:00about ADCs that you can actually change
- 24:04these references here. Okay? So, if I
- 24:07wanted to measure a smaller signal, I
- 24:08could potentially make this reference
- 24:10smaller, but you need that voltage range
- 24:12in order to calculate what the actual
- 24:14digital value is going to be because
- 24:15they're going to spread that digital
- 24:17value across the whole voltage voltage
- 24:20range. Does that make sense?
- 24:24Any questions on how that equation kind
- 24:26of works?
- 24:29Okay. So, if we kind of plug some
- 24:31numbers into this equation, if we have
- 24:352.8 volts, we can see by based on this
- 24:38stair step that we're probably going to
- 24:39get uh three here. And how does that
- 24:42actually work out? So, here's the math.
- 24:44Figure it all out. And then we have to
- 24:46do a floor function because we can't
- 24:48have a a floating point in here, right?
- 24:50Usually an ADC is representing the value
- 24:53in an integer. We have to do a floor.
- 24:56And you can see in this example uh
- 24:58that's going to be three. Okay, that's a
- 25:00digital value that's actually going to
- 25:02be stored. But this this has some issues
- 25:05here. We have we have a lot of error,
- 25:08right? The actual uh um like floating
- 25:12point value that we're trying to
- 25:13represent is 3.92. That's pretty far
- 25:16away from from three, right? Four would
- 25:19probably be a better number to represent
- 25:21this. So how can we do that instead?
- 25:24Another issue with this is this 5 volts,
- 25:26right? The issue that we talked about in
- 25:28the last slide. So what can we do
- 25:31instead? We can actually shift this. And
- 25:33this is what a lot of like ADCs will do
- 25:36is they will shift over that function so
- 25:39that our um error is not as big. Okay.
- 25:43So in this example, they're adding, they
- 25:45call it adding half a least significant
- 25:47bit, and that will make our ADC
- 25:51half a least significant bit more
- 25:54accurate.
- 25:55Does that make sense? It's kind of maybe
- 25:58I'll show you the math here and maybe
- 25:59it'll make more sense.
- 26:02Um, but anyways, you plug in this, you
- 26:05add that half of a least significant bit
- 26:08and then when we do a floor for that, we
- 26:10get a much more accurate value. we get
- 26:12four instead of three. Okay, which is a
- 26:14lot closer to 3.92. The actual like if
- 26:17we were to do floating point that would
- 26:19be the actual value that would be stored
- 26:21digitally.
- 26:24Does that make sense?
- 26:28Okay.
- 26:32All right. So, we kind of talked about
- 26:34what resolution is. That's kind of just
- 26:36like the distance between each step.
- 26:38Like what's the voltage range for each
- 26:40step? That's our resolution. If we have
- 26:43larger steps, that means we have less
- 26:45information and a worse resolution. So
- 26:48if we need really good resolution, we
- 26:50need to decrease that step size or
- 26:52increase the number of bits that we're
- 26:55using. Quantization error. This is this
- 26:59is that error we were talking about. Um
- 27:02and we can change it. So if if in this
- 27:04example the quantization error is one
- 27:08significant bit or least significant bit
- 27:10one least significant bit. Okay so we
- 27:12could be off by a whole least
- 27:14significant bit. But if we shift this
- 27:16over the max error that we can have so
- 27:19at these corners that's where we're
- 27:21going to have the most error. That's
- 27:23going to be half the least significant
- 27:25bit. And so this this plot here kind of
- 27:27shows at these points that's where we're
- 27:30seeing the most error. If we get really
- 27:32lucky, maybe we'll be right on the dot.
- 27:34Uh, but this is what our max error is
- 27:36going to be. Does that make sense?
- 27:39Because it So, make sure that you
- 27:41understand these two terms because
- 27:43that's going to be the next question
- 27:45here.
- 27:48So, look at them just a little bit
- 27:50longer.
- 27:51All right. So for this question, why
- 27:55don't you work for 90 seconds with your
- 27:56neighbor and tell me what the
- 27:59quantization error is for a 12bit ADC
- 28:03with a voltage range of 0 to 3 volts.
- 28:06Okay,
- 28:08so we gave you that equation a couple
- 28:09slides back. Think about it a little bit
- 28:11and what would the quantization error
- 28:13be? So go ahead and work with your
- 28:14partner.
- 29:07>> [clears throat]
- 29:12>> power.
- 29:18You're like angels.
- 29:37It's like I
- 29:39really like
- 30:03All right. Does anyone want more time?
- 30:07Does anyone have an answer? Like an
- 30:10actual value
- 30:12like they plugged into a calculator.
- 30:13Does anyone have a number?
- 30:17No one has it. Yeah.
- 30:2136.
- 30:22>> Yeah, you got it right. U so it's really
- 30:25small. It's in the millolt range because
- 30:27our ADC is so it has so many bits. It
- 30:30has 12 bits. The quantization error is
- 30:33quite low. Okay. [snorts] And this is
- 30:34going to be way below whatever noise
- 30:36you'll typically experience. So, um,
- 30:39once we get to these these size ADCs,
- 30:42unless you have a really, u
- 30:45analog circuit on the front end of this,
- 30:49um, you're most likely these lower bits
- 30:51are just going to be kind of blown away
- 30:53by noise.
- 30:56Okay, is anyone confused how this
- 30:58equation kind of works? And is anyone
- 30:59kind of confused
- 31:01uh why this equation should be
- 31:04intuitive? Is it intuitive to everyone
- 31:06now? how how you would kind of take a
- 31:09voltage range and then divide it by
- 31:13uh the number of steps we have.
- 31:19Everyone's good on this.
- 31:21Okay.
- 31:25All right. So, let's talk about that
- 31:26voltage range a little bit more. Okay.
- 31:28Let's say we have this signal. If we put
- 31:31our our lower range and our higher range
- 31:35inside of that, well, we're going to
- 31:36have we're going to have clipping. Okay,
- 31:39that's what that's called clipping. And
- 31:41so, we're not actually getting our whole
- 31:42signal there. So, we have to be careful
- 31:44with those those reference voltages in
- 31:46order to make sure that our signal
- 31:48actually fits between them. But we also
- 31:51don't want to make them too big. The
- 31:54reason why is we're kind of we're kind
- 31:55of throwing away a lot of resolution of
- 31:57our ADC, for instance. So, let's say I'm
- 32:00trying to measure uh brain waves. Brain
- 32:03waves are like in the millolt scale. If
- 32:06I were to just hook up my ADC on my XMC
- 32:084700, which has a reference voltage of
- 32:113.3 volts, so 0 to 3.3 volts, and we're
- 32:15trying to measure brain waves, which are
- 32:16like millolts. We're going to have this
- 32:18issue here where the signal is just so
- 32:21small that it's only going to be a
- 32:23couple values. It's only going to vary
- 32:25by a couple digital values. Okay? And so
- 32:28what we could do is we could actually
- 32:30shrink that range to kind of get our
- 32:32signal. What's another another way that
- 32:34we could modify the signal to like if we
- 32:39had an ADC that was between zero and 3.3
- 32:41volts? Uh what could we do to the signal
- 32:44in order to actually read it with that
- 32:46ADC? Yeah.
- 32:49>> Yeah. Amplify it. So that's often what
- 32:52you would do if you wanted to read brain
- 32:54signals. probably want some analog
- 32:56circuit before your ADC, some kind of op
- 32:59amp that's going to amplify that signal
- 33:01for our ADC.
- 33:05And so, ideally, this is what we want to
- 33:07see. We want to see that signal just
- 33:09barely below the top reference voltage
- 33:12and just barely above the bottom
- 33:14reference voltage, but not outside of
- 33:16it. Does that make sense for everyone?
- 33:20Cool.
- 33:24All right. So, we talked about going, I
- 33:28think, from a voltage to a binary code.
- 33:30Oh, wait. No, this is different. All
- 33:32right. What are we talking about here?
- 33:33This is just talking about um what the
- 33:36the different uh digital values could be
- 33:39for different reference voltages. So,
- 33:41for here, we have a reference a lower
- 33:43reference of zero and an upper reference
- 33:45of 4 volts. And so, if we have a voltage
- 33:48of 3.25, 25 that would result in a code
- 33:52of 110.
- 33:55And if we change those reference
- 33:56voltages to one and 5 volts
- 34:01and we have that 3.25, that same thing,
- 34:04well, you can see that that's a
- 34:05completely different digital value that
- 34:07we're going to record because those
- 34:08reference voltages are different. Make
- 34:11sense?
- 34:18Okay. Um
- 34:21what is this talking about? Okay, using
- 34:23anti-aliasing filters. Okay, so we can
- 34:26actually use uh analog filters to make
- 34:29sure that those higher frequencies are
- 34:31not getting into our our sampled signal.
- 34:35Okay, a simple way to do that is with a
- 34:38simple RC filter. Um
- 34:42and we would call that an anti-alysis
- 34:44filter. Do we actually need to do this?
- 34:48Yes.
- 34:49uh longer answer, yes, but sometimes
- 34:52it's already done for you. So, a lot of
- 34:54ADCs are already going to have that
- 34:56filter built into it, but but you need
- 34:58to read the data sheet in order to
- 34:59understand if it's actually doing that
- 35:01and to understand what that filter is
- 35:03actually filtering out. Um, it's going
- 35:07to be designed to filter out. It's
- 35:09basically be right at that Nyquis limit,
- 35:11right? So you need to be uh filtering or
- 35:14sorry you need to be sampling at your
- 35:16maximum rate in order for that filter to
- 35:18actually do its job. If you're sampling
- 35:20at a much much uh smaller rate, let's
- 35:23say I'm sampling audio, right? My a the
- 35:26ADCs on our microcontrollers can go way
- 35:29faster, like in mega samples per second.
- 35:33But if I'm doing audio, I'm sampling way
- 35:35lower. So, I'm going to have to actually
- 35:36put an external circuit out there in
- 35:38order to filter out all of those
- 35:41frequencies outside of my Nyquis rate.
- 35:44Okay? Okay. So, if I'm sampling at uh 48
- 35:47kHz, then that's that's where my filter
- 35:50needs to live more in that range than in
- 35:52the like mega megahertz range.
- 35:58And this is a little bit more detail on
- 36:00how you would actually create an RC
- 36:02filter. Where do they teach this in 215,
- 36:06right?
- 36:07>> 216. Okay. So, if you took 216, this
- 36:10should be familiar. If you ever need to
- 36:13need to look back at these slides
- 36:14because you need to do some filtering,
- 36:16you can look back at this. But one
- 36:18important thing is this is uh it's it's
- 36:20kind of there's a rolloff here, right?
- 36:22It's not like these filters are magic in
- 36:25that they immediately just uh filter any
- 36:29frequency above what it's designed for.
- 36:32There's kind of a rolloff there. And
- 36:34that kind of goes back to why um they
- 36:37sample audio at 44 kHz because they're
- 36:40kind of accounting for this that some of
- 36:42those higher frequencies are actually
- 36:43going to kind of sneak through uh
- 36:46because this thing rolls off. All right,
- 36:50but yeah, you can take a look at this
- 36:51equation if you ever need to build one
- 36:53of these circuits.
- 36:57Okay, so going from analog to digital.
- 37:01So, we have a physical phenomena and we
- 37:03put it into a magic black box and then
- 37:05we get engineering units. That's what we
- 37:07want. How do we get there? We take that
- 37:11thing. Maybe it's light. We have a
- 37:13sensor. That sensor also is known as a
- 37:17transducer
- 37:18that converts that light into, let's
- 37:20say, a voltage or maybe a current. We
- 37:23then plug that into our ADC
- 37:26analog to digital converter. that's
- 37:29going to make some digital value and
- 37:32then we're going to use our software to
- 37:33convert that into
- 37:36maybe we're measuring light. So we're
- 37:38going to convert that into lux which is
- 37:40a way to measure light. Okay. So this is
- 37:42the way that we would take light and
- 37:44convert it all the way to lux.
- 37:48So here's an example where
- 37:50we have a temperature sensor. Um, and
- 37:55this you'll often find this with
- 37:56temperature sensors where uh they'll
- 37:59take um
- 38:02like a temperature for instance and
- 38:03they'll output a voltage. Okay, you
- 38:05actually need to power this thing. Some
- 38:06of these pins are your power and then
- 38:09usually the middle pin is a voltage
- 38:11that's going to be outputed. Okay, and
- 38:13the great thing about this is we can use
- 38:15an ADC to measure that voltage and then
- 38:18we can figure out what the actual
- 38:19temperature is. Okay, but we have to do
- 38:22a lot of math in order to get that to
- 38:23work. Um, so we call it, so taken from
- 38:26Wikipedia, a transducer is a device that
- 38:29converts one type of energy to another.
- 38:31So here we're converting temperature
- 38:33into a voltage. And this is this would
- 38:36be something that would be get pulled
- 38:38out of a data sheet. So you would buy
- 38:40this temperature sensor here and you
- 38:42would look at the data sheet and they
- 38:43would have this graph here. And then you
- 38:46would have to use this graph in order to
- 38:48figure out what your code is actually
- 38:50going to do with this voltage value
- 38:52because we have to convert that voltage
- 38:53into a temperature. Temperature is what
- 38:55we're trying to get here. So that's
- 38:57what's actually useful. But we would
- 38:58need to convert it first. Okay? And so
- 39:01you would go into the data sheet, you
- 39:02would see something like this. Hopefully
- 39:05they give you an equation and then you
- 39:07can put that into your software for it's
- 39:10really important you guys know how to do
- 39:12this because it's going to be on the
- 39:14midterm. So definitely something like
- 39:15Oh, everyone. That was crazy. I said
- 39:17midterm and everyone's head just like
- 39:19went up. That was crazy.
- 39:23Okay. [laughter]
- 39:28Um Okay. So, I'm going to have you do a
- 39:30worksheet, okay? And I want you to
- 39:32answer these four questions
- 39:35um using the information that you have
- 39:36on this slide.
- 39:41Go.
- 39:43Go.
- 39:45>> [snorts]
- 39:45>> Yep.
- 40:00>> Thank you.
- 40:01>> Yeah.
- 40:06>> Here you go.
- 40:09>> Here you go.
- 40:21I mean this is the first
- 40:38you
- 40:56Pass those down.
- 41:15Thank you.
- 41:15>> Yep. No problem.
- 41:25>> Yep.
- 41:31Here you go. Here you go, guys.
- 41:41terrorist.
- 41:45>> Mhm.
- 42:08I'll pass this down.
- 42:21>> Yep.
- 42:22Those are good.
- 42:26Yep.
- 42:36>> [sighs]
- 42:46>> Yep.
- 42:55>> [clears throat]
- 42:59>> Yeah,
- 43:05>> there's three. I think
- 43:09>> you're not in this class.
- 43:13>> I heard you were giving. [laughter]
- 43:16>> There you go.
- 43:20I think you can just count.
- 43:24>> That should be three. If not, let me
- 43:26know. There you go.
- 43:34>> Yep.
- 43:42>> Very good at this.
- 43:58I might have given you too many.
- 44:02>> Good.
- 44:06Right.
- 44:12I miss anyone?
- 44:31He's
- 44:58a one status.
- 45:0712 something.
- 45:39Yeah.
- 45:48[snorts]
- 45:56Whatever.
- 46:05Good morning.
- 46:31>> [clears throat]
- 46:44>> I think
- 46:46I
- 46:58The only thing
- 47:12I like.
- 47:38Oh yeah.
- 47:41>> Yeah.
- 47:56Sorry guys.
- 48:28>> [clears throat]
- 48:33>> Yeah,
- 48:35there you go. Yeah.
- 48:48I should have
- 48:52second
- 49:07and Like I was
- 49:18thinking,
- 49:36you know, I
- 49:38teasing me.
- 49:59Let's do that.
- 50:05[clears throat]
- 50:07Does anyone need help and want me to
- 50:08come by?
- 50:10>> Anyone? [clears throat]
- 50:33>> Yes.
- 50:36>> [clears throat]
- 50:39>> As far as like the step size, that part
- 50:41I think made sense. It's just the same
- 50:43process of doing like 3.3 over.
- 50:49>> Yeah.
- 50:50>> And then actually going from like the
- 50:51transfer function part are is that
- 50:54should we be like then using this
- 50:57>> or I'm kind of confused.
- 50:59>> But you also have to use this, right?
- 51:01>> Is that to get
- 51:05So what what your alult your ultimate
- 51:07goal is to take think about the software
- 51:09that you're going to write, right? So
- 51:11the software is going to output an ADC
- 51:13value and this is an integer between 0
- 51:17and 2 to the n minus one.
- 51:19>> Yeah.
- 51:20>> Uh so that's what my ADC is going to
- 51:21output. I want to take that value and I
- 51:25want to convert it into a temperature.
- 51:26Let's say this is a lab, right? And we
- 51:29want to put temperature out on the
- 51:31terminal. Okay. Yeah.
- 51:33>> So, we have an So, we have this equation
- 51:36is how we take um an ADC value. Well,
- 51:41you'd have to flip it. This is how you
- 51:42take an ADC value and turn it into a
- 51:45voltage or the other way around. You
- 51:47take a voltage and turn it into an ADC
- 51:49value.
- 51:50>> Okay.
- 51:50>> Okay. And this is an equation that takes
- 51:53a voltage and turns it into a
- 51:56temperature. So if you can combine those
- 51:58together,
- 52:01I can take an ADC value, convert it into
- 52:04a voltage, and then convert it into a
- 52:06temperature.
- 52:07>> Okay.
- 52:08>> Okay. So I Okay. So I originally I was
- 52:12kind of on that track, but I guess I
- 52:13then I missed this aspect of actually
- 52:15getting the
- 52:24>> Yeah. Keep thinking about it. You're
- 52:25good. All right.
- 52:28Yeah.
- 52:31[clears throat]
- 52:35>> Yeah.
- 52:38>> Almost like reverse engineering it like
- 52:40we're giving we're given an ADC value
- 52:42and we kind of go backwards and see okay
- 52:44what's the temp that gave this
- 52:45>> and then what would the temp be that
- 52:47gave that.
- 52:48>> Yep.
- 52:48>> Okay. And then for four for the same
- 52:50thing frequency like I'm obviously
- 52:51thinking of like Nyquist. Um, but like I
- 52:54guess I don't know how we get a
- 52:55frequency out of just like
- 52:59>> you don't you have to think about the
- 53:00application.
- 53:02Think about why you would want to use
- 53:04this temperature sensor and what
- 53:06sampling frequency you would want to do
- 53:08based on what I'm using it for. And we
- 53:11didn't really give you that much
- 53:12information.
- 53:12>> So is it possible that people get
- 53:14different answers?
- 53:15>> Oh yeah.
- 53:15>> Okay.
- 53:15>> Yeah.
- 53:16>> So it's kind of just like
- 53:17>> Yeah.
- 53:19>> Yeah. Think of a use case where you
- 53:20would use a temperature sensor and then
- 53:22tell me what you think that sampling
- 53:24frequency is.
- 53:31>> Yep.
- 53:40>> How we doing?
- 53:46>> I think we're figuring it out. Okay.
- 53:58>> How do you already get How did you
- 53:59Where's your work?
- 54:01>> You did this all in your head.
- 54:03>> Oh, well, I used a calculator.
- 54:05[laughter]
- 54:07>> Dang. Okay, man. These calculators must
- 54:10be advanced now, huh?
- 54:12>> So, I guess we can use like
- 54:13>> I mean, is this looking correct? Because
- 54:16this is just
- 54:17>> I mean,
- 54:20Oh, no. That's not right.
- 54:22>> Okay. [laughter]
- 54:25>> Well, maybe it is.
- 54:27>> I don't know.
- 54:29>> Um, what are you trying to do here? So,
- 54:31you're trying to get a temperature X.
- 54:33What is X here?
- 54:34>> Oh, that is
- 54:36the ADC value. Sorry.
- 54:45size
- 54:46>> it might be right
- 54:48>> but
- 54:50>> I don't know
- 54:51>> I don't have it memorized so
- 55:28>> Yeah.
- 55:38>> Hey, how you guys doing?
- 55:41>> Little confused.
- 55:42>> Yeah.
- 55:43>> Okay.
- 55:43>> For the first part, is it is the right
- 55:46do like 3.3 / 2 to 10us for the first
- 55:49part. Okay, for the second part we were
- 55:53just talking about would we rearrange
- 55:55this?
- 55:56[sighs]
- 55:59>> Um,
- 56:01yeah, that that could be a Yeah,
- 56:04>> basically what we're trying to do is
- 56:05we're trying to take
- 56:07um
- 56:10>> we're trying to take a a temperature and
- 56:13figure out what the resulting Well,
- 56:15actually the other way around. We're
- 56:16trying to take an ADC value. We're
- 56:18trying to figure out get an equation
- 56:21that would actually tell us the
- 56:22resulting temperature.
- 56:25>> Oh, I see.
- 56:27>> So, if we rearrange this so you can
- 56:42>> Yeah. So if you go uh one slide back,
- 56:47these equations here, that's a way to
- 56:49get an ADC value with a voltage, right?
- 56:52And this equation right here gives us a
- 56:54voltage. So we could plug that into
- 56:57there. But this one is taking it the
- 57:00other way around. It's taking a voltage,
- 57:02converting it to an ADC value. We need
- 57:03to take an ADC value and convert it into
- 57:06a voltage and then convert it into a
- 57:08temperature.
- 57:39The sample your You're asking what the
- 57:41answer would be for four.
- 57:43>> I'm guessing like are we like do we just
- 57:45base it off the output frequency of the
- 57:47temperature sensor?
- 57:48>> We don't know the output frequency of
- 57:50the temperature.
- 57:50>> So I have to figure that out without
- 57:52knowing.
- 57:52>> It could be could be infinite kind of. I
- 57:58guess you have to think about your use
- 57:59case. What would you use a temperature
- 58:01sensor for?
- 58:03>> Maybe like I don't know if you like
- 58:06temperature maybe. How often would you
- 58:08need to sample if you were doing room?
- 58:10>> Barely. Maybe once every like half an
- 58:12hour or something.
- 58:13>> Yeah. Well, probably every minute. I
- 58:16mean, a thermostat will probably do it
- 58:18once a second.
- 58:19>> Oh, really? It's pretty fast.
- 58:21>> Yeah. Yeah.
- 58:22>> Okay. So, like a use case.
- 58:23>> Yeah. Yeah. I think about a use case.
- 58:25Yeah.
- 58:25>> Can I ask you a prelab question?
- 58:26>> Yeah.
- 58:27>> I was working on the prelab
- 58:29>> for seven
- 58:31>> or six.
- 58:32>> For six.
- 58:33>> Okay.
- 58:36I was going to say I just posted seven.
- 58:37Yeah, you you're on it.
- 58:54>> Um, not whether or not you need to pay.
- 58:56Well, I don't I have no idea if ST paid
- 59:00for these addresses,
- 59:01>> but they basically have two addresses.
- 59:03Yeah.
- 59:04>> And they use a pin on the micro or on
- 59:07the accelerometer to choose between
- 59:09those two addresses.
- 59:12>> Okay. So, they decided that because I
- 59:15might want to put two of these on a PCB
- 59:17for some reason, I'm going to give the
- 59:20user the option to have two addresses.
- 59:23And the way that they can choose between
- 59:25those two is they can use this extra pin
- 59:28that we added to the device that you can
- 59:30set either high or low. And that will
- 59:31change the address of the device.
- 59:34>> So we we would write to the like GPIO
- 59:37pin connected to, right? Not to the SA.
- 59:40>> Uh do we
- 59:42>> Well, you you don't even have to connect
- 59:43that to a Are you asking if you connect
- 59:46SA to a GPI open?
- 59:48>> Yeah. Is that how
- 59:49>> you could, but or you could just connect
- 59:51it to ground or VCC? You don't even have
- 59:53to connect it to your microcontroller.
- 59:55>> I you probably are just going to keep it
- 59:57at one value, right? So just connect it
- 59:59to either ground or VCC.
- 1:00:01>> Oh, then wait what would drive the data
- 1:00:03line then?
- 1:00:04>> The data line is your other those are
- 1:00:06different uh wires. Those are your SCCL
- 1:00:09which is your clock and your SDA.
- 1:00:11>> So those two wires are where what the
- 1:00:13data is actually going to be. This is
- 1:00:15just like an input into the chip to to
- 1:00:17tell the chip which address it should
- 1:00:19have.
- 1:00:21Like I could get rid of that completely,
- 1:00:23that pin, and just design the chip to
- 1:00:27not have it, and just have a fixed
- 1:00:28address, one address, and then I
- 1:00:31wouldn't even need a pin like that. But
- 1:00:32they decided they want two addresses.
- 1:00:35>> And so they gave you a pin to select
- 1:00:37which address you actually want.
- 1:00:41>> But
- 1:00:43to actually like address the registry,
- 1:00:45we use the sub address. So why do we
- 1:00:48need this address? No, no. There's the I
- 1:00:51squared C address and then there's the
- 1:00:53sub addresses. The I squared C addresses
- 1:00:55if I have multiple sensors on I squared
- 1:00:57C bus. They all have different
- 1:00:59addresses. Okay, so I need to first send
- 1:01:02that address to let the bus know who am
- 1:01:04I actually talking to. Maybe I have 10
- 1:01:06different sensors on this bus. They all
- 1:01:08have different addresses. I first need
- 1:01:10to send that address to be like, hey, I
- 1:01:11want to talk to the accelerometer. Then
- 1:01:13once I'm actually talking to the
- 1:01:15accelerometer, that's where I start
- 1:01:16sending the sub address, which is the
- 1:01:19address of the registers inside of the
- 1:01:21accelerometer.
- 1:01:23>> Okay.
- 1:01:24>> So it's two separate addresses.
- 1:01:27>> Oh, so I send the
- 1:01:30like S0 connected ground.
- 1:01:37>> Yeah, makes sense.
- 1:01:40>> I might have to
- 1:01:41>> Oh, yeah. We we can talk after lecture
- 1:01:43here. Okay.
- 1:01:56>> All right, let's go through these
- 1:01:59answers.
- 1:02:02Um, I got to find the slide.
- 1:02:13Okay, let's start with the first one.
- 1:02:15What is the minimum step size of this
- 1:02:17ADC? Who's got the answer? Yeah.
- 1:02:29>> Is [clears throat] that what you got?
- 1:02:31>> Okay. So, it should be pretty intuitive.
- 1:02:33I have a voltage range. We told you that
- 1:02:36the voltage range is between 0 and 3.3.
- 1:02:40We need to divi to to divide it by the
- 1:02:42number of like steps we have in our ADC.
- 1:02:45So it would be 3.3 divided by 2 to the
- 1:02:4910. That's how each how big each step
- 1:02:52is.
- 1:02:53Okay, this is one of those things that
- 1:02:56you should just you should just be able
- 1:02:57to intuitively know without knowing the
- 1:03:00equation. Technically, we should have
- 1:03:02put that minus one there, but we didn't.
- 1:03:06All right.
- 1:03:08Oh, before I go through that answer. All
- 1:03:10right. What is the answer to this one?
- 1:03:12Well, I guess was that the answer?
- 1:03:15I think that No, no, that was not the
- 1:03:17answer. What's the answer to this one?
- 1:03:20There should be an equation that's going
- 1:03:21to take basically a ADC value. So, a
- 1:03:25value between 0 and 4,95.
- 1:03:30It's going to take that value and
- 1:03:32convert it into a temperature. Yeah.
- 1:03:43>> USUS 0.96
- 1:03:48>> maybe. [laughter]
- 1:03:51Let's go through it and you can tell me
- 1:03:52after we go through the whole thing if
- 1:03:54this is what you had. All right. So,
- 1:03:56let's kind of do it step by step.
- 1:03:58Um,
- 1:04:00I don't have the answer in front of me.
- 1:04:01That's why I can't tell you whether that
- 1:04:03was I don't even know why I asked you
- 1:04:04because I can't even verify it. But
- 1:04:06we'll find out if that you were right.
- 1:04:08You already told everyone what it is. So
- 1:04:10hopefully you were right. Okay. So first
- 1:04:12we have this equation here. This is what
- 1:04:15we were just given right here. This is
- 1:04:18what that is. So we have a temperature
- 1:04:20and then we plug it into this equation
- 1:04:22and we get a temperature or sorry we
- 1:04:23have a temperature. We plug in this
- 1:04:25equation. We get a voltage. Okay? That's
- 1:04:27what's being outputed by our sensor.
- 1:04:30Okay. And then here is the equation to
- 1:04:33figure out what that what a voltage
- 1:04:36would be converted into as an ADC. So
- 1:04:39these are two separate equations. Okay,
- 1:04:42does this kind of make sense? This is
- 1:04:46the voltage that we're measuring and
- 1:04:48then the range that we're measuring
- 1:04:51over. So we're measuring between 0 and
- 1:04:533.3 volts. If we we're getting basically
- 1:04:57a ratio there, right? If I have a low
- 1:04:59number here, I'm going to get a low ADC
- 1:05:02value. If I have a high voltage, I'm
- 1:05:04going to get a high ADC value. So, we're
- 1:05:06going to take that ratio and then we're
- 1:05:08going to multiply it by 2 to the n.
- 1:05:10That's how many steps we actually have.
- 1:05:11And so, then that will give us that
- 1:05:13integer value that we that our ADC will
- 1:05:17will output.
- 1:05:19Okay. So, we have those two equations.
- 1:05:21We basically just need to combine those
- 1:05:22together. So, we'll take this voltage
- 1:05:25that we're actually getting from the
- 1:05:27temperature sensor and plug it into this
- 1:05:29equation right here. And so, then we got
- 1:05:31this.
- 1:05:33And then because we don't actually want
- 1:05:38um temperature or we actually don't want
- 1:05:40ADC counts. We want the temperature
- 1:05:43based on the number of ADC counts we
- 1:05:45have because that's what our software is
- 1:05:47actually going to have access to. Our
- 1:05:49software is going to see the number of
- 1:05:51ADC counts and it's going to convert
- 1:05:54that into a temperature. That's the goal
- 1:05:56of what we're doing here. And so this is
- 1:05:58the equation that we actually need. And
- 1:06:00if we plug in more numbers into here, so
- 1:06:03VREF, that's going to be 3.3, right?
- 1:06:06That's our range of voltages that our
- 1:06:09ADC is set up to measure. And then 2 to
- 1:06:12the N, that's how many steps we have.
- 1:06:15Okay? And then you do some algebra here
- 1:06:17to figure this all out.
- 1:06:20I'm glad it's already done for me
- 1:06:21because I would struggle. And this is
- 1:06:24the final equation.
- 1:06:26If we do this division stuff here, this
- 1:06:28is what we actually get. So this is the
- 1:06:30actual answer here. We take these ADC
- 1:06:33counts, we multiply it by this number,
- 1:06:35and then subtract this number, and that
- 1:06:36will give us the actual temperature that
- 1:06:38we're trying to measure. Did anyone
- 1:06:40actually get that? Did you get it? No.
- 1:06:42[laughter]
- 1:06:43Okay. Does it make sense how we got
- 1:06:45there though? Do you think you could do
- 1:06:47this on an exam where we could give you
- 1:06:49a temperature sensor? We often do that.
- 1:06:51We always pick temperature sensors for
- 1:06:53some reason. We could give you that
- 1:06:54temperature sensor and then you'd have
- 1:06:56to write CC code that would take that
- 1:06:58ADC value and convert it into a
- 1:07:01temperature
- 1:07:03think so is it do all of these steps
- 1:07:05kind of make intuitive sense why we did
- 1:07:08it? Yeah.
- 1:07:18Yeah, it's like the measured voltage.
- 1:07:20It's the voltage of the sensor. Voltage
- 1:07:23T is for the temperature sensor.
- 1:07:29>> Say again.
- 1:07:34>> Well, no. It's just like we're we're
- 1:07:36going to take a measurement. It's going
- 1:07:38to be one just measurement. It could be
- 1:07:39anything between
- 1:07:41Well, it could be anything between this
- 1:07:44range right here. So, 8 volts to 1.3
- 1:07:48volts.
- 1:07:49Anywhere in between that. If we plug
- 1:07:52that into our equation, the resulting
- 1:07:55uh after plugging in this equation, we
- 1:07:58should get the temperature down here.
- 1:08:00Does that make sense?
- 1:08:03>> Yeah.
- 1:08:08Um
- 1:08:09technically yeah but we are um
- 1:08:16I don't think it really matters in this
- 1:08:17scenario. Do we actually have to do
- 1:08:19that? Do we need to floor it anywhere?
- 1:08:23Because we're dealing with such a high
- 1:08:25resolution. I don't really think it
- 1:08:26matters. Okay. the the error that you're
- 1:08:29going to get between flooring it and not
- 1:08:30flooring it is like point something 01
- 1:08:35temperature or whatever something like
- 1:08:36that. Okay,
- 1:08:39any other questions?
- 1:08:44Okay, let's go on to the third question.
- 1:08:48Okay, so what is the ADC value for
- 1:08:51temperature of 50° Celsius?
- 1:08:55Did anyone get it?
- 1:08:58Yeah,
- 1:08:59>> I got 361.
- 1:09:00>> 361. Let's see if you're right.
- 1:09:04I'm just going to skip ahead. Let's see.
- 1:09:06361. You got it right. All right, cool.
- 1:09:09All right, let's think about how this
- 1:09:11works. And I already kind of forgot, so
- 1:09:13I got to think about it more. All right,
- 1:09:15so here's our equation that gives us the
- 1:09:19uh voltage and temperature, right? Okay,
- 1:09:22that's this equation here. And then we
- 1:09:24divide it by the reference. So for our
- 1:09:26our reference is 0 to 3.3 volts. So we
- 1:09:29would have 3.3 here. That's giving us
- 1:09:31that ratio again. Okay. Then we multiply
- 1:09:34it by the number of steps. And then
- 1:09:37that's our ADC. So we got 3.3. We got
- 1:09:4050. That's our temperature.
- 1:09:43361 is the value that our ADC is going
- 1:09:47to output. Okay. Does that make sense?
- 1:09:50Let's kind of think about it.
- 1:09:52Um, so if we plug
- 1:09:56uh that temperature into here, we're
- 1:09:58going to get a voltage of 16.
- 1:10:02And if we look at the graph, yep, that
- 1:10:05makes sense. Okay, so that's always a
- 1:10:08good way to kind of check things like
- 1:10:10plug in all plug it just pick some
- 1:10:11random numbers, plug them in there, look
- 1:10:13at the graph, does it actually work?
- 1:10:16Okay, yeah, we're probably doing
- 1:10:17something right here. Okay. And then the
- 1:10:19last question, what sampling frequency
- 1:10:22should we use
- 1:10:24for this? Does anyone have an what would
- 1:10:27you use? There's really no correct
- 1:10:29answer.
- 1:10:31>> Does anyone have have a guess? You can't
- 1:10:34be wrong. Well, maybe. I guess you could
- 1:10:36be a little bit wrong.
- 1:10:38>> Yeah.
- 1:10:44>> Yeah.
- 1:10:47>> Yeah. That really depends on your
- 1:10:48application. If I have a thermostat,
- 1:10:51maybe I want to just sample it at one
- 1:10:53hertz, so once a second. Okay, we might
- 1:10:56want to be careful about our filtering,
- 1:10:58right? We're really we're sampling
- 1:11:01really slow. So maybe we want to take
- 1:11:04multiple samples and average them
- 1:11:05together. Maybe we want to put some kind
- 1:11:07of filter in there. Although a filter at
- 1:11:10one hertz is pretty crazy. Um, so yeah,
- 1:11:13it could really be anything. What if I
- 1:11:14had a temperature sensor though inside a
- 1:11:18GPU die? Right? You they actually have
- 1:11:21temperature sensors in there. I don't
- 1:11:22know if you've ever looked at if you've
- 1:11:24ever done some gaming and you're looking
- 1:11:26at your GPU and what temperature it's
- 1:11:28at. It'll tell you what it is, right?
- 1:11:30And it's got a bunch of fans on there.
- 1:11:32Well, that thing has to be sampled
- 1:11:34really quickly because that thing that
- 1:11:36temperature sensor is making sure that
- 1:11:38your GPU isn't going to catch fire and
- 1:11:41um and just melt, right? So it's going
- 1:11:44to actually throttle down the frequency
- 1:11:46of the GPU in order to not go above a
- 1:11:49certain temperature. So that might be an
- 1:11:51example where we need to sample at a
- 1:11:53much higher rate. Okay, with a
- 1:11:55temperature sensor.
- 1:11:58All right, so one last thing I kind of
- 1:12:00added this slide because I think it's
- 1:12:02kind of important and it's about
- 1:12:04measuring resistance and measuring
- 1:12:06current.
- 1:12:08So my question to you is how could So
- 1:12:11we've been talking about ADCs and it
- 1:12:14seems like the only thing that they can
- 1:12:15actually measure is voltage and that's
- 1:12:17true. Just by themselves they can only
- 1:12:20measure voltage the way that they're
- 1:12:21designed.
- 1:12:23What could we do to measure resistance?
- 1:12:25A lot of sensors out there and a lot of
- 1:12:27transducers,
- 1:12:29they actually output a resistance
- 1:12:32instead of a voltage. Okay? Like
- 1:12:34temperature sensors, a lot of them,
- 1:12:35that's how they work. It's basically a
- 1:12:37resistor. As it gets hotter, the
- 1:12:39resistance goes up. Or if it gets
- 1:12:41colder, the resistance goes down. How
- 1:12:44could we measure resistance with an ADC?
- 1:12:47Yeah.
- 1:12:57like that.
- 1:13:00You have the right idea. Yeah.
- 1:13:08>> Yeah. But draw the circuit out for me.
- 1:13:11How do I How does the vol where am I
- 1:13:13actually putting volt? You're not in
- 1:13:14this class, but I'll let you answer.
- 1:13:24>> Yeah. Does everyone know what a voltage
- 1:13:26divider is? Yeah, you're going to
- 1:13:28definitely need it for next lecture.
- 1:13:30Okay, it's really important that you
- 1:13:32understand what a voltage divider is.
- 1:13:34There's a very simple equation for a
- 1:13:36voltage divider. That's what it is. And
- 1:13:38basically what it is, you take two
- 1:13:39resistors and you have a voltage at the
- 1:13:42top, you have a voltage at the bottom.
- 1:13:44Usually, it's ground. And then there's a
- 1:13:46voltage in the middle and you can plug
- 1:13:48in your resistance values. Actually, I
- 1:13:51think it's this one right here. You can
- 1:13:52plug in those resistance values,
- 1:13:55multiply it by the voltage that you're
- 1:13:57supplying to this whole circuit, and it
- 1:14:00will output a voltage here. Okay? And so
- 1:14:02this, if I know the resistance of one of
- 1:14:06these, then I can just use this equation
- 1:14:08to solve the resistance of this if I
- 1:14:12know what this voltage is. Does that
- 1:14:14make sense? You're going to be doing
- 1:14:16this in lab, but it's really important
- 1:14:17that you understand that for ADCs
- 1:14:20because there's a lot of voltage uh
- 1:14:22dividers in ADCs and DAXs.
- 1:14:27All right, one more question. How can we
- 1:14:29measure current? It's kind of a similar
- 1:14:31idea. How do we typically measure
- 1:14:33current in circuits? Does anyone know
- 1:14:35like what the go-to method is? Yeah.
- 1:14:45Yeah. Why do we want it to be really
- 1:14:46small?
- 1:14:51>> Exactly. Yeah. We want it to be really
- 1:14:52small because uh we don't want to
- 1:14:55basically dissipate a bunch of heat out
- 1:14:56of this resistor and we don't want to
- 1:14:58impact whatever else is using that
- 1:15:00current. And so what we could use is
- 1:15:02something called a shunt resistor.
- 1:15:04And um
- 1:15:07how that works is you take a really
- 1:15:09small it's actually physically big
- 1:15:11because it's usually putting a lot of
- 1:15:13current through it but it's a small
- 1:15:15value and if we know that value it's
- 1:15:18usually very precise we can measure the
- 1:15:20voltage drop across it as the current
- 1:15:23flows through it and then we can measure
- 1:15:24that voltage drop plug it into our ADC
- 1:15:27and that's how we measure current.
- 1:15:30Cool.
- 1:15:31All right. One thing, I didn't do this.
- 1:15:33This is all professor sample. I'm going
- 1:15:35to kind of ex try to explain what he was
- 1:15:37doing. It was kind of cool, actually.
- 1:15:39Um, I hadn't watched this lecture
- 1:15:41before, so this is all new to me. But
- 1:15:43what he did is at Disney, he created
- 1:15:46this this watch that could detect what
- 1:15:49you were touching, which was kind of
- 1:15:51crazy. It's kind of magical. Um,
- 1:15:55so how does it work? So, we kind of have
- 1:15:58to understand what EMI is. So every
- 1:16:00electro mechanical device has something
- 1:16:02called EMI. Electroch or electromagnetic
- 1:16:07interference that it outputs. Okay? So
- 1:16:10your phone has some EMI. Um anything
- 1:16:13that's really electronic is going to
- 1:16:15have some kind of EMI that it outputs.
- 1:16:17Okay? And when you're designing a phone
- 1:16:20for instance, you have to make sure that
- 1:16:21the EMI that this thing outputs is not
- 1:16:24out of spec. there's something called
- 1:16:26the FCC and they really don't want
- 1:16:29random uh radio frequencies getting
- 1:16:32outputed out into the air. So, they have
- 1:16:34requirements on what this thing can
- 1:16:36actually output as far as EMI. And so,
- 1:16:39in order to uh make sure that your
- 1:16:41device isn't outputting those
- 1:16:43frequencies, you would take it to one of
- 1:16:44these chambers. It's kind of similar to
- 1:16:46those chambers for audio where you do
- 1:16:48audio recording. This is for radio uh
- 1:16:51frequency stuff. And those walls will
- 1:16:54actually absorb reflections,
- 1:16:56uh, radio frequency reflections, and
- 1:16:58they have this really fancy yaggy
- 1:17:00antenna, and you point it at your
- 1:17:02device, and you get the plot that looks
- 1:17:04like this. And you need to make sure
- 1:17:06that all of those frequencies are below
- 1:17:08the required uh uh requirement from the
- 1:17:11FCC.
- 1:17:14Okay. And so this is what the watch that
- 1:17:16they kind of made, this wristband. And
- 1:17:18so you would wear this thing, and it
- 1:17:20basically has an ADC on there. So, we
- 1:17:22got a Cortex M4 just like what you guys
- 1:17:24are using. Has an ADC on the the thing
- 1:17:28and as I touch something, that EMI is
- 1:17:31going to travel through my body and then
- 1:17:32go to this watch and this watch is going
- 1:17:35to actually measure that EMI. Okay? And
- 1:17:38what they found is that every device has
- 1:17:41its own kind of unique EMI signature.
- 1:17:44Okay? So, if I'm touching my my laptop
- 1:17:47and touching my phone, they have
- 1:17:48different signatures. Okay? Okay. And
- 1:17:51this is what they kind of found. They
- 1:17:52found all of these different devices.
- 1:17:54They actually classified all of these
- 1:17:56and they looked at, okay, well, this is
- 1:17:58like for for that ADC, this is what a
- 1:18:01power drill looks like. This is what a
- 1:18:02motorcycle look looks like. You see the
- 1:18:04motorcycle is really noisy. Probably the
- 1:18:07spark plugs or something.
- 1:18:09Um, and so how it works is a bunch of
- 1:18:14filtering that I don't really
- 1:18:16understand. They take some
- 1:18:18environmental. So they take b like
- 1:18:20basically a base reading and then once
- 1:18:24you start touching something they kind
- 1:18:26of subtract all that environmental EMI
- 1:18:29from the signal just that's kind of like
- 1:18:31the background noise. We need to get rid
- 1:18:33of that first and then they plug it into
- 1:18:36all kinds of crazy stuff and then they
- 1:18:37do some machine learning where they
- 1:18:39actually take that that signature and
- 1:18:42they figure out what it actually is. And
- 1:18:45so here's a video of them demoing this.
- 1:18:48So, he did this with some students
- 1:18:51and you can see it's really it's pretty
- 1:18:53quick. Like the second you touch
- 1:18:55something, it just immediately knows
- 1:18:56what you're touching. And I think the
- 1:18:58use case was I don't know like let's say
- 1:19:01you lost your phone. Maybe it would be
- 1:19:02useful to know when was the last time I
- 1:19:05was touching my phone.
- 1:19:07And so we got a sander, a 3D printer,
- 1:19:13drill,
- 1:19:15and then the the one unique story he
- 1:19:17told is um so at the end of this they
- 1:19:21touched a ladder. Why would a ladder
- 1:19:24have EMI? Does anyone have a guess?
- 1:19:27Yeah,
- 1:19:29>> because it's an antenna. So, it the
- 1:19:31ladder actually had some kind of uh some
- 1:19:34country station radio signals on it, and
- 1:19:37that's what they were actually picking
- 1:19:38up because it's this ginormous piece of
- 1:19:39metal picking up as an antenna.
- 1:19:44All right, I'm going to just skip
- 1:19:46through that, but you can look through
- 1:19:47that if you're curious. Maybe ask him
- 1:19:48some questions. But just to summarize,
- 1:19:51we did some we talked about sampling
- 1:19:53today. We talked about quantization.
- 1:19:55That's where we're converting digital or
- 1:19:58analog into digital.
About this transcript
This page contains the full transcript of EECS 373 - Fall 2026 - Lecture 13: "Overview: Analog Signals" by Interactive Sensing and Computing Lab , generated from the public captions YouTube serves with the video. The transcript has 10,670 words across 1,639 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.
What you can do with it
Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to translate the transcript into 100+ languages.
Free YouTube transcript tool
YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, translation to 100+ languages, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.