21
Lab 5 Introduction

What have we learned so far? When we apply a voltage, the capacitor will charge up to the applied voltage. The capacitor charges up exponentially

Embed Size (px)

Citation preview

Page 1: What have we learned so far?  When we apply a voltage, the capacitor will charge up to the applied voltage.  The capacitor charges up exponentially

Lab 5Introduction

Page 2: What have we learned so far?  When we apply a voltage, the capacitor will charge up to the applied voltage.  The capacitor charges up exponentially

What have we learned so far?

When we apply a voltage, the capacitor will charge up to the applied voltage.

The capacitor charges up exponentially. The capacitor takes about 5 time constants (5τ = 5RC)

to fully charge. The capacitor takes one time constant to charge 63.2%

of the way up. The same things hold true when a capacitor discharges

in an RC circuit.

RC Circuits

Page 3: What have we learned so far?  When we apply a voltage, the capacitor will charge up to the applied voltage.  The capacitor charges up exponentially

RC Circuits

0 0.05 0.1 0.15 0.2 0.250

0.5

1

1.5

2

2.5

3

3.5

4

4.5

5

time (s)

Capacitor

Voltage (

V)

Capacitor Charging in RC Circuit

1 kOhm

2 kOhm10 kOhm

Page 4: What have we learned so far?  When we apply a voltage, the capacitor will charge up to the applied voltage.  The capacitor charges up exponentially

RC CircuitsIn Engineering Foundations, you wired up a series RC circuit to a 1.5V battery and measured the voltage across the capacitor as it charged using a multi-meter and a stop watch. It worked OK because the cap charged pretty slowly.

Page 5: What have we learned so far?  When we apply a voltage, the capacitor will charge up to the applied voltage.  The capacitor charges up exponentially

RC Circuits

What happens if we have a voltage signal that changes over time (ac signal) instead of a constant voltage (dc signal) like we get from a battery?

Page 6: What have we learned so far?  When we apply a voltage, the capacitor will charge up to the applied voltage.  The capacitor charges up exponentially

RC CircuitsThe capacitor will try to follow the signal by charging and discharging. For example, if we apply a square wave and allow enough time for the capacitor to charge and discharge, will we see something like this:

0 0.5 1 1.5 2 2.5-1.5

-1

-0.5

0

0.5

1

1.5

time (sec)

volts

Series RC Circuit

Capacitor Voltage

Applied Voltage

Page 7: What have we learned so far?  When we apply a voltage, the capacitor will charge up to the applied voltage.  The capacitor charges up exponentially

Lab TodayWe are going to apply square waves and sine waves to a series RC circuit and measure the capacitor voltage as it charges and discharges.

Page 8: What have we learned so far?  When we apply a voltage, the capacitor will charge up to the applied voltage.  The capacitor charges up exponentially

Data Acquisition Device (DAQ)A DAQ is a cool little device that allows you to interface software and hardware. Here is what we will do:

Create a square wave or a sine wave in MATLAB Send the signal out through the DAQ as a voltage signal

applied across the RC circuit We will also use the DAQ as a voltmeter to measure the

voltage across the capacitor The DAQ will send these measurements back into MATLAB

so we can easily plot the voltage vs. time

Page 9: What have we learned so far?  When we apply a voltage, the capacitor will charge up to the applied voltage.  The capacitor charges up exponentially

Analog Discovery DAQAnalog IN Channels:

The two orange wires labeled 1+ and 1- form an Analog IN channel. IN means into the DAQ from hardware.

This input channel is our replacement for the multi meter. The orange wires will be placed across the capacitor to measure the voltage.

The DAQ will take 10,000 measurements every second !!

The blue wires (2+ and 2-) are another IN channel which we won’t use today.

Page 10: What have we learned so far?  When we apply a voltage, the capacitor will charge up to the applied voltage.  The capacitor charges up exponentially

Analog Discovery DAQAnalog OUT Channels:

The yellow wire labeled W1 and black ground wire labeled form an Analog OUT channel. OUT means out of the DAQ and applied to the circuit.

This output channel is our replacement for the battery. These wires will be placed across the RC circuit to apply a voltage signal.

W2 allows for a 2nd Analog Out signal but we won’t use that today.

Page 11: What have we learned so far?  When we apply a voltage, the capacitor will charge up to the applied voltage.  The capacitor charges up exponentially

MATLAB Code

On the metasite for Blackboard, there is an m-file called RC.m

This file has almost all of the code that you need for today. there are a few lines you will need to fill in.

Page 12: What have we learned so far?  When we apply a voltage, the capacitor will charge up to the applied voltage.  The capacitor charges up exponentially

MATLAB CodeThis section of code first clears all variables then checks to make sure the DAQ is connected and is recognized by MATLAB. If MATLAB can’t see the DAQ, it will print out the statement in line 13 and

terminate the program

Page 13: What have we learned so far?  When we apply a voltage, the capacitor will charge up to the applied voltage.  The capacitor charges up exponentially

MATLAB Code

This section of code gets things started by setting up a session allowing MATLAB to communicate

with the DAQ. We used a variable name, DAQ,, to name our session.

Page 14: What have we learned so far?  When we apply a voltage, the capacitor will charge up to the applied voltage.  The capacitor charges up exponentially

MATLAB Code

This section of code turns on the Analog Input Channel (1+ and 1-) to measure Voltage. We set the range on the voltmeter to read voltages between -2.5 and 2.5

volts.

Page 15: What have we learned so far?  When we apply a voltage, the capacitor will charge up to the applied voltage.  The capacitor charges up exponentially

MATLAB Code

This section of code sets the sample rate to 10,000 samples per second. So, we will get

10,000 voltage readings every second. Try doing that with a stop watch!

Page 16: What have we learned so far?  When we apply a voltage, the capacitor will charge up to the applied voltage.  The capacitor charges up exponentially

MATLAB Code

This section of code turns on the Analog Output Channel (W1) which will allow us to apply a

square wave or sine wave voltage signal across the RC circuit.

Page 17: What have we learned so far?  When we apply a voltage, the capacitor will charge up to the applied voltage.  The capacitor charges up exponentially

MATLAB Code

This section of code will ask the user to enter in the period, T, of the square wave using an input

statement.

Page 18: What have we learned so far?  When we apply a voltage, the capacitor will charge up to the applied voltage.  The capacitor charges up exponentially

MATLAB CodeThis section of code is where your team will

complete three lines of code to create a square wave called AppliedVoltage (a bit later on today)

Page 19: What have we learned so far?  When we apply a voltage, the capacitor will charge up to the applied voltage.  The capacitor charges up exponentially

MATLAB CodeThis section of code will queue up your AppliedVoltage square

wave and get it ready to send out. The startForeground command in line 61 is the start command and

collects the voltage measurements in a vector called CapVoltage and the corresponding times in a vector called timestamps.

Page 20: What have we learned so far?  When we apply a voltage, the capacitor will charge up to the applied voltage.  The capacitor charges up exponentially

MATLAB Code

These commands ought to look pretty familiar!

Page 21: What have we learned so far?  When we apply a voltage, the capacitor will charge up to the applied voltage.  The capacitor charges up exponentially

Circuit