27220 Parallax Inc, 27220 Datasheet - Page 135

BOOK STAMPWORKS

27220

Manufacturer Part Number
27220
Description
BOOK STAMPWORKS
Manufacturer
Parallax Inc
Datasheet

Specifications of 27220

Accessory Type
Booklet
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Not applicable / Not applicable
For Use With/related Products
StampWorks
Lead Free Status / RoHS Status
Lead free / RoHS Compliant, Not applicable / Not applicable
Moving Forward · Page 125
Behind the Scenes
In this experiment the 555 is configured as an astable (free-running) oscillator.
Analyzing the output, the width of the high side of the signal is primarily controlled
by the resistance of the photocell. By measuring the high portion of the 555’s output
with PULSIN, the BASIC Stamp is able to determine the relative resistance of –
hence light falling on – the photocell.
The 555’s capacitor is charged through the CdS photocell and the 1K resistor while
the output (pin 3) is high. Once the threshold level is reached (about 2/3 Vdd) and
detected by pin 6 the 555 output and pin 7 will go low, causing the capacitor to
discharge through the 1K resistor. When the capacitor discharges to about 1/3 Vdd
and is detected by pin 2, the output goes back high and pin 7 is disconnected to
allow the capacitor to charge again. Since the CdS is only in the charge path (the
555 output is high), we only need to measure that side of the signal to determine
relative resistance.
The advantage to this scheme is that it is very fast acting; the disadvantage is that
quickly changing values can create challenges for some programs. We can slow the
changes with a bit of digital filtering.
By adding a portion of the previous
measurement to a portion of the current measurement, we are able to control how
quickly the value will reach the new setting. The ratio of raw-to-filtered readings in
this equation will determine the responsiveness of the filter. The larger the raw
portion, the faster the input response.
To dampen quickly-changing inputs, we
would use a small portion of the current reading with a large portion of the previous
reading. The key to correct digital filtering is to ensure that the relative percentages
add up to 100% (e.g. 25/75. 50/50, 90/10, etc.).

Related parts for 27220