Advertisement
icstation

the code of Finger Measuring Heartbeat Sensor Module for Ard

Dec 4th, 2014
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. KY-039 Finger Measuring Heartbeat Sensor Module for Arduino(http://www.icstation.com/product_info.php?products_id=3276)
  2. Description
  3. Phototransistor on the other side of the finger, phototransistor used to obtain the flux emitted, when the blood pressure pulse by the finger when the resistance of the phototransistor will be slight changed.
  4.  
  5. We chose a very high resistance resistor R1, because most of the light through the finger is absorbed,it is desirable phototransistor sensitive enough.Resistance can be selected by experiment to get the best results.
  6. The most important is to keep the shield stray light into the phototransistor. For home lighting that is particularly important because the lights at home mostly based 50HZ or 60HZ fluctuate, so faint heartbeat will add considerable noise.
  7.  
  8. ARDUINO test code:
  9. // Pulse Monitor Test Script
  10. int ledPin = 13;
  11. int sensorPin = 0;
  12. double alpha = 0.75;
  13. int period = 20;
  14. double change = 0.0;
  15. void setup ()
  16. {
  17. pinMode (ledPin, OUTPUT);
  18. Serial.begin (115200);
  19. }
  20. void loop ()
  21. {
  22. static double oldValue = 0;
  23. static double oldChange = 0;
  24. int rawValue = analogRead (sensorPin);
  25. double value = alpha * oldValue + (1 - alpha) * rawValue;
  26.  
  27. Serial.print (rawValue);
  28. Serial.print (",");
  29. Serial.println (value);
  30. oldValue = value;
  31. delay (period);
  32. }
  33.  
  34. http://www.icstation.com/product_info.php?products_id=3276
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement