Hook up UEXT to Arduino uno to recieve heart beat signal (mod-pulse)

Started by rogernm001, September 19, 2017, 05:17:03 AM

Previous topic - Next topic



Is it possible to run a wire from the UEXT straight to an Arduino Uno then write some code to interpret the signal its reading to turn on a series of lights whenever the pulse beats? I already hooked up the TX port from the UEXT to the analog on the Arduino and used the Arduino IDE sample code "ReadAnalogSerial" and modified it but was only receiving reading from a range of 0-4 every second. here is the code so far.

void setup() {
  // initialize serial communication at 9600 bits per second:

// the loop routine runs over and over again forever:
void loop()
  // read the input on analog pin 0:
  int sensorValue = analogRead(A0);
  // print out the value you read:
  if (sensorValue > 1)
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  if (sensorValue < 1)
  digitalWrite(LED_BUILTIN, LOW);   // turn the LED off (LOW is the voltage level)
  Serial.print("Sensor Value = ");
  delay(1);        // delay in between reads for stability


In your code you are not interpreting the data at all. Your LED only indicates when TX sends data (e.g. it works as TX activity LED).

I recommend you to take a look at this demo code that we have provided: https://www.olimex.com/Products/Modules/Biofeedback/MOD-PULSE/resources/MOD-PULSE-example.zip

First make sure to edit it and run it successfully without major modifications (only changing the responsible pins, etc). It would print data from MOD-PULSE over the serial monitor. Then you can modify the code to achieve your goals (e.g. compare the tmpstr[2] value with desired constant and set different blink rates for different thresholds).

Two important notices:

1. The code is made for OLIMEXINO-32u4 (Arduino Leonardo)! So the pins would be slightly different, you need to edit the code to fit your board!

2. MOD-PULSE is meant for 3.3V operation! Arduino UNO, as far as I'm aware works at 5V! You need to bring the 5V level signals to 3.3V.

Best regards,
Technical support and documentation manager at Olimex