概述:
心率传感器是Arduino用来测试心跳速率的传感器,学生、艺术家、运动员、创造者、游戏或者移动终端开发人员,可以开发出和心率有关的互动作品。传感器可以戴在手指或者耳垂上,通过互联线可以与Arduino相连。可以实时的把您的心率用图线显示出来。实质是一款集成了放大电路和噪声消除电路的光学心率传感器。pulseseneor是一款反射式光电脉搏传感器输出为模拟信号,可用示波器直接观察脉搏波形,也可以接模数转换器将模拟信号转化为数字信号,由微处理器或数字信号等进行处理分析。
心率传感器数据参数:
LED波长:609nm(绿光)
光电接收器:APDS-9008
直径:16mm
放大倍数:330
产品特点:
输出型号类别:模拟传感器
可穿戴 手指 耳垂手腕 等不同部位
供电电压:3V – 5V
Arduino实例程序:
int pulsePin = 0; // Pulse Sensor purple wire connected to analog pin 0 int blinkPin = 13; // pin to blink led at each beat int fadePin = 5; // pin to do fancy classy fading blink at each beat int fadeRate = 0; // used to fade LED on with PWM on fadePin // these variables are volatile because they are used during the interrupt service routine! volatile int BPM; // used to hold the pulse rate volatile int Signal; // holds the incoming raw data volatile int IBI = 600; // holds the time between beats, must be seeded! volatile boolean Pulse = false; // true when pulse wave is high, false when it's low volatile boolean QS = false; // becomes true when Arduoino finds a beat. void setup(){ pinMode(blinkPin,OUTPUT); // pin that will blink to your heartbeat! pinMode(fadePin,OUTPUT); // pin that will fade to your heartbeat! Serial.begin(115200); // we agree to talk fast! interruptSetup(); // sets up to read Pulse Sensor signal every 2mS // UN-COMMENT THE NEXT LINE IF YOU ARE POWERING The Pulse Sensor AT LOW VOLTAGE, // AND APPLY THAT VOLTAGE TO THE A-REF PIN //analogReference(EXTERNAL); } void loop(){ sendDataToProcessing('S', Signal); // send Processing the raw Pulse Sensor data if (QS == true){ // Quantified Self flag is true when arduino finds a heartbeat fadeRate = 255; // Set 'fadeRate' Variable to 255 to fade LED with pulse sendDataToProcessing('B',BPM); // send heart rate with a 'B' prefix sendDataToProcessing('Q',IBI); // send time between beats with a 'Q' prefix QS = false; // reset the Quantified Self flag for next time } ledFadeToBeat(); delay(20); // take a break } void ledFadeToBeat(){ fadeRate -= 15; // set LED fade value fadeRate = constrain(fadeRate,0,255); // keep LED fade value from going into negative numbers! analogWrite(fadePin,fadeRate); // fade LED } void sendDataToProcessing(char symbol, int data ){ Serial.print(symbol); // symbol prefix tells Processing what type of data is coming Serial.println(data); // the data to send culminating in a carriage return }
相关资料
Arduino 库文件:PulseSensorAmped_Arduino_1dot2
使用手册: PulseSensorAmpedGettingStartedGuide.pdf
Processing演示文件: Processing 演示文件
Arduino Code Walkthrough:pulse-sensor-amped-arduino-v1dot1