Módulo Sensor Ritmo Cardiaco p/ Funduino
€3,95
€5,45
Adicionar ao Carrinho de Compras- Disponibilidade: Em stock
- SKU :: FUN-KS0015
- Tipo:: Robotica e prototipagem
- Marca:: Funduino
Descrição
Modulo sensor de ritmo cardíaco com o dedo. Este sensor é uma alternativa económica para medir o ritmo cardíaco. Compatível, com Arduino, RaspBerry e outros microcontroladores.Caracteristicas:Voltagem: 5V DCPeso: 4 gDimensões: 25 x 12 x 12 mmSample CodeThe program for this project is quite tricky to get right. Indeed, the first step is not to run the entirefinal script, but rather a test script that will gather data that we can then paste into a spreadsheet and chart to test out the smoothing algorithm (more on this later).The test script is provided in Listing Project 12.int ledPin = 13;int sensorPin = 0;double alpha = 0.75;int period = 20;double change = 0.0;void setup(){pinMode(ledPin, OUTPUT);Serial.begin(115200);}void loop(){static double oldValue = 0;static double oldChange = 0;int rawValue =analogRead(sensorPin);double value = alpha * oldValue+ (1 - alpha) * rawValue;Serial.print(rawValue);Serial.print(,);Serial.println(value);oldValue = value;delay(period);}This script reads the raw signal from the analog input and applies the smoothing function and thenwrites both values to the Serial Monitor, where we can capture them and paste them into a spreadsheet for analysis. Note that the Serial Monitors communications is set to its fastest rate tominimize the effects of the delays caused by sending the data. When you start the Serial Monitor, you will need to change the serial speed to 115200 baud.Copy and paste the captured text into a spreadsheet. The resultant data and a line chart drawn from the two columns are shown in Figure 5-17. The more jagged trace is from the raw data read from the analog port, and the smoother trace clearly has most of the noise removed. If the smoothed trace shows significant noise-in particular, any false peaks that will confuse the monitor-increase the level of smoothing by decreasing the value of alpha.Once you have found the right value of alpha for your sensor arrangement, you can transfer thisvalue into the real sketch and switch over to using the real sketch rather than the test sketch. The real sketch is provided in the following listing on the next page.int ledPin = 13;int sensorPin = 0;double alpha = 0.75;int period = 20;double change = 0.0;void setup(){pinMode(ledPin, OUTPUT);Serial.begin(115200);}void loop(){static double oldValue = 0;static double oldChange = 0;int rawValue =analogRead(sensorPin);double value = alpha * oldValue+ (1 - alpha) * rawValue;Serial.print(rawValue);Serial.print(,);Serial.println(value);oldValue = value;delay(period);}Link: http://wiki.keyestudio.com/index.php/Ks0015_keyestudio_Pulse_Rate_Monitor