January
2005, Issue 174
Light-to-Frequency
Conversion (Part 2)
Pulse
and Oxygen Content
SERIAL
DATA
The
sampled value is the main attraction here. By properly
shielding the TSL230R from extraneous light (the biggest
culprit being 60-Hz light sources), a nice waveform
can be produced from the sampled data. Pay attention
to the old adage: Garbage in, garbage out. Bogus data
will surely cause frustration no mater how good your
algorithm.
A
number of flags enable various data output. Although
the sample values are valuable, they aren’t too helpful
unless they’re displayed in a format you can easily
recognize. I found that using HyperTerminal to grab
the data and Excel to view the imported data as a graph
was extremely helpful in planning my algorithm without
having to write an application in, say, Visual Basic
to grab and display samples either as text or graphs.
I’m sure National Instrument’s LabView would’ve been
a great tool to use here as well. By adding other values
like MaxCNT and MinCNT to the output, I was able to
see exactly how my algorithm was using the data and
fine-tune it (see Figure 1).
Ultimately,
the basis of this project comes down to displaying two
variables, the beats per minute and oxygen saturation
level. I’ve covered how a beep fires off each time a
maximum peak is established. Text messages to display
the beats per minute and O2 are chosen using PB4 (after
reprogramming its function).