相關資料請參考 ,有完整的函式庫和範例:
pulsesensor點com
PROJECT BACKGROUND:
Optical heart-rate monitors are easy to understand in theory. If you’ve ever shined a flashlight through your finger tips and seen your heart-beat pulse (a thing most kids have done) you have a good handle on the theory of optical heart-rate pulse sensors.
In an optical heart-rate pulse sensor, light is shot into a finger tip or ear lobe. The light either bounces back to a light sensor, or gets absorbed by blood cells.
As you continue to shine light (into say a fingertip) and take light sensor readings, you quickly start to get a heart-beat pulse reading.
The theory is easy to understand. In practice, it hard to master DIY optical heart-rate sensors, or get them operational at all. There are many tutorials on in publications describing how to make DIY heart-rate sensors. Through our own personal interests we’ve tried to follow on but have generally failed or had unsatisfactory results. As professors, year after year, we see our students attempt to follow these published guides and also either fail in getting anything to work, or get poor results. It could very well be human/user-error on our parts. But from our view, making an optical pulse sensor is easier said then done.
So, we set out to make our own optical heart-rate pulse senor that can be used in our own creative projects and also available to students, makers, game developers, mobile developers, artists, athletic trainers etc….
We had three goals for our sensor:
1) It had to actually work and be “plug and play” into Arduino (or other microcontroller).
2) It should be super small and easy to place (sew, glue, clip) into wearables, sports, arts, or gaming applications.
3) It could be used as a teaching aid for instruction on working with sensors, data visualization, and bio-feedback.
Over a few months we tested a gaggle of optical sensors and LED colors and found that it was not as easy as many suspect to get reliable heart-rate data through optical means. We could get basic, gross, short-term data, but reliable readings assuming real-world scenarios and real-world user interaction is key. After more experimentation and development, we started to assemble a reliable heart-rate pulse sensor. We a few test boards and continued to iterate the design.
As we tired to “wear” the sensor, we discovered that we should make it look and feel like a 1/2 inch button. Its size allows it to clip to earlobs or fingertips easily. When we add “button holes” to the design it can be easily sewn or attached to various garments and fashion accessories. The final design turned into a button-sized PCB board that holds all the technology, hit all our goals, and is very cute and accessible to a novice or expert users/developers alike.