Anda di halaman 1dari 50

TBS1000B-EDU Courseware Lab Sampler

Selection Guide
Discover how the Courseware Resource Center and the TBS1000B-EDU Oscilloscope
can help students get more out of their lab work.

Primer

TBS1000B-EDU Series Oscilloscopes enable educators to integrate teaching materials into the instrument. Step by step instructions, background theory, photos, hints
and tips can be presented directly on the oscilloscope display.
You can build your own labs using the PC Courseware Editor, or download any of over
a hundred lab exercise from the Tektronix Courseware Resource Center and customize
them for your classes.
The Resource Center features labs to help teach students basic oscilloscope operation, circuit theory, and use of common development kits like Arduino, Raspberry Pi,
and TI LaunchPad . Download any of the posted labs for inspiration. When youre
ready, you can share your own labs with the global courseware community.
This sampler of pdf versions, includes seven labs that are available from the Resource
Center and represent a cross-section of the many that are posted online.

Complete versions are available at the Resource Center at:


www.tektronix.com/courseware
www.tektronix.com/power

Power Supply Measurement and Analysis

Table of Contents
555 Timer Astable Multivibrator
OPAMP Integrator Circuit
FFT Spectrum Analysis
Rise and Fall Time Measurement Using Cursors
Burst Width Measurement
Peak-to-Peak Measurement Using Cursors
Measuring Light Intensity Variation Using LDR
Switching LED Based on Light Threshold
Switching LED on Dynamically Assigned Threshold
Switch Press Duration Measurement
Threshold Calibration through LDR Using Switch

Page 3

www.tektronix.com/power

555AstableMultivibtr -- Overview
555 Timer Astable Multivibrator

OBJECTIVES
After performing this lab exercise, learner will be able to:
Design & build Astable Multivibrator circuit using 555 Timer chip
Use digital oscilloscopes trigger to capture and display the
signal
Measure timing information (period, frequency, T_on, T_off and
Duty Cycle) of the signal
Verify the designed parameter against actual values using
oscilloscope measurement

EQUIPMENT
To carry out this experiment, you will need:
TBS1000B-EDU - Digital Oscilloscope from Tektronix
Circuit components (for Astable Multivibrator circuit)
555 Timer IC
Resistor -15K ohms (2 numbers)
capacitor - 10nF
Voltage probe (provided with oscilloscope)
Breadboard and connecting wires

THEORY
Key concepts:

Page 4

Period = Time taken by one cycle


Frequency = 1/Period
Pulse-width modulation (PWM) is a commonly used technique
for controlling power to the analog circuits (or electrical device)
by varying the pulse width to get specific ON and OFF times.
T_on = Period during which the switching device is switched to
conduction state and stays there.
T_off = Period during which switching device transitions from

conduction state to OFF state and stays there


The longer the switch is ON compared to the OFF periods, the
higher the power supplied to the load is.
The DUTY CYCLE is the ratio of ON time to the cycle time (ON
time + OFF time). If DUTY CYCLE is 50% then ON and OFF
time durations will be same.
A PWM signal can be generated using 555 Timer circuit, called
an Astable Multivibrator. Frequency and duty cycle can be
varied by R and C values.

555AstableMultivibtr -- Procedures
Step 1
DUT / CIRCUIT SETUP
Build the circuit as shown below: Choose Vcc = 7.5V, RA = 15K,
RB= 15K, C = 10nF

Switch on the DC power to Timer circuit


Page 5

Step 2
EXPERIMENT SETUP
Power ON the oscilloscope
Connect the Channel 1 probe of the oscilloscope to pin # 3 of
Timer chip
Connect the Channel 2 probe to measure capacitor voltage (pin
# 2 or 6 of the Timer chip)
Acquire the signal(s) from circuit on oscilloscope

Step 3
Autoset the scope to efficiently capture and view the signal
If AUTOSET feature is not enabled, then manually set the
horizontal and vertical scale, and trigger condition to view 3-4
cycles of waveform without any clipping.

Step 4
ADDING MEASUREMENTS
Go to measurement menu by pressing MEASURE button on the
scope front panel
Press CH1 (channel to be measured) & select PERIOD,
FREQUENCY and POS DUTY measurement using MultiPurpose Knob (MPK) button
You can navigate through the measurement list by rotating the
MPK knob and select a measurement by pressing it

Step 5
Record the measurement values and waveform / screenshot

Step 6
Verify the measurement parameters against designed
(calculated based on circuit components)

Step 7
CAN YOU ANSWER THIS?

Page 6

When capacitor is charging up, what is the output - High or


Low?
What are the voltage levels, the capacitor charges/discharges

between?
Can I make a perfect square wave output from a 555 Timer
astable multivibrator circuit?

Page 7

OpampIntegrator -- Overview
OPAMP Integrator Circuit

OBJECTIVES
After performing this lab exercise, learner will be able to:
Design & build Opamp Integrator circuit
Use digital oscilloscopes trigger to capture and display the
signal
Establish relationship between input and output signal

EQUIPMENT
To carry out this experiment, you will need:
TBS1000B-EDU - Digital Oscilloscope from Tektronix
Voltage probe (provided with oscilloscope) / BNC cable
Circuit components:
Opamp (uA 741 IC or equivalent)
Resistor - 1K, 1M Ohms
Capacitor - 100nF
Breadboard and connecting wires
AFG3000 series Signal Generator from Tektronix or equivalent
(for providing AC input to circuit)

THEORY
Key concepts:
An opamp is a high-gain differential amplifier with very high
input impedance.
An OPAMP integrator circuit produces an output proportional to
integral of its input.

Page 8

If a square wave is input to integrator circuit, the output will be


triangular wave

OpampIntegrator -- Procedures
Step 1
DUT / CIRCUIT SETUP
Build the circuit as shown below:

Page 9

Switch on the AFG signal to provide input to OPAMP circuit


Set the AFG/Signal Generator to output a Square Wave of
amplitude 2V peak-to-peak and frequency of 1kHz

Step 2
EXPERIMENT SETUP
Power ON the oscilloscope
Connect the Channel 1 probe of the oscilloscope to Vin
Connect the Channel 2 probe to Vout
Acquire the signal(s) from circuit on oscilloscope

Step 3
Autoset the scope to efficiently capture and view the signal
If AUTOSET feature is not enabled, then manually set the
horizontal and vertical scale, and trigger condition to view 3-4
cycles of waveform without any clipping.

Step 4
ADDING MEASUREMENTS
Go to measurement menu by pressing MEASURE button on the
scope front panel
Press CH1 and select MAXIMUM and MINIMUM measurement
using Multi-Purpose Knob (MPK) button
Add similar measurements for CH2
You can navigate through the measurement list by rotating the
MPK knob and select a measurement by pressing it

Step 5
Page 10

Record the measurement values and waveform / screenshot


Verify the measurement parameters against designed
(calculated based on circuit components)

Step 6
CAN YOU ANSWER THIS?
What will be the output of the integrator circuit if the input is a
sine wave?

Page 11

ArduinoFFTSpectrum -- Overview
FFT Spectrum Analysis

OBJECTIVES
After performing this lab exercise, learner will be able to:
Program Arduino board to generate signals (like Sine, Square
wave & PWM) and use it as a DUT for your experiment
Capture and display the signal from given Device Under Test
(DUT)
Evaluate the FFT of a given signal
Analyze the effect of different windowing method on spectrum
Analyzer the details of the spectrum using frequency zoom

EQUIPMENT
To carry out this experiment, you will need:
TBS1000B-EDU - Digital Oscilloscope from Tektronix
Arduino Duemilanve or Uno board
2 voltage probes (provided with oscilloscope)
Breadboard and connecting wires
Simple circuit components
Resistor 10K Ohms
Capacitor 10nF (2 numbers)

THEORY

Page 12

Fast Fourier Transform or FFT in short, is an algorithm to


compute the discrete Fourier Transform of a time series / signal
in a faster way.
FFT is used to represent a time-varying signal in frequency
domain. Any time domain signal can be represented by
combination of fundamental frequency and its harmonics in
frequency domain. FFT helps us resolve and visualize a time
domain signal in its frequency components.
N-point FFT of a signal, sampled at the rate of fS samples per
second, will yield frequency components from 0Hz to fS/2 Hz
with a frequency resolution of fS/N Hz.

A pure sine wave will have single frequency component in FFT


spectrum.

Any complex wave, for example a square wave will have multiple
frequency (called harmonics) components other than
fundamental frequency.

ArduinoFFTSpectrum -- Procedures
Step 1
DUT / SOURCE SETUP
Ensure you have Arduino IDE (software to program the Arduino
boards) installed on your computer.
Connect the Arduino board to PC using USB cable
Page 13

Program it with relevant code

Take the output from mentioned probing point(s)

Step 2
EXPERIMENT SETUP
Power ON the oscilloscope
Connect the Channel 1 probe of the oscilloscope to Vout-1
Connect the Channel 2 probe to Vout-2
Acquire the signal(s) from circuit on oscilloscope

Step 3
Page 14

Autoset the scope to efficiently capture and view the signal


If AUTOSET feature is not enabled, then manually set the

horizontal and vertical scale, and trigger condition to view 3-4


cycles of waveform without any clipping.

Step 4
Press the FFT button from the front panel to see the spectrum
of the signal
Turn the "Source WFM" ON to see the time domain signal along
with its FFT

Step 5
Ensure the FFT source is CH2 - Square wave
You will see the fundamental frequency and odd harmonics

Step 6
Change the FFT source to CH1 - Sine wave
You will see the single spike at fundamental frequency

Step 7
Modify the window to see the effect on the spectrum
You can use FFT zoom to have a closer look at frequencies
You can pan the FFT spectrum using 'horizontal position' knob

Page 15

CursorRiseFallTime -- Overview
Rise and Fall Time Measurement Using Cursors

OBJECTIVES
After performing this lab exercise, learner will be able to:
Understand the need for cursors
Use vertical cursors to measure Rise and Fall time of the signal

EQUIPMENT
DUT as source of the signal-Tektronix Arbitrary Function
Generator (AFG3000 series) or equivalent signal generator
TBS1000B-EDU - Digital Oscilloscope from Tektronix
10X Passive Voltage probe & BNC cables

THEORY
Cursors are the on-screen markers associated with channels on
an oscilloscope for making measurements. Use of markers
enables better accuracy than a simple grid based measurement
of signal parameters.
There are 2 cursors that can be moved by the Multi-Purpose
Knob (MPK) on the oscilloscope, very often, one by one.
Cursors are of two types Horizontal and Vertical cursors.
Vertical cursors are used for measurement of timing information.
The time position of the two cursors, with respect to horizontal
position, is displayed based on the horizontal scale.
In addition to the time of each individual cursor, the difference
between them (delta t) and its inverse (1/delta t) is also shown.
This helps with quick measurements of period and frequency
when cursors are placed containing one cycle of the waveform.
For Rise Time measurements, one can place two vertical cursors
in such a way that it touches the 10% and 90% level of a rising
transition. The delta t between the cursors will be the Rise Time.
For Fall Time measurements, one can place two vertical cursors
in such a way that it touches the 10% and 90% level of a falling
transition. The delta t between the cursors will be the Fall Time.
Page 16

CursorRiseFallTime -- Procedures
Step 1
DUT / SOURCE SETUP
Connect the AFG/Signal Generator to AC power.
Turn ON the AFG.
Set the signal type, frequency and amplitude on AFG as per
experiment requirements

Enable the signal generator output

Step 2
EXPERIMENT SETUP
Power ON the oscilloscope.
Make the connection between Signal Generator/AFG and
oscilloscope using BNC cable or probe
Acquire the signal(s) from signal generator on oscilloscope

Page 17

Step 3
Autoset the scope to efficiently capture and view the signal
Once the autoset is done, select the RISE EDGE icon (autoset to
see the rising edge)
If AUTOSET feature is not enabled, then manually set the
horizontal and vertical scale, and trigger condition to view rising
edge of waveform without any clipping.

Step 4
ADDING MEASUREMENTS
Go to measurement menu by pressing MEASURE button on the
scope front panel
Press CH1 (channel to be measured) and select MIN, MAX and
PEAK-PEAK measurement using Multi-Purpose Knob (MPK) button
You can navigate through the measurement list by rotating the
MPK knob and select a measurement by pressing it

Step 5
Go to cursor menu by pressing CURSOR button on the scope
front panel
TYPE = TIME (Vertical cursors)
SOURCE = CH1

Step 6
Select CURSOR1 and position it using MPK knob in such a way
that it is at 10% of the transition i.e. = Cursor1 voltage reads MIN
value + 10% of PEAK-to-PEAK value
Select CURSOR2 and position it using MPK knob in such a way
Page 18

that it is at 90% of the transition i.e. = Cursor2 voltage reads MIN


value + 90% of PEAK-to-PEAK value
Read the Delta T value - This is the Rise Time

Step 7
Similarly, measure the Fall Time on the falling edge

Page 19

MSP430BurstWidth -- Overview
Burst Width Measurement

OBJECTIVES
After performing this lab exercise, learner will be able to:
Program MSP430 Launchpad board to generate signals (like
Sine, Square wave or PWM) and use it as a DUT for your
experiment
Capture and display the signal from given Device Under Test
(DUT)
Measure width of the burst signal (series of transient events) in
capture signal using inbuilt functions of the scope

EQUIPMENT
To carry out this experiment, you will need:
TBS1000B-EDU - Digital Oscilloscope from Tektronix
MSP430 Launchpad board (Texas Instruments board)
Voltage probe (provided with oscilloscope)

THEORY
Burst Width = Duration of a burst (a series of transient events)
and is measured over the entire waveform or gated region.

Page 20

MSP430BurstWidth -- Procedures
Step 1
DUT / SOURCE SETUP
Ensure you have Energia IDE (software to program the MSP430
Launchpad boards) installed on your computer.
Connect the MSP430 Launchpad board to PC using USB cable

Program it with relevant code

Take the output from mentioned probing point(s)

Step 2
EXPERIMENT SETUP
Power ON the oscilloscope
Connect the Channel 1 probe of the oscilloscope to Vout-1
Page 21

Acquire the signal(s) from circuit on oscilloscope

Step 3
Autoset the scope to efficiently capture and view the signal
If AUTOSET feature is not enabled, then manually set the
horizontal and vertical scale, and trigger condition to view 3-4
cycles of waveform without any clipping.

Step 4
ADDING MEASUREMENTS
Go to measurement menu by pressing MEASURE button on the
scope front panel
Press CH1 (channel to be measured) and select Burst Width
measurement using Multi-Purpose Knob (MPK)
You can navigate through the measurement list by rotating the
MPK knob and select a measurement by pressing it

Step 5
Read the measured value and verify against the expected value

Page 22

raspPiCursorPk2Pk -- Overview
Peak-to-Peak Measurement Using Cursors

OBJECTIVES
After performing this lab exercise, learner will be able to:
Program Raspberry Pi (single board computer) to generate
signals (like sine, square wave or PWM) and use it as a DUT for
your experiment
Capture and display the signal from given Device Under Test
(DUT)
Understand the need for cursors
Use horizontal cursors to measure amplitude of the signal Peak to Peak measurement using cursors

EQUIPMENT
To carry out this experiment, you will need:
TBS1000B-EDU - Digital Oscilloscope from Tektronix
Voltage probe (provided with oscilloscope)
Raspberry Pi, video/HDMI cable, Monitor and USB keyboard,
mouse
Breadboard and connecting wires
3.5mm audio plug (male) with extended /open wires
Simple circuit components
Resistor - 10K Ohms
Capacitors - 100nF, 10uF

THEORY

Page 23

Cursors are the on-screen markers associated with channels on


an oscilloscope for making measurements. Use of markers
enables better accuracy than a simple grid-based measurement
of signal parameters.
There are 2 cursors that can be moved by the Multi-Purpose
Knob (MPK) on the oscilloscope, very often, one by one.

Cursors are of two types Horizontal and Vertical cursors.


Horizontal cursors are used for measurement of amplitude. The
amplitude value is displayed for each of the cursors based on
the vertical scale of the waveform with which the cursors are
associated.

raspPiCursorPk2Pk -- Procedures
Step 1
DUT / SOURCE SETUP
Ensure you have Raspbian image installed on SD card and
Raspberry Pi setup is done as per Readme_RaspPi_Lab_Design
document.
Start the Raspberry Pi. Your setup would look like this:

Boot up Raspberry Pi and Login. Login= pi and Password=


raspberry. Ensure that you have required .wav / python files
copied.
At the command prompt, type in: ./aplayloop.sh
sine1k60deg.wav to play the audio file.

Step 2
EXPERIMENT SETUP
Page 24

Power ON the oscilloscope


Connect the audio plug and RC Filter circuit to Audio port of
Raspberry Pi board as shown below.

Connect the Channel 1 probe to output 1


Acquire the signal(s) from circuit on oscilloscope

Step 3
Autoset the scope to efficiently capture and view the signal
If AUTOSET feature is not enabled, then manually set the
horizontal and vertical scale, and trigger condition to view 3-4
cycles of waveform without any clipping.

Step 4
Go to cursor menu by pressing CURSOR button on the scope
front panel
TYPE = AMPLITUDE (horizontal cursors)
SOURCE = CH1

Step 5
Select CURSOR1 and position it using MPK knob to touch the
positive peak of the sine wave
Select CURSOR2 and position it using MPK knob to touch the
negative peak of the sine wave
Read the DeltaV value

Step 6
ADDING MEASUREMENTS
Go to measurement menu by pressing MEASURE button on the
scope front panel
Press CH1 (channel to be measured) and select PEAK-PEAK
measurement using Multi-Purpose Knob (MPK) button
You can navigate through the measurement list by rotating the
MPK knob and select a measurement by pressing it
Page 25

Step 7
Compare the Peak to Peak value of the signal measuring using
cursors against built in measurement

Page 26

LDR_Light_Switch1 -- Overview
Measuring Light Intensity Variation Using LDR

OBJECTIVES
After performing this lab exercise, learner will be able to:
Understand the functionality of Light Dependent Resistor (LDR)
Use LDR (Light Dependent Resistor) to measure the light
intensity variation in terms of voltage at the LDR output
Program Arduino board to digitize and capture voltage across
LDR
Relate the digitized value of voltage across LDR with value
measured on oscilloscope
Use digital oscilloscope to:
Measure the signal amplitude
Trigger on input channel

EQUIPMENT
To carry out this experiment, you will need:
TBS1000B-EDU Digital Oscilloscope from Tektronix
Arduino Duemilanove or Uno board
Voltage probe (provided with oscilloscope)
Breadboard and connecting wires
Simple circuit components LDR, Resistor 10k Ohms

THEORY
Key points:

Page 27

A photoresistor can be applied in light-sensitive detector circuits,


and light- and dark-activated switching circuits.
A photoresistor or light-dependent resistor (LDR) is a lightcontrolled variable resistor - i.e., the LDR resistance varies with

respect to light intensity falling on it.


An LDR is made of a high resistance semiconductor. In the dark,
a photoresistor offers very high resistance (of the order of few
megaohms). When it is exposed to light, an LDR can have a
resistance as low as a few hundred ohms.

When an LDR is exposed to light, the semiconductor material


absorbs photons pushes the bound electrons to conduction
band. Resistance of LDR is reduced due to the resulting free
electrons (and their hole partners) that conduct electricity.

Change in resistance can be converted in to voltage variation by


voltage divider implemented using LDR and a fixed resistor.

The voltage across LDR can be measured using oscilloscope or


digitized/recorded using Arduino - The voltage is proportional to
darkness (%) ~5V = 100% darkness
~0V = 0% darkness

LDR_Light_Switch1 -- Procedures
Step 1
Page 28

DUT Setup: Arduino-LDR Circuit

Prepare the circuit (using LDR, Resistor and Arduino) as shown


below:

Step 2
DUT Setup: Connecting Arduino with Computer
Connect the Arduino to computer using USB cable.

Launch Arduino IDE and ensure correct USB port number and
Board name for establishing the connection.

Step 3
DUT Setup: Programming Arduino
Program the Arduino board with code "Light_Switch_1_Measure_Variation.ino"
Once the program is uploaded and running on Arduino, open
serial monitor

Page 29

Step 4
Scope and DUT Connection:
Connect channel 1 of the oscillosocope to LDR output. Probe at A3
pin of Arduino.

Step 5
Scope Settings: Horizontal / Vertical Scale & Trigger
Do autoset (or manually set) and ensure following settings:
Horizontal scale 1ms/div
Vertical scale 1V/div
Vertical position at -3V (-3 divisions)

Step 6
Scope Settings: Measurements
Using 'measure' menu, add following measurements to CH1:
RMS
Mean
Maximum

Step 7
Check the measurement value on the oscilloscope and compare it
with "Volts" value on the serial monitor. The value in "Volts" should
match the "Mean" value reported by oscilloscope.

Step 8
Change the light intensity around LDR - Cover the LDR to increase
darkness. Again check the measurement value on the oscilloscope
and compare it with "Volts" value on the serial monitor. The value in
"Volts" should match the "Mean" value reported by oscilloscope.

Step 9
Page 30

You can verify the output of LDR (readings on scope and Serial
Monitor) matches for different light conditions around LDR.

LDR_Light_Switch2 -- Overview
Switching LED Based on Light Threshold

OBJECTIVES
After performing this lab exercise, learner will be able to:
Use LDR (Light Dependent Resistor) to measure the light
intensity variation in terms of voltage at the LDR output
Program Arduino board to:
Digitize and capture voltage across LDR
Compare it against a fixed threshold and
Switch a relay / LED connected to a digital output pin
Use digital oscilloscope to:
Trigger on input channel
Measure the signal amplitude
Measure delay using cursors

EQUIPMENT
To carry out this experiment, you will need:
TBS1000B-EDU Digital Oscilloscope from Tektronix
Arduino Duemilanove or Uno board
2 Voltage probes (provided with oscilloscope)
Breadboard and connecting wires
Simple circuit components
LDR,
Resistors 10k/470 Ohms,
LEDs

THEORY
Key points:
Page 31

LDR changes its resistance based on the light intensity incident


on it. The higher the light, the lower will be resistance and vice
versa.
Change in resistance can be converted into voltage variation by
voltage divider implemented using LDR and a fixed resistor.

The voltage across LDR can be measured using oscilloscope or


digitized/recorded using Arduino - The voltage is proportional to
darkness (%) ~5V = 100% darkness
~0V = 0% darkness
We can define a fixed 'darkness' threshold (in volts or ADC
levels) for switching. If the LDR output crosses this level,
Arduino should turn one of its digital pin ON (High).
An LED or relay can be used at the digial output pins for
indicating switching action.

LDR_Light_Switch2 -- Procedures
Step 1
DUT Setup: Arduino-LDR Circuit
Prepare the circuit (using LDR, Resistors and Arduino) as shown
below:

Page 32

Step 2
DUT Setup: Connecting Arduino with Computer
Connect the Arduino to computer using USB cable.

Launch Arduino IDE and ensure correct USB port number and
Board name for establishing the connection.

Step 3
DUT Setup: Programming Arduino
Program the Arduino board with code "Light_Switch_2_Switch_on_Threshold.ino"
Once the program is uploaded and running on Arduino, open
serial monitor

Read the Threshold level for LEDs connected at Pin 12 and Pin
13 of Arduino.

Step 4
Scope and DUT Connection:
Connect channel 1 probe to LDR output - at A3 pin of Arduino.
Connect channel 2 probe to pin 13 (digital output) of Arduino

Step 5
Page 33

Scope Settings: Horizontal / Vertical Scale & Trigger

Perform an autoset (or manually set) and ensure the following


settings:
Horizontal scale = 50 ms/div
Channel 1:
Vertical scale = 1V/div
Vertical position = -2V (-2 divisions)
Channel 2:
Vertical Scale = 1V/div
Vertical Position = -3 div
Edge Trigger on CH2, Trigger level = 2.5V
Single Trigger

Step 6
Scope Settings: Measurements
Using 'measure' menu, add the following measurements to CH1:
RMS
Mean
Maximum

Step 7
Press SINGLE onfrom front panel of the scope
Vary the light condition around LDR until the LED on pin 13
glows -- start with higher light and then reduce it to create
darkness.

Step 8
Verify that when CH1 (LDR output) crosses the threhsold of
2.81V (same as trigger level), the LED on Pin 13 glows and
voltage goes to 5V (low to high transition)

Step 9
Do you see a delay between CH1 (LDR output) crossing the
threshold of 2.81V and CH2 (LED on Pin 13) making the Low to
High transition?
Using vertical (time) cursors, measure this delay.
Can you explain why there is a delay?
Page 34

Step 10
The delay is caused due to 'Serial.Print' code in the program Serial writing takes sometime and hence causes the delay.
Next, comment all the serial printing code and re-run the
program on Arduino.
Repeat the steps 7-9.
Does the delay vanish now?

Step 11
Scope and DUT Connection:
Modify the probing point:
Connect channel 1 probe to LDR output - at A3 pin of Arduino.
Connect channel 2 probe to pin 12 (digital output) of Arduino

Step 12
Verify the switching for another LED connected to Pin12, having
a different threshold (2V).
Again aquire signal (SINGLE acquisition) while you vary the light
conditions around LDR until LED on pin 12 glows -- start with
higher light and then reduce it to create darkness.

Step 13
You can play around with changing the light intensity around
the LDR and you should see the LED flashing the moment LDR
output crosses the threshold. Take a oscilloscope screenshot of
it.
Verify the switching against the threshold crossing.

Page 35

LDR_Light_Switch3 -- Overview
Switching LED on Dynamically Assigned Threshold

OBJECTIVES
After performing this lab exercise, learner will be able to:
Use LDR (Light Dependent Resistor) to detect light intensity
variation and detect threshold crossing
Define threshold dynamically using a potentiometer
Program Arduino board to:
Digitize and capture voltage across LDR
Read another analog input to comparision with LDR output
Switch a relay / LED connected to a digital output pin
Use digital oscilloscope to:
Trigger on input channel
Measure the signal amplitude
Work with reference waveforms

EQUIPMENT
To carry out this experiment, you will need:
TBS1000B-EDU Digital Oscilloscope from Tektronix
Arduino Duemilanove or Uno board
2 Voltage probes (provided with oscilloscope)
Breadboard and connecting wires
Simple circuit components LDR, Resistors 10k & 470 Ohms,
LEDs and Potentiometer 100K ohms

THEORY
Key points:
LDR changes its resistance based on the light intensity incident
on it. Higher the light, lower will be resistance and vice versa.
Page 36

Change in resistance can be converted in to voltage variation by


voltage divider implemented using LDR and a fixed resistor.

The voltage across LDR can be measured using oscilloscope or


digitized/recorded using Arduino - The voltage is proportional to
darkness (%).
We can dynamically provide 'darkness' threshold (in volts or
ADC levels) using another potentiometer for switching. If the
LDR output crosses this level, Arduino should turn one of its
digital pins ON (High).
An LED or relay can be used at the digial output pin for
indicating switching action.

LDR_Light_Switch3 -- Procedures
Step 1
DUT Setup: Arduino-LDR Circuit
Prepare the circuit (using LDR, Resistors, Potentiometer, LEDs and
Arduino) as shown below:

Step 2
DUT Setup: Connecting Arduino with Computer
Page 37

Connect the Arduino to computer using USB cable.

Launch Arduino IDE and ensure correct USB port number and
Board name for establishing the connection

Step 3
DUT Setup: Programming Arduino
Open the code - "Light_Switch_3_Threshold_from_Pot.ino" - in
Arduino IDE.
Compile and upload the program on Arduino board for execution

Step 4
Scope and DUT connection:
Channel 1 probing at LDR output (pin A3 of Arduino)
Channel 2 probing at Potentiometer output (pin A1 of Arduino)

Step 5
Scope Settings: Horizontal / Vertical Scale
Do autoset (or manually set) and ensure the following settings:
Horizontal scale = 50 ms/div
Channel 1 & 2:
Vertical scale = 1V/div
Vertical position = -3V (-3 divisions)

Step 6
Scope Settings: Measurements
Using 'measure' menu, add the following measurements to CH1 and
CH2:
RMS
Mean
Page 38

Step 7
Looking at the Mean/RMS value of CH2, vary the potentiometer till it
reaches the mean value of 3.5V.

Step 8
Once CH2 reaches 3.5V, save CH2 as Reference Waveform Ref A.
Press Save/Recall button on the front panel and do following
settings:
Save/Recall > Action setting = Save Waveform
Save To = Ref
Source = Ch2
To = Ref A
Press Save

Step 9
Turn on Ref A: You would see white trace (horizontal line @ 3.5V,
where CH2 was)
Press Ref (R) button on front panel
Ref A = On

Step 10
Now change the probing for CH2 connect CH2 to Pin D13 (LED
output)

Step 11
Scope Settings: Trigger
Trigger source = CH2,
Edge = Rising
Trigger Level = 2.5V

Step 12
Vary the light incident on LDR (you can use mobile flash light or
torch) and acquire signal using Single Acquisition.
Verify that your LED glows (CH2 goes to 5V) only when CH1
(LDR output) crosses the threshold (Ref A)
Page 39

Step 13

Now your light controlled switch is ready for use. You can set your
light controlled switch
Create the darkness level you want to have your LED on for
Now adjust the potentiometer that it turns the LED off
Now rotate the pot in other direction slowly till it just switches on
the LED
Youve just defined / set the darkness threshold for switching on
the LED. If there is more light than this, LED will turn off and
vice versa.

Page 40

LDR_Light_Switch4 -- Overview
Switch Press Duration Measurement

OBJECTIVES
After performing this lab exercise, learner will be able to:
Interface a pushbutton with Arduino
Program Arduino board to:
Detect switch (push button) press
Count the seconds elapsed while switch is pressed
Use digital oscilloscope to measure the pulse width (duration)

EQUIPMENT
To carry out this experiment, you will need:
TBS1000B-EDU Digital Oscilloscope from Tektronix
Arduino Duemilanove or Uno board
Voltage probe (provided with oscilloscope)
Breadboard and connecting wires
Simple circuit components Resistor 10k & 470 Ohms, LEDs
and Push button (switch)

THEORY
Key points:
A push button is a switch that changes state (Normally open to
close or vice versa) with the button press. The state change is
retained till switch is kept pressed. Upon release of the switch, it
comes back to its normal switching position.
A switch can be interfaced with Arduino by making use of
Page 41

'internal pull-up resistor' of a digital IO pin. Without pressing the


switch, the value at digital input pin remains HIGH (5V) due to
pull-up resistor. When switch is pressed, the input is connected
to ground and voltage becomes 0V.

Arduino can read the input pin level (HIGH or LOW) and detect
the switch press.

LDR_Light_Switch4 -- Procedures
Step 1
DUT Setup: Arduino - Push Button Circuit
Prepare the circuit (using push button, LEDs, Resistor and Arduino)
as shown below:

Step 2
DUT Setup: Connecting Arduino with Computer
Connect the Arduino to computer using USB cable.

Page 42

Launch Arduino IDE and ensure correct USB port number and
Board name for establishing the connection.

Step 3
DUT Setup: Programming Arduino
Open the code - "Light_Switch_4_Switch_Press_Timing.ino" - in
Arduino IDE
Compile and upload the program on Arduino board for execution
Once the program is uploaded and running on Arduino, open
serial monitor

Step 4
Scope and DUT Connection:
Channel 1 probing at Push Button (pin D7 of Arduino)
Channel 2 probing at LED output (pin D13 of Arduino)

Step 5
Scope Settings: Horizontal / Vertical Scale & Trigger
Horizontal scale = 500 ms/div
Channel 1 & 2:
Vertical scale = 1V/div
Page 43

Vertical position = -3V (-3 divisions)


Trigger on CH1, Falling Edge
Horizontal Position (Pre-trigger) = 10% (1st div from left side)
Take Single Acquisition (no free run)

Step 6
Scope Settings: Measurements
Using 'measure' menu, add following measurements to CH2:
Positive Width

Step 7
Ensure that Serial Monitor is turned on, press SINGLE (on the
scope front panel)
Press the 'push button' - keep it pressed for 2-3 seconds
(approximately) and then release it. the LED at pin 13 would
glow while push button is pressed.

Step 8
When the push button is released, Serial Monitor will print the time
for which the push button was pressed. Verify this value (from Serial
Monitor) against the Positive Width measurement on CH2 (= LED on
period).

Step 9
You can try pressing the button for different interval of time and
verify the value indicated by Arduino Serial monitor against scope's
Positive Width measurement.

Page 44

LDR_Light_Switch5 -- Overview
Threshold Calibration through LDR Using Switch

OBJECTIVES
After performing this lab exercise, learner will be able to:
Interface LDR and pushbutton with Arduino to make light
controlled switch
Program Arduino board to:
Measure LDR output as light intensity variation
Detect switch (push button) press and measure duration
Calibrate switching threshold with current LDR output using
button press
Use digital oscilloscope to measure the pulse width (duration)
and burst width

EQUIPMENT
To carry out this experiment, you will need:
TBS1000B-EDU Digital Oscilloscope from Tektronix
Arduino Duemilanove or Uno board
Voltage probe (provided with oscilloscope) / BNC cables
Breadboard and connecting wires
Simple circuit components LDR, Resistor 10k & 470 Ohms,
LEDs and Push button (switch)

THEORY
Key points:
LDR (photo-resistor) changes its resistance with intensity of light
falling on it. More the light, lesser is the resistance.
Page 45

The light variation can be 'measured' by using LDR with another


resistor as voltage divider circuit. ADC of Arduino can be used to
measure the voltage change (due to variation in intensity of light
on LDR).

A push button can be interfaced with Arduino's digital input pin


using a pull-up resitor. Arduino can programmed to detect the
switch press which will be used for calibration of threshold.

When "calibrate" switch is pressed for over 2 seconds, the


current value of LDR output can be assigned as Threshold.
When switch is released, instantaneous LDR output is compared
against the Threshold and switching is performed.

LDR_Light_Switch5 -- Procedures
Step 1
Page 46

DUT Setup: Arduino-LDR Circuit


Prepare the circuit (using LDR, Resistor and Arduino) as shown
below:

Step 2
DUT Setup: Connecting Arduino with Computer
Connect the Arduino to computer using USB cable.

Launch Arduino IDE and ensure correct USB port number and
Board name for establishing the connection.

Step 3
DUT Setup: Programming Arduino
Open the code - in Arduino IDE:
"Light_Switch_5_Final_Light_Controlled_Switch.ino"
Compile and upload the program on Arduino board for execution

Step 4
Page 47

Scope and DUT Connection:


Channel 1 probing at Push Button (pin D7 of Arduino)
Channel 2 probing at 'calibrate' LED (pin D12 of Arduino)

Step 5
Scope Settings: Horizontal / Vertical Scale & Trigger
Do autoset (or manually set) and ensure following settings:
Horizontal scale = 250 ms/div
Channel 1 :
Vertical scale = 2V/div
Vertical position = +2V (+1 divisions)
Channel 2 :
Vertical scale = 2V/div
Vertical position = - 6V (-3 divisions)
Trigger on CH1, Falling Edge
Horizontal Position (Pre-trigger) = 10% (1st div from left side)
Take Single Acquisition (no free run)

Step 6
Scope Settings: Measurements
Using 'measure' menu, add POS WIDTH and BURST WIDTH
measurements to CH2

Step 7
Ensure that Serial Monitor is turned on, press SINGLE (on the
scope front panel)

Step 8
Create darkness that you want to have switching at (threshold
definition).
Press the 'push button' - Calibrate LED will glow.
Keep the button pressed till LED is on. Release it once the LED
turns off.

Step 9

Page 48

You can verify the burst width measurement to be close to 2s.


How's the CH2 (Calibrate LED output) - Smooth pulse of 2s or
burst of square wave / pulses with burst width of 2s?
We expected a smooth pulse of 2s as LED output. Without
scope we could not figure it out that we have so many
switchings till push button is pressed (2s).
Can you debug the code and correct it?

Step 10
The corrected code is "Light_Switch_5a.ino". Upload this code
and run Arduino.
Repeate step 8 & 9 to verify you get a smooth 2s pulse now.

Step 11
Now your Light switch is ready You can define light intensity for switching by creating that exact
darkness and pressing the Calibrate switch for 2s (till calibrate
LED glows)
Once the threshold is defined through calibration, main output
LED (pin 13) will glow when the darkness is more than defined
threshold.

Page 49

Contact Tektronix:
ASEAN / Australia (65) 6356 3900
Austria* 00800 2255 4835
Balkans, Israel, South Africa and other ISE Countries +41 52 675 3777
Belgium* 00800 2255 4835
Brazil +55 (11) 3759 7627
Canada 1 (800) 833-9200
Central East Europe and the Baltics +41 52 675 3777
Central Europe & Greece +41 52 675 3777
Denmark +45 80 88 1401
Finland +41 52 675 3777
France* 00800 2255 4835
Germany* 00800 2255 4835
Hong Kong 400-820-5835
Ireland* 00800 2255 4835
India +91-80-30792600
Italy* 00800 2255 4835
Japan 0120-441-046
Luxembourg +41 52 675 3777
Macau 400-820-5835
Mongolia 400-820-5835
Mexico, Central/South America & Caribbean 52 (55) 56 04 50 90
Middle East, Asia and North Africa +41 52 675 3777
The Netherlands* 00800 2255 4835
Norway 800 16098
Peoples Republic of China 400-820-5835
Poland +41 52 675 3777
Portugal 80 08 12370
Puerto Rico 1 (800) 833-9200
Republic of Korea +822-6917-5000
Russia +7 495 664 75 64
Singapore +65 6356-3900
South Africa +27 11 206 8360
Spain* 00800 2255 4835
Sweden* 00800 2255 4835
Switzerland* 00800 2255 4835
Taiwan 886-2-2656-6688
United Kingdom* 00800 2255 4835
USA 1 (800) 833-9200
* If the European phone number above is not accessible,
please call +41 52 675 3777
Contact List Updated June 2013
For Further Information
Tektronix maintains a comprehensive, constantly expanding collection of
application notes, technical briefs and other resources to help engineers
working on the cutting edge of technology. Please visit www.tektronix.com

Copyright 2014, Tektronix. All rights reserved. Tektronix products are


covered by U.S. and foreign patents, issued and pending. Information in this
publication supersedes that in all previously published material. Specification
and price change privileges reserved. TEKTRONIX and TEK are registered
trademarks of Tektronix, Inc. All other trade names referenced are the service
marks, trademarks or registered trademarks of their respective companies.
10/2014

Page 50

JS/WWW

3GW-30918-0