Title: Adjusting Dials and Monitoring
1Adjusting 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.
2Using 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.
3- 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.
4- 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
5Activity 1 Building/Testing Potentiometer
Circuit
- Construct the circuit and observe the LED's
brightness at different settings of the
potentiometer.
6- 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)
7Activity 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.
8Introducing 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.
Click Here For Movie of Exploding capacitor
9Build this circuitbe sure the power is off and
the capacitor is connected correctly
10Polling the RC-Time Circuit with the basic stamp
- Enter,Save, and Run PolledRcTimer.bs2 on the next
slide (page 146 of your text).
11See data studio scope Voltage probe
12Record 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, but
now using a 1000 uF capacitor in place of the
3300 uF.
13Fill in the charts with your data
What is your conclusion about the effects of R
C on discharge time?
14Here 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
15- 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.
16Activity 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.
17Build the circuit below
The goal here will be to monitor the position of
the potentiometer dial with RCTime
18Since 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
19Enter, Save, and Run ReadPotWithRcTime.bs2 on the
next slide (page 151 of your text)
20RCTIME 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
21Try 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
22- 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
23Activity 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
24Build two circuits
- Potentiometer circuit from last activity
- Servo Circuit from Ch4
- REMEMBER THE SERVO POWER JUMPER SETTINGS!!
25- 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
26Goal
- To make the servo horn maintain the same position
as the potentiometer dial
27Method
- Write an equation that the bs2 can use to figure
out where the servo should be at any
potentiometer rctime value.
28Gather your data
- Find the Potentiometer value that you want to
correspond with the 500,1000 750 positions on
the servo - Use the data chart to the right
29Plot a simple graphUse graphical analysis or any
graphing program to plot servo values vs. rctime
values
30Here is the graph that I plotted using the data
on the previous slide
31Write your equation using the values displayed on
the graph
- Y m x b
- Servo value (slope)(Pot value) y intercept
- Servo value (0.687)(Pot value) 501
32Lets See if this works
- Servo value (0.687)(Pot value) 501
- If potentiometer reads 356 Servo should be at 750
- Servo value (0.687)(356) 501 746
- Not too shabby!!
33Problem Basic stamp cannot use decimals
- Solution
- Multiply slope by 256
- Round off result
- Change equation to following
- Servo value (176)/(Pot value) 501
- Note / means multiply by something after
first dividing by 256
34Enter, run, and save the following code, using
your values for slope y_intercept
So, here is how we would get our servo position
from the potentiometer
35Now lets translate this into servo motionenter
the code below, but be sure to use your
scalefactor offset
36Many times the slope (ex 176), and the
y_intercept (ex 501) are used many times in a
program.
- The following makes this easier
- slope con 176
- Y_intercept con 501
- Now anywhere in your program you need to change
one of these values, you will only need to change
it once
37Trouble shooting Choppy servos
- Adjust pause command until servo motion is smooth
38Photo ResistorResistor whose resistance varies
with the intensity of light
- Goal Control servo direction with light
intensity
39Wiring the Circuit
- Replace the manual potentiometer with the photo
resistor
40Recompute Scale factor
- Cover the resistor and find the max rctime value
(this will correspond with 1000 on the servo) - Allow light to hit the resistor and find the min
rctime value (this will correspond with 500 on
the servo) - Plot your graph and write your equation
- Update your previous program to work with the
photoresistor
41Try it
- When the photoresistor is covered, the servo
should move counterclockwise - When the photoresistor is uncovered, the servo
should move clockwise
42Use an accelerometer or tilt sensor to control
your servo
43(No Transcript)
44Wire the Memsic 2125 Chip
45How to use it
- The MX 2125 Chip converts temperature readings
into pulse durations - When the gas bubble collects near the sensor on
the x axis, it heats it more, and the pulse
durations are big - When the gas bubble is away from the sensor on
the x axis, it heats it less, and the pulse
durations are small. - The same is true for the y axis
46(No Transcript)
47Programming
- Allow pulses from the chips x and y
sensors to be received by the basic stamp and
store the input as a variable - Show the results on the debug terminal
48Making the MX 2125 control a servo or servos
- Record the max and min pulsin values.
- Create your graph
- Write your equation
- Update the code for potentiometer controlled servo
- Here is some code that I wrote, of course the
values may be different than yours