WAM - PowerPoint PPT Presentation

1 / 42
About This Presentation
Title:

WAM

Description:

The capacitor is a device which can store an electron charge. ... Variable is the memory location to store the results. ... Store results in variable Time. ... – PowerPoint PPT presentation

Number of Views:51
Avg rating:3.0/5.0
Slides: 43
Provided by: robertj3
Category:
Tags: wam

less

Transcript and Presenter's Notes

Title: WAM


1
WAM
  • Chapter 5 Measuring Rotation

2
Adjusting Dials and Monitoring
  • Dials are ideal input devices for adjustments
    such as room lighting and volume levels.
  • They are also used inside devices for feedback,
    such as inside the servo to sense actual position.

3
Using a potentiometer as a variable resistor
  • The device inside the dial is called a variable
    resistor or potentiometer. They are used in
    dials, joysticks, and many other devices which
    need to produce an output in reference to a
    position.
  • Potentiometers can be packaged many different
    ways.

4
  • The potentiometer is a resistor with two
    terminals similar to a regular resistor, but also
    has a wiper terminal to adjust where contact is
    made.

5
  • The distance from the wiper to each terminal
    determines the resistance for that path. The
    minimum resistance will be 0 ohms, and the
    maximum will be the rating of the potentiometer,
    such as 10K?.

Low resistance
High resistance
High resistance
Low resistance
6
Activity 1 Building/Testing Potentiometer
Circuit
  • Construct the circuit and observe the LED's
    brightness at different settings of the
    potentiometer.

7
  • When the LED was brightest, was the potentiometer
    resistance highest or lowest in the path to the
    LED?
  • When the LED was brightest, was the potentiometer
    wiper closest or furthest from terminal connected
    to Vdd?(click for answers)

8
Activity 2 Measuring Using Time
  • In this activity an RC-network (Resistor-Capacitor
    ) is used to form a circuit. The capacitor is
    charged and discharged at different rates
    determined by the resistor and the capacitor
    sizes.

9
Introducing the Capacitor
  • The capacitor is a device which can store an
    electron charge. Its size is expressed typically
    in microfarads (?F) or millionths of Farads.
  • Certain types of capacitors are polarity
    sensitive, that is, they can only be connected in
    one direction.
  • Connecting a polarity sensitive capacitor
    backwards can cause the device to explode.
  • Wear safety glasses.
  • Ensure proper polarity when connecting.

10
Build this circuitbe sure the power is off and
the capacitor is connected correctly
11
Polling the RC-Time Circuit with the basic stamp
  • Enter,Save, and Run PolledRcTimer.bs2 on the next
    slide (page 146 of your text).

12
See data studio scope Voltage probe
13
Record the discharge time
  • Record your results next to 470 O in the chart on
    the next slide
  • Replace the 470O with the other resistors below,
    and record the resulting discharge times
  • Repeat this procedure using a similar chart for,
    but now using a 1000 uF capacitor in place of the
    3300 uF.

14
Fill in the charts with your data
What is your conclusion about the effects of R
C on discharge time?
15
Here is some data I collected
Notice how the values on the right are 1/3 of the
values on the leftthis is because RC or time on
the right is 1/3 of RC or time on the left
16
  • The time to discharge the capacitor is in
    proportion to the size of the resistor and
    capacitor network (RC).
  • The larger the capacitance (C), the greater the
    charge it can hold, increasing time.
  • The larger the resistance (R), the slower the
    capacitor will discharge, increasing time.

17
Activity 3 Reading with BASIC Stamp
  • The BASIC Stamp has an instruction to perform
    much of the timing operation automatically and
    with higher precision (milli or micro seconds) as
    opposed to (tenths of a second)
  • RCTIME Pin, State, Variable
  • Where
  • Pin is the pin the RC network is connected.
  • State is the initial state when timing begins.
  • Variable is the memory location to store the
    results. Just like PULSOUT the time is the
    number of 2uS increments.

18
Build the circuit below
The goal here will be to monitor the position of
the potentiometer dial with RCTime
19
Since we can now detect much smaller timeslets
make the value of RC really small
  • 10 x 104 pF
  • Or 100000 pF
  • Or 0.1 uF
  • 10 x 103 pF
  • Or 10000 pF
  • Or 0.01 uF

20
Enter, Save, and Run ReadPotWithRcTime.bs2 on the
next slide (page 151 of your text)
21
RCTIME Program Explanation
  • Declare variable time to hold results.
  • DO-LOOP code block
  • Set I/O P7 HIGH (5V).
  • Wait 100 mS to charge capacitor and stabilize
    DEBUG screen.
  • Execute RCTime instruction
  • Time until capacitor discharges and P7 leaves
    defined state (1).
  • Store results in variable Time.
  • Display Time results.this is the number of 2
    microseconds intervals

22
Try rotating the wheel of the potentiometer while
monitoring the debug screen..why are the results
logical?
As R goes up, the time to discharge goes up and
vice versa
23
  • Replace the 0.1 uF Capacitor with a 0.01 uF
    capacitor
  • The values you see now for RC-Time should now be
    1/10 of what they were before
  • Put the 0.1 uF capacitor back in the circuit
  • Make note of the highest RC-Time value

24
Activity 4 Servo Control with Potentiometer
  • Potentiometers are often used to control servos
  • Radio controlled airplanes
  • Consist of radio controlled
  • Servos which control
  • Flaps
  • Engine throttle settings
  • Rudder

25
Build two circuits
  • Potentiometer circuit from last activity
  • Servo Circuit from Ch4
  • REMEMBER THE SERVO POWER JUMPER SETTINGS!!

26
  • In this activity the value of RCtime is used to
    control a servo.
  • The RCtime reading is offset to be within the
    controllable range of the servo (500-1000).
  • You will need the largest RCtime Value recorded
    in the last activity

27
Here is some sample data
  • Potentiometer max counterclockwise 691
  • Potentiometer max clockwise 1
  • Servo max counterclockwise 1000
  • Servo max clockwise 500
  • WE WOULD LIKE THESE DIFFERENCE TO BE THE SAME FOR
    EASE OF CONTROL WITH THE POT

Difference of 690
Difference of 500
28
Create a scale
  • Make a ratio
  • Servo difference 500 0.72
  • Pot difference 691
  • Test
  • 0.72 x 691 498 (just about 500)
  • 0.72 x 1 0.72 (just about 1)
  • PROBLEM When full counterclockwise
    potentiometer is multiplied by the scale we get
    full clockwise servo????

29
Problem
  • Full Servo Counterclockwise should be 1000
  • Currently 500??
  • Full Clockwise should be 500
  • Currently 0.724???

The Fix
  • Full Servo Clockwise should be 1000
  • Currently 500??
  • Add 500 to 500 and get 1000 before PULSOUT
  • Full Servo Clockwise should be 500
  • Currently 0.724??
  • Add 500 to 0.724 and get 500.724 before PULSOUT

30
SCALE FACTOR
  • So if the you wanted to know where an RCtime
    value of 490 would put the servo?
  • (0.724) x 490 355
  • 355 (500) 855somewhere around 11 OClock

OFFSET
31
Another Problem
  • The bs2 cannot multiply or divided by decimals
    such as the 0.724 on the previous slide

32
Solutionthe /
  • This is a bs2 function that will divide whatever
    you are multiplying by with 256
  • Somultiply 0.724 by 256
  • Result 184.344
  • Round off to ones place
  • Result 184
  • Perform the / function

33
So, here is how we would get our servo position
from the potentiometer
34
Enter, run, and save the following code
So, here is how we would get our servo position
from the potentiometer
35
Now modify the program, so the scaling works with
your rctime circuitAdd this line between
PULSOUT and LOOPDEBUG HOME, DEC5 time Then
run the program
36
Many times the scale factor (ex 0.724), and
the offset (ex 500) are used many times in a
program.
  • The following makes this easier
  • Scalefactor con 184
  • Offset con 500
  • Now anywhere in your program you need to change
    one of these values, you will only need to change
    it once

37
Enter, Run, and Save the code belowNote that it
works the same as controlservowithpot
38
Using constant for calibration and easy updating
  • Save the program under a new name
  • Change the scalefactor and offset values to your
    unique rc circuit values and verify function
  • Change pin 7 to pin 8 on your circuit and in your
    code
  • Rcpin con 8
  • Add this comment before the doloop
  • Debug ? Rcpin
  • Run the program again, and note the change

39
Photo ResistorResistor whose resistance varies
with the intensity of light
  • Goal Control servo direction with light
    intensity

40
Wiring the Circuit
  • Replace the manual potentiometer with the photo
    resistor

41
Recompute Scale factor
  • Cover the resistor and find the max rctime value
  • Allow light to hit the resistor and find the min
    rctime value
  • Subtract the above and create a new ratio
  • Servo difference 500 scalefactor
  • Rctime difference ?
  • Dont forget to offset your results with 500

42
Try it
  • When the photoresistor is covered, the servo
    should move counterclockwise
  • When the photoresistor is uncovered, the servo
    should move clockwise
Write a Comment
User Comments (0)
About PowerShow.com