Learning to use an oscilloscope can be daunting!
But... that's okay because I'm here to help!
My name is James and I am the Bald Engineer.
In this AddOhms electronic tutorial,
we'll use an Arduino Uno to learn how to use a scope.
Let's go measure!
(I hand write these! Let me know in the comments if they are helpful...)
If you find these videos helpful,
please consider supporting AddOhms and the bald engineer
on patreon.
Before we get started I need to cover a couple of things:
First, I want to say a big thank you to my friends at
Rhode and Schwarz for sending me this RTM3004.
Now... they did reject my first
idea which was a video called:
"How to sell a new scope on eBay!"
So, I decided to make this video instead.
With that said you do not need to have this specific scope for these measurements.
In fact, you can even use a USB-based scope for most of these tips.
Which brings me to my next point:
These tips and measurements only work on digital scopes.
I am NOT going to cover the older analog types.
And last we need to talk about how to start off in a known state.
So let's go talk about that next.
The RTM 3004 has both a "preset and "auto set."
Preset puts the scope into a known "default setup."
While, "auto set" will check all the signals and auto scale each of the inputs.
On my older Regal, however,
it only has an "auto" button.
Which does both the preset and Auto scale at the same time.
Just make sure you reset your scope before each measurement
Ready to get started? Let's kick off with a common voltage measurement.
in this case, we will measure the noise of the 5 volt pin on Uno.
Now, some probes can just fit into the hole. but...
for mine I'm going to clip on to these upside-down header pins.
For ground I stuck in this really long
pin into one of the sockets.
Looking at the scope make sure that your volts per division is set to 5 volts.
This setting determines how much signal is shown on screen.
Let me show you how we can zoom in by going to 2 volts per division.
And we can keep going...
Oh no!!! The signal went off the screen!
Whatever will we do!
eh. it's actually no big deal. We'll just turn the offset knob down
to bring it back on screen.
Now if you keep zooming-in, in this way eventually the signal won't come back.
So in that case we have to think about what we're doing with our measurement.
When we measure the voltage rail we are
usually only interested in the noise so
using the scope we can remove the DC
offset from the DC signal going into the
channel menu we can see that there is an
option for coupling it can either be AC
or DC changing to AC coupling puts a
series capacitor between the B and C and
the analog to digital converter that
capacitor removes the DC offset leaving
only the AC component check this out
I'm going to hit AC coupling and then
I'm gonna press the offset knob to zero
out the channel now when I turn the
volts per division knob or scale knob
only the noise gets larger now it'd be
nice if we had some automated
measurements to measure this so let's go
talk about how to make measurements next
but first I want to change our setup on
the Arduino
you might notice on my screen the grid
is very dim in the old days we would
make measurements by counting the actual
grids today I almost always use
automatic measurements to show how
measurements work we're going to change
our signal
we're going to use analog right and
pulse width modulation or PWM on the
Arduino first we need a variable for our
PWM signal and then we'll set it to
output real quick you don't actually
need to use pin mode with analog right
because analog right will change the pin
to output however I like putting all of
my pin modes in setup so that I can
glance at the code to know which pins
are being used and how and the last
thing we will add is an analog right
with a value of 128 and that should give
us a 50% duty cycle while that uploads
the way I'm connecting is using the same
trick before with upside-down header
pins connect it to pin 3 this time I'm
going to hit preset to put the scope
into a default setup and then let Auto
set find the signal for us ok
how measurements get set up will vary
depending on the scope let's see how the
RTM 3000 does it I'll hit measure to get
the measure window and then go look at
tight and here we can see that they're
grouped by basic vertical horizontal or
count it's pretty common for scopes to
group measurements by vertical and
horizontal so let's talk about those
vertical means vertically on the screen
or more commonly voltage and so I can
remember that because vertical and
voltage both start with the letter V we
look at horizontal these are
measurements that go across the screen
or in time now for this setup I want
three measurements first I want an
amplitude measurement and then second I
would like to see the frequency of our
PWM signal and then third I want duty
cycle
okay now we can see that the signal has
a Fievel an platoon a frequency of 490
Hertz and a duty cycle of 50% even
though it's called analog right there
are only two voltages 0 & 5 the analog
part comes from the amount of time that
the signal is on or off
since the duty cycle is 50% the signal
is only on for about half the time this
is how we can control the speed of a
motor or the brightness of an LED to
demonstrate let me just change the value
that we used to 64 okay so 5 volts 490
Hertz so those two measurements are the
same as before but our duty cycle is 25%
so analog right is only changing the
amount of time that the signal is on now
let's do something a little bit fancy
it's called infinite persistence and
it's a display mode first on the Arduino
code I'm going to move the analog right
into a for loop I'm doing this so that
we can sweep through all of the values
from 0 to 255 on the scope we can see
that the waveform is now kind of like
dancing across the screen so let's go
into display and there's an option
called persistence right now it's set to
OFF which is a little bit of a lie or
it's not entirely true modern digital
scopes will try to fade the waveform to
give it more of a phosphor or CRT look
but that's another story I'm going to
change it to infinite or forever which
means the signal will stay drawn on
screen until I hit clear so in this mode
the signal draws in over time this is
very helpful when you're looking for say
a glitch you can see how often does the
glitch occur here we can see that the
high and low of the waveform happens
very often because its brightest on
screen while the transition area happens
rarely or not as often relative to the
rest of the waveform
okay you know I'm sorry I think we're
getting pretty good with the scope
aren't we
what can we do next I know let's go and
talk about triggers using the Uno's
reset circuit we will learn when to use
the auto and normal trigger or sweet
modes I talked about how the reset
circuit works and the pyramid we know
turn on episode but basically when the
serial signal RTS or DTR goes low it
causes a short glitch that resets the
328p the key is a 100 nano farad
capacitor on the scope I'm going to use
two channels to connect to the reset
capacitor I know this is the reset
capacitor because it's right by the
reset enable pads I'm going to place
channel 1 on RTS or DTR and I'm gonna
place channel 3 on the reset signal now
you've probably noticed I ran out of
hands so I'm gonna try to hold the
probes like this while I go and open the
serial monitor wow that was quick
did you even notice that the signal
flashed on screen well that sort of
makes for a lousy measurement right the
reason it flashed quickly is because the
scope is in Auto trigger mode that means
if it does not see the trigger condition
after a set period of time it just dumps
whatever is in its acquisition buffer to
the screen this mode is really useful
when you're poking around a circuit
because the screen constantly updates
but in this case we want a stable
display for an event that rarely occurs
so we're going to tell the scope only
update the screen when the trigger
condition is met what is that trigger
condition let's take a look it is
watching channel 1 for a falling edge
that crosses through 2.8 volts the
change will make is hitting auto to make
it normal and at this point the scope
stops updating but that's okay
it's supposed to do that and this time
when I reopen the serial monitor awesome
we got a stable display but we can't
really see all that much at this point
the problem is this isn't really showing
us a whole lot about the signals we can
see that they're going active so I'm
just gonna play with the time-base a
little bit to make a better
play remember if you're using a USB bass
scope there are software controls that
can do the same things that I'm doing
with the front panel from previous
measurements I know I need at least
three milliseconds on the screen now you
define the amount of time that gets
captured by changing the time per
division this scope has 12 horizontal
divisions which means 12 times 500
microseconds is 6 milliseconds before we
move on let me review a few of the
settings that I did on the scope so we
already know about the normal trigger
mode I set the time base to 500
microseconds per division and I added a
delay or offset of 2 milliseconds to
kind of move our event closer to the
left side of the screen now I'm going to
re probe the capacitor run the scope and
then open the serial monitor okay
now we get a much more interesting
display the waveform we get is the
glitch that causes reset the RTS signal
the signal and yellow goes low as well
as the reset signal which is on the
other side of the capacitor it drops to
0 volts and then immediately begins to
start charging back up by the way this
charging curve is typical for a charging
capacitor now I'm going to use cursors
to measure how long reset lasts the
first thing we need to do is look at the
80 mega 328 datasheet for the reset
signal it says anything below 0.5 volts
is a low and anything above 4.5 volts is
a high these levels only apply to reset
they are not the same levels that GPIO
pins use I'm going to set my horizontal
cursors to 0.5 and 4.5 now I'm going to
move the vertical cursors to intersect
each of those first the lobe
then the high so using the cursors we
can see that the reset condition lasts
for about two milliseconds now if you
only had one channel or for some reason
one probe you could have still done this
measurement by using a reference
waveform so let's go talk about that
next a rule for test equipment is that
when you add a probe you change the
circuit to see how that works we're
gonna use the Arduino is on board 16
megahertz oscillator and watch how it
changes by adding a scope probe now for
this measurement you will need a scope
with at least 20 megahertz of bandwidth
and ideally you need 50 megahertz the
uno uses a ceramic resonator for its
clock which is this little IC because
this is a higher frequency measurement I
am using this ground pin to make my
connection it provides a shorter path
between ground and signal and for the
ground I'm just going to use a via on
the ground plane and then touch to the
termination resistor right next to the
oscillator stopping the scope I want to
save a copy of the waveform so that I
can compare it later
now some scopes put a reference function
inside of their math functions on the
RTM 3000 there is a dedicated reference
menu from here we can copy source 1 into
r1 now if I run the scope again the live
waveform is the yellow trace and the
white waveform is the saved trace I have
a second probe connected to channel 3
however I am not going to display
channel 3 on the screen instead I'm
going to take the probe tip and probe
the same point than a martyr be probing
and then I'm gonna say probe one more
time as the second probe comes in
contact
notice how the signal changes the probes
are loading down the signal in this case
the loading is very small however it is
important to remember that whenever you
attach a probe whether it's like a
passive probe or a demon
test lead you are changing the circuit
in another video I'll show some proper
scope probing techniques why you need
them and the different types of probes
though now is a good time to ask
questions about probes in the comments
ok let's move on to our last measurement
it's just a little bit more advanced
than the others that we've done so far
now on this last measurement your scope
does need to have the ability to trigger
on and decode serial traffic if not
that's ok just follow along on the
Arduino I'm going to use a serial print
to send the word hello inside of a loop
now even though serial or you are has a
transmit and a receive I only need to
connect to one of them so on the Arduino
will connect to pin 1 which is the
transmit pin setting up the trigger will
vary by scope on the road Ian Schwartz
we start by going into the protocol menu
and changing the bus type to you are
then we can go into configuration and
set up our channels now remember a
second ago I said that I'm only
connected to TX on the Arduino well on
the roadie I'm only going to configure
rx but that's ok because in serial TX
and rx is arbitrary the reason I'm using
Rx is because this scope only triggers
on the RX channel so channel 1 I'll ask
it to find the threshold and then we can
go into the trigger setup and here I'm
going to ask it to trigger on a pattern
and I want it to trigger on 48 hex now
why 48 hex well turns out that that is
the ASCII value for capital H so let me
change this back to normal and let's
stop then zoom in
so what I wanted to show here is if we
look at the serial pattern for this
character we see the start bit then we
see our data which is capital H and then
we see a stop bit now if we were using
parity we would also see that bit in
here as well if i zoom out then we can
see the entire sequence looking at hex
values is okay I mean it's nice that we
can see the whole sequence here but
would be really nice is if we could read
it which we can so I'm gonna go back
into the protocol menu and then I'm
going to go to display setup and then
I'm going to select decimal okay that's
nice but really what I want to see is
ASCII and with ASCII not only can we see
all the letters h-e-l-l-o but we can
also see the inline carriage return and
line feed having your decode and trigger
is nice but I find it really useful for
I squared C and SPI if you get a chance
play around with something like an OLED
display it is really cool to see the
command and data being sent across the I
squared C boss okay so in this video we
use the Arduino to learn how to use a
scope we looked at voltage measurements
time-based controls basic triggers
automated measurements reference
waveforms and finally serial triggering
here's the thing that's just the tip of
the iceberg
we didn't get into different display
modes like X Y or using FFTs or using a
built in function generator or math
functions or a whole bunch of other cool
stuff you can do on a scope before
closing I would like to thank my patrons
J Mike Mike K Joseph V and Paul H if
you'd like to help support this work
please consider joining that list at
patreon.com slash bald engineers if you
would like to learn more stuff on
digital scopes or other electronics
tutorials let me know in the comments
also make sure you are subscribed to
know when new videos on scopes get
released check the description for a
couple of links one will take you to our
Adams discord and another takes you to
the show notes there I'll provide links
related to this episode
my name is James and I am the bald
engineer you can find us around the
internets using the keyword add-ons
remember if your circuit isn't working
grab a scope to see if you need to Adams
Không có nhận xét nào:
Đăng nhận xét